1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Compare commits

...

4 commits

Author SHA1 Message Date
Nick Schonning
e3a6127e3b
Merge b7e971f2d1 into a50c8e951f 2024-07-31 14:05:06 +00:00
Claire
a50c8e951f
Fix issue with grouped notifications UI due to recent API change (#31224) 2024-07-31 13:23:08 +00:00
Claire
2c1e75727d
Change filtered notification banner design to take up less space (#31222) 2024-07-31 12:36:08 +00:00
Nick Schonning
b7e971f2d1
Opt-in config to Prettier 2024-07-24 12:54:56 -04:00
12 changed files with 58 additions and 70 deletions

View file

@ -83,3 +83,4 @@ AUTHORS.md
# Process a few selected JS files
!lint-staged.config.js
!/config/**/*.js

View file

@ -60,7 +60,7 @@ export interface BaseNotificationGroupJSON {
interface NotificationGroupWithStatusJSON extends BaseNotificationGroupJSON {
type: NotificationWithStatusType;
status: ApiStatusJSON;
status_id: string;
}
interface NotificationWithStatusJSON extends BaseNotificationJSON {

View file

@ -49,21 +49,14 @@ export const FilteredNotificationsBanner: React.FC = () => {
<span>
<FormattedMessage
id='filtered_notifications_banner.pending_requests'
defaultMessage='Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know'
defaultMessage='From {count, plural, =0 {no one} one {one person} other {# people}} you may know'
values={{ count: policy.summary.pending_requests_count }}
/>
</span>
</div>
<div className='filtered-notifications-banner__badge'>
<div className='filtered-notifications-banner__badge__badge'>
{toCappedNumber(policy.summary.pending_notifications_count)}
</div>
<FormattedMessage
id='filtered_notifications_banner.mentions'
defaultMessage='{count, plural, one {mention} other {mentions}}'
values={{ count: policy.summary.pending_notifications_count }}
/>
{toCappedNumber(policy.summary.pending_notifications_count)}
</div>
</Link>
);

View file

@ -300,8 +300,7 @@
"filter_modal.select_filter.subtitle": "Use an existing category or create a new one",
"filter_modal.select_filter.title": "Filter this post",
"filter_modal.title.status": "Filter a post",
"filtered_notifications_banner.mentions": "{count, plural, one {mention} other {mentions}}",
"filtered_notifications_banner.pending_requests": "Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know",
"filtered_notifications_banner.pending_requests": "From {count, plural, =0 {no one} one {one person} other {# people}} you may know",
"filtered_notifications_banner.title": "Filtered notifications",
"firehose.all": "All",
"firehose.local": "This server",

View file

@ -124,9 +124,9 @@ export function createNotificationGroupFromJSON(
case 'mention':
case 'poll':
case 'update': {
const { status, ...groupWithoutStatus } = group;
const { status_id: statusId, ...groupWithoutStatus } = group;
return {
statusId: status.id,
statusId,
sampleAccountIds,
...groupWithoutStatus,
};

View file

@ -10171,25 +10171,10 @@ noscript {
}
&__badge {
display: flex;
align-items: center;
border-radius: 999px;
background: var(--background-border-color);
color: $darker-text-color;
padding: 4px;
padding-inline-end: 8px;
gap: 6px;
font-weight: 500;
font-size: 11px;
line-height: 16px;
word-break: keep-all;
&__badge {
background: $ui-button-background-color;
color: $white;
border-radius: 100px;
padding: 2px 8px;
}
background: $ui-button-background-color;
color: $white;
border-radius: 100px;
padding: 2px 8px;
}
}

View file

@ -1,6 +1,8 @@
const path = require('path');
const currentTranslations = require(path.join(__dirname, "../app/javascript/mastodon/locales/en.json"));
const currentTranslations = require(
path.join(__dirname, '../app/javascript/mastodon/locales/en.json'),
);
exports.format = (msgs) => {
const results = {};

View file

@ -7,7 +7,9 @@ const { env } = require('process');
const { load } = require('js-yaml');
const configPath = resolve('config', 'webpacker.yml');
const settings = load(readFileSync(configPath), 'utf8')[env.RAILS_ENV || env.NODE_ENV];
const settings = load(readFileSync(configPath), 'utf8')[
env.RAILS_ENV || env.NODE_ENV
];
const themePath = resolve('config', 'themes.yml');
const themes = load(readFileSync(themePath), 'utf8');

View file

@ -57,6 +57,6 @@ module.exports = merge(sharedConfig, {
settings.dev_server.watch_options,
watchOptions,
),
writeToDisk: filePath => /ocr/.test(filePath),
writeToDisk: (filePath) => /ocr/.test(filePath),
},
});

View file

@ -42,24 +42,27 @@ module.exports = merge(sharedConfig, {
cache: true,
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/,
}),
new BundleAnalyzerPlugin({ // generates report.html
new BundleAnalyzerPlugin({
// generates report.html
analyzerMode: 'static',
openAnalyzer: false,
logLevel: 'silent', // do not bother Webpacker, who runs with --json and parses stdout
}),
new InjectManifest({
additionalManifestEntries: ['1f602.svg', 'sheet_13.png'].map((filename) => {
const path = resolve(root, 'public', 'emoji', filename);
const body = readFileSync(path);
const md5 = createHash('md5');
additionalManifestEntries: ['1f602.svg', 'sheet_13.png'].map(
(filename) => {
const path = resolve(root, 'public', 'emoji', filename);
const body = readFileSync(path);
const md5 = createHash('md5');
md5.update(body);
md5.update(body);
return {
revision: md5.digest('hex'),
url: `/emoji/${filename}`,
};
}),
return {
revision: md5.digest('hex'),
url: `/emoji/${filename}`,
};
},
),
exclude: [
/(?:base|extra)_polyfills-.*\.js$/,
/locale_.*\.js$/,
@ -68,7 +71,14 @@ module.exports = merge(sharedConfig, {
include: [/\.js$/, /\.css$/],
maximumFileSizeToCacheInBytes: 2 * 1_024 * 1_024, // 2 MiB
swDest: resolve(root, 'public', 'packs', 'sw.js'),
swSrc: resolve(root, 'app', 'javascript', 'mastodon', 'service_worker', 'entry.js'),
swSrc: resolve(
root,
'app',
'javascript',
'mastodon',
'service_worker',
'entry.js',
),
}),
],
});

View file

@ -3,18 +3,18 @@ const { join, resolve } = require('path');
const { env, settings } = require('../configuration');
// Those modules contain modern ES code that need to be transpiled for Webpack to process it
const nodeModulesToProcess = [
'@reduxjs', 'fuzzysort'
];
const nodeModulesToProcess = ['@reduxjs', 'fuzzysort'];
module.exports = {
test: /\.(js|jsx|mjs|ts|tsx)$/,
include: [
settings.source_path,
...settings.resolved_paths,
...nodeModulesToProcess.map(p => resolve(`node_modules/${p}`)),
].map(p => resolve(p)),
exclude: new RegExp('node_modules\\/(?!(' + nodeModulesToProcess.join('|')+')\\/).*'),
...nodeModulesToProcess.map((p) => resolve(`node_modules/${p}`)),
].map((p) => resolve(p)),
exclude: new RegExp(
'node_modules\\/(?!(' + nodeModulesToProcess.join('|') + ')\\/).*',
),
use: [
{
loader: 'babel-loader',

View file

@ -21,7 +21,8 @@ module.exports = {
packPaths.reduce((map, entry) => {
const localMap = map;
const namespace = relative(join(entryPath), dirname(entry));
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
localMap[join(namespace, basename(entry, extname(entry)))] =
resolve(entry);
return localMap;
}, {}),
Object.keys(themes).reduce((themePaths, name) => {
@ -61,19 +62,17 @@ module.exports = {
},
module: {
rules: Object.keys(rules).map(key => rules[key]),
rules: Object.keys(rules).map((key) => rules[key]),
strictExportPresence: true,
},
plugins: [
new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))),
new webpack.NormalModuleReplacementPlugin(
/^history\//, (resource) => {
// temporary fix for https://github.com/ReactTraining/react-router/issues/5576
// to reduce bundle size
resource.request = resource.request.replace(/^history/, 'history/es');
},
),
new webpack.NormalModuleReplacementPlugin(/^history\//, (resource) => {
// temporary fix for https://github.com/ReactTraining/react-router/issues/5576
// to reduce bundle size
resource.request = resource.request.replace(/^history/, 'history/es');
}),
new MiniCssExtractPlugin({
filename: 'css/[name]-[contenthash:8].css',
chunkFilename: 'css/[name]-[contenthash:8].chunk.css',
@ -87,18 +86,15 @@ module.exports = {
}),
new CircularDependencyPlugin({
failOnError: true,
})
}),
],
resolve: {
extensions: settings.extensions,
modules: [
resolve(settings.source_path),
'node_modules',
],
modules: [resolve(settings.source_path), 'node_modules'],
alias: {
"@": resolve(settings.source_path),
}
'@': resolve(settings.source_path),
},
},
resolveLoader: {