Skip to content

Commit

Permalink
Merge commit '3e91c101b3c4b5166dab778837e38bed424b4333' into glitch-s…
Browse files Browse the repository at this point in the history
…oc/merge-upstream
  • Loading branch information
ClearlyClaire committed Sep 17, 2024
2 parents 18209d2 + 3e91c10 commit 6de18bb
Show file tree
Hide file tree
Showing 71 changed files with 108 additions and 211 deletions.
60 changes: 45 additions & 15 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions app/javascript/mastodon/actions/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { debounce } from 'lodash';

import type { MarkerJSON } from 'mastodon/api_types/markers';
import { getAccessToken } from 'mastodon/initial_state';
import { selectUseGroupedNotifications } from 'mastodon/selectors/settings';
import type { AppDispatch, RootState } from 'mastodon/store';
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';

Expand Down Expand Up @@ -76,12 +75,7 @@ interface MarkerParam {
}

function getLastNotificationId(state: RootState): string | undefined {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return selectUseGroupedNotifications(state)
? state.notificationGroups.lastReadId
: // @ts-expect-error state.notifications is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
state.getIn(['notifications', 'lastReadId']);
return state.notificationGroups.lastReadId;
}

const buildPostMarkersParams = (state: RootState) => {
Expand Down
8 changes: 2 additions & 6 deletions app/javascript/mastodon/actions/notifications_migration.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { selectUseGroupedNotifications } from 'mastodon/selectors/settings';
import { createAppAsyncThunk } from 'mastodon/store';

import { fetchNotifications } from './notification_groups';
import { expandNotifications } from './notifications';

export const initializeNotifications = createAppAsyncThunk(
'notifications/initialize',
(_, { dispatch, getState }) => {
if (selectUseGroupedNotifications(getState()))
void dispatch(fetchNotifications());
else void dispatch(expandNotifications({}));
(_, { dispatch }) => {
void dispatch(fetchNotifications());
},
);
28 changes: 8 additions & 20 deletions app/javascript/mastodon/actions/streaming.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @ts-check

import { selectUseGroupedNotifications } from 'mastodon/selectors/settings';

import { getLocale } from '../locales';
import { connectStream } from '../stream';

Expand Down Expand Up @@ -105,18 +103,14 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
const notificationJSON = JSON.parse(data.payload);
dispatch(updateNotifications(notificationJSON, messages, locale));
// TODO: remove this once the groups feature replaces the previous one
if(selectUseGroupedNotifications(getState())) {
dispatch(processNewNotificationForGroups(notificationJSON));
}
dispatch(processNewNotificationForGroups(notificationJSON));
break;
}
case 'notifications_merged':
const state = getState();
if (state.notifications.top || !state.notifications.mounted)
dispatch(expandNotifications({ forceLoad: true, maxId: undefined }));
if (selectUseGroupedNotifications(state)) {
dispatch(refreshStaleNotificationGroups());
}
dispatch(refreshStaleNotificationGroups());
break;
case 'conversation':
// @ts-expect-error
Expand All @@ -141,21 +135,15 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti

/**
* @param {Function} dispatch
* @param {Function} getState
*/
async function refreshHomeTimelineAndNotification(dispatch, getState) {
async function refreshHomeTimelineAndNotification(dispatch) {
await dispatch(expandHomeTimeline({ maxId: undefined }));

// TODO: remove this once the groups feature replaces the previous one
if(selectUseGroupedNotifications(getState())) {
// TODO: polling for merged notifications
try {
await dispatch(pollRecentGroupNotifications());
} catch {
// TODO
}
} else {
await dispatch(expandNotifications({}));
// TODO: polling for merged notifications
try {
await dispatch(pollRecentGroupNotifications());
} catch {
// TODO
}

await dispatch(fetchAnnouncements());
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/components/follow_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export const FollowButton: React.FC<{
label = <LoadingIndicator />;
} else if (relationship.following && relationship.followed_by) {
label = intl.formatMessage(messages.mutual);
} else if (!relationship.following && relationship.followed_by) {
label = intl.formatMessage(messages.followBack);
} else if (relationship.following || relationship.requested) {
label = intl.formatMessage(messages.unfollow);
} else if (relationship.followed_by) {
label = intl.formatMessage(messages.followBack);
} else {
label = intl.formatMessage(messages.follow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ const messageForFollowButton = relationship => {

if (relationship.get('following') && relationship.get('followed_by')) {
return messages.mutual;
} else if (!relationship.get('following') && relationship.get('followed_by')) {
return messages.followBack;
} else if (relationship.get('following') || relationship.get('requested')) {
return messages.unfollow;
} else if (relationship.get('followed_by')) {
return messages.followBack;
} else {
return messages.follow;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { FormattedMessage } from 'react-intl';
import ImmutablePropTypes from 'react-immutable-proptypes';

import { identityContextPropShape, withIdentity } from 'mastodon/identity_context';
import { forceGroupedNotifications } from 'mastodon/initial_state';
import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_REPORTS } from 'mastodon/permissions';

import ClearColumnButton from './clear_column_button';
Expand Down Expand Up @@ -36,7 +35,6 @@ class ColumnSettings extends PureComponent {

const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;
const groupingShowStr = <FormattedMessage id='notifications.column_settings.beta.grouping' defaultMessage='Group notifications' />;
const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />;
const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
const soundStr = <FormattedMessage id='notifications.column_settings.sound' defaultMessage='Play sound' />;
Expand Down Expand Up @@ -68,18 +66,6 @@ class ColumnSettings extends PureComponent {

<PolicyControls />

{!forceGroupedNotifications && (
<section role='group' aria-labelledby='notifications-beta'>
<h3 id='notifications-beta'>
<FormattedMessage id='notifications.column_settings.beta.category' defaultMessage='Experimental features' />
</h3>

<div className='column-settings__row'>
<SettingToggle id='unread-notification-markers' prefix='notifications' settings={settings} settingPath={['groupingBeta']} onChange={onChange} label={groupingShowStr} />
</div>
</section>
)}

<section role='group' aria-labelledby='notifications-unread-markers'>
<h3 id='notifications-unread-markers'>
<FormattedMessage id='notifications.column_settings.unread_notifications.category' defaultMessage='Unread notifications' />
Expand Down
7 changes: 1 addition & 6 deletions app/javascript/mastodon/features/notifications_wrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import Notifications from 'mastodon/features/notifications';
import Notifications_v2 from 'mastodon/features/notifications_v2';
import { selectUseGroupedNotifications } from 'mastodon/selectors/settings';
import { useAppSelector } from 'mastodon/store';

export const NotificationsWrapper = (props) => {
const optedInGroupedNotifications = useAppSelector(selectUseGroupedNotifications);

return (
optedInGroupedNotifications ? <Notifications_v2 {...props} /> : <Notifications {...props} />
<Notifications_v2 {...props} />
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default class ColumnsArea extends ImmutablePureComponent {
children: PropTypes.node,
};

// Corresponds to (max-width: $no-gap-breakpoint + 285px - 1px) in SCSS
mediaQuery = 'matchMedia' in window && window.matchMedia('(max-width: 1174px)');
// Corresponds to (max-width: $no-gap-breakpoint - 1px) in SCSS
mediaQuery = 'matchMedia' in window && window.matchMedia('(max-width: 1206px)');

state = {
renderComposePanel: !(this.mediaQuery && this.mediaQuery.matches),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { timelinePreview, trendsEnabled } from 'mastodon/initial_state';
import { transientSingleColumn } from 'mastodon/is_mobile';
import { canManageReports, canViewAdminDashboard } from 'mastodon/permissions';
import { selectUnreadNotificationGroupsCount } from 'mastodon/selectors/notifications';
import { selectUseGroupedNotifications } from 'mastodon/selectors/settings';

import ColumnLink from './column_link';
import DisabledAccountBanner from './disabled_account_banner';
Expand Down Expand Up @@ -65,19 +64,17 @@ const messages = defineMessages({
});

const NotificationsLink = () => {
const optedInGroupedNotifications = useSelector(selectUseGroupedNotifications);
const count = useSelector(state => state.getIn(['notifications', 'unread']));
const intl = useIntl();

const newCount = useSelector(selectUnreadNotificationGroupsCount);
const count = useSelector(selectUnreadNotificationGroupsCount);
const intl = useIntl();

return (
<ColumnLink
key='notifications'
transparent
to='/notifications'
icon={<IconWithBadge id='bell' icon={NotificationsIcon} count={optedInGroupedNotifications ? newCount : count} className='column-link__icon' />}
activeIcon={<IconWithBadge id='bell' icon={NotificationsActiveIcon} count={optedInGroupedNotifications ? newCount : count} className='column-link__icon' />}
icon={<IconWithBadge id='bell' icon={NotificationsIcon} count={count} className='column-link__icon' />}
activeIcon={<IconWithBadge id='bell' icon={NotificationsActiveIcon} count={count} className='column-link__icon' />}
text={intl.formatMessage(messages.notifications)}
/>
);
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
* @property {boolean=} use_pending_items
* @property {string} version
* @property {string} sso_redirect
* @property {boolean} force_grouped_notifications
*/

/**
Expand Down Expand Up @@ -119,7 +118,6 @@ export const criticalUpdatesPending = initialState?.critical_updates_pending;
// @ts-expect-error
export const statusPageUrl = getMeta('status_page_url');
export const sso_redirect = getMeta('sso_redirect');
export const forceGroupedNotifications = getMeta('force_grouped_notifications');

/**
* @returns {string | undefined}
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,6 @@
"notifications.column_settings.admin.report": "التبليغات الجديدة:",
"notifications.column_settings.admin.sign_up": "التسجيلات الجديدة:",
"notifications.column_settings.alert": "إشعارات سطح المكتب",
"notifications.column_settings.beta.category": "ميزات تجريبية",
"notifications.column_settings.beta.grouping": "جمّع الإشعارات",
"notifications.column_settings.favourite": "المفضلة:",
"notifications.column_settings.filter_bar.advanced": "عرض جميع الفئات",
"notifications.column_settings.filter_bar.category": "شريط التصفية السريعة",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@
"notifications.clear": "Borrar los avisos",
"notifications.column_settings.admin.report": "Informes nuevos:",
"notifications.column_settings.admin.sign_up": "Rexistros nuevos:",
"notifications.column_settings.beta.category": "Funciones esperimentales",
"notifications.column_settings.follow": "Siguidores nuevos:",
"notifications.column_settings.follow_request": "Solicitúes de siguimientu nueves:",
"notifications.column_settings.mention": "Menciones:",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@
"notifications.column_settings.admin.report": "Новыя скаргі:",
"notifications.column_settings.admin.sign_up": "Новыя ўваходы:",
"notifications.column_settings.alert": "Апавяшчэнні на працоўным стале",
"notifications.column_settings.beta.category": "Эксперыментальныя функцыі",
"notifications.column_settings.beta.grouping": "Групаваць апавяшчэннi",
"notifications.column_settings.favourite": "Упадабанае:",
"notifications.column_settings.filter_bar.advanced": "Паказаць усе катэгорыі",
"notifications.column_settings.filter_bar.category": "Панэль хуткай фільтрацыі",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,6 @@
"notifications.column_settings.admin.report": "Нови доклади:",
"notifications.column_settings.admin.sign_up": "Нови регистрации:",
"notifications.column_settings.alert": "Известия на работния плот",
"notifications.column_settings.beta.category": "Експериментални функции",
"notifications.column_settings.beta.grouping": "Групови известия",
"notifications.column_settings.favourite": "Любими:",
"notifications.column_settings.filter_bar.advanced": "Показване на всички категории",
"notifications.column_settings.filter_bar.category": "Лента за бърз филтър",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Nous informes:",
"notifications.column_settings.admin.sign_up": "Registres nous:",
"notifications.column_settings.alert": "Notificacions d'escriptori",
"notifications.column_settings.beta.category": "Característiques experimentals",
"notifications.column_settings.beta.grouping": "Notificacions de grup",
"notifications.column_settings.favourite": "Favorits:",
"notifications.column_settings.filter_bar.advanced": "Mostra totes les categories",
"notifications.column_settings.filter_bar.category": "Barra ràpida de filtres",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,6 @@
"notifications.column_settings.admin.report": "Nová hlášení:",
"notifications.column_settings.admin.sign_up": "Nové registrace:",
"notifications.column_settings.alert": "Oznámení na počítači",
"notifications.column_settings.beta.category": "Experimentální funkce",
"notifications.column_settings.beta.grouping": "Seskupit notifikace",
"notifications.column_settings.favourite": "Oblíbené:",
"notifications.column_settings.filter_bar.advanced": "Zobrazit všechny kategorie",
"notifications.column_settings.filter_bar.category": "Panel rychlého filtrování",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Adroddiadau newydd:",
"notifications.column_settings.admin.sign_up": "Cofrestriadau newydd:",
"notifications.column_settings.alert": "Hysbysiadau bwrdd gwaith",
"notifications.column_settings.beta.category": "Nodweddion arbrofol",
"notifications.column_settings.beta.grouping": "Grŵpio hysbysiadau",
"notifications.column_settings.favourite": "Ffefrynnau:",
"notifications.column_settings.filter_bar.advanced": "Dangos pob categori",
"notifications.column_settings.filter_bar.category": "Bar hidlo cyflym",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Nye anmeldelser:",
"notifications.column_settings.admin.sign_up": "Nye tilmeldinger:",
"notifications.column_settings.alert": "Computernotifikationer",
"notifications.column_settings.beta.category": "Eksperimentelle funktioner",
"notifications.column_settings.beta.grouping": "Gruppér notifikationer",
"notifications.column_settings.favourite": "Favoritter:",
"notifications.column_settings.filter_bar.advanced": "Vis alle kategorier",
"notifications.column_settings.filter_bar.category": "Hurtigfiltreringsbjælke",
Expand Down
4 changes: 1 addition & 3 deletions app/javascript/mastodon/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Neue Meldungen:",
"notifications.column_settings.admin.sign_up": "Neue Registrierungen:",
"notifications.column_settings.alert": "Desktop-Benachrichtigungen",
"notifications.column_settings.beta.category": "Experimentelle Funktionen",
"notifications.column_settings.beta.grouping": "Benachrichtigungen gruppieren",
"notifications.column_settings.favourite": "Favoriten:",
"notifications.column_settings.filter_bar.advanced": "Alle Filterkategorien anzeigen",
"notifications.column_settings.filter_bar.category": "Filterleiste",
Expand Down Expand Up @@ -777,7 +775,7 @@
"status.admin_domain": "{domain} moderieren",
"status.admin_status": "Beitrag moderieren",
"status.block": "@{name} blockieren",
"status.bookmark": "Beitrag als Lesezeichen setzen",
"status.bookmark": "Lesezeichen setzen",
"status.cancel_reblog_private": "Beitrag nicht mehr teilen",
"status.cannot_reblog": "Dieser Beitrag kann nicht geteilt werden",
"status.continued_thread": "Fortgeführter Thread",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,6 @@
"notifications.column_settings.admin.report": "Νέες αναφορές:",
"notifications.column_settings.admin.sign_up": "Νέες εγγραφές:",
"notifications.column_settings.alert": "Ειδοποιήσεις επιφάνειας εργασίας",
"notifications.column_settings.beta.category": "Πειραματικές λειτουργίες",
"notifications.column_settings.beta.grouping": "Ομαδοποίηση ειδοποιήσεων",
"notifications.column_settings.favourite": "Αγαπημένα:",
"notifications.column_settings.filter_bar.advanced": "Εμφάνιση όλων των κατηγοριών",
"notifications.column_settings.filter_bar.category": "Μπάρα γρήγορου φίλτρου",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "New reports:",
"notifications.column_settings.admin.sign_up": "New sign-ups:",
"notifications.column_settings.alert": "Desktop notifications",
"notifications.column_settings.beta.category": "Experimental features",
"notifications.column_settings.beta.grouping": "Group notifications",
"notifications.column_settings.favourite": "Favourites:",
"notifications.column_settings.filter_bar.advanced": "Display all categories",
"notifications.column_settings.filter_bar.category": "Quick filter bar",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "New reports:",
"notifications.column_settings.admin.sign_up": "New sign-ups:",
"notifications.column_settings.alert": "Desktop notifications",
"notifications.column_settings.beta.category": "Experimental features",
"notifications.column_settings.beta.grouping": "Group notifications",
"notifications.column_settings.favourite": "Favorites:",
"notifications.column_settings.filter_bar.advanced": "Display all categories",
"notifications.column_settings.filter_bar.category": "Quick filter bar",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/es-AR.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Nuevas denuncias:",
"notifications.column_settings.admin.sign_up": "Nuevos registros:",
"notifications.column_settings.alert": "Notificaciones de escritorio",
"notifications.column_settings.beta.category": "Funciones experimentales",
"notifications.column_settings.beta.grouping": "Agrupar notificaciones",
"notifications.column_settings.favourite": "Favoritos:",
"notifications.column_settings.filter_bar.advanced": "Mostrar todas las categorías",
"notifications.column_settings.filter_bar.category": "Barra de filtrado rápido",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Nuevas denuncias:",
"notifications.column_settings.admin.sign_up": "Registros nuevos:",
"notifications.column_settings.alert": "Notificaciones de escritorio",
"notifications.column_settings.beta.category": "Características experimentales",
"notifications.column_settings.beta.grouping": "Agrupar notificaciones",
"notifications.column_settings.favourite": "Favoritos:",
"notifications.column_settings.filter_bar.advanced": "Mostrar todas las categorías",
"notifications.column_settings.filter_bar.category": "Barra de filtrado rápido",
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@
"notifications.column_settings.admin.report": "Nuevos informes:",
"notifications.column_settings.admin.sign_up": "Nuevos registros:",
"notifications.column_settings.alert": "Notificaciones de escritorio",
"notifications.column_settings.beta.category": "Características experimentales",
"notifications.column_settings.beta.grouping": "Agrupar notificaciones",
"notifications.column_settings.favourite": "Favoritos:",
"notifications.column_settings.filter_bar.advanced": "Mostrar todas las categorías",
"notifications.column_settings.filter_bar.category": "Barra de filtrado rápido",
Expand Down
Loading

0 comments on commit 6de18bb

Please sign in to comment.