Skip to content

Commit

Permalink
Merge branch 'deanveloper-revert-notification-grouping' into revert-d…
Browse files Browse the repository at this point in the history
…ean-grouping
  • Loading branch information
neatchee committed Jul 23, 2024
2 parents b893677 + 5fddcdd commit c423fa9
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 264 deletions.
134 changes: 0 additions & 134 deletions app/javascript/flavours/glitch/components/name_list.jsx

This file was deleted.

16 changes: 6 additions & 10 deletions app/javascript/flavours/glitch/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { injectIntl, FormattedMessage } from 'react-intl';

import classNames from 'classnames';

import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

Expand Down Expand Up @@ -83,7 +82,7 @@ class Status extends ImmutablePureComponent {
containerId: PropTypes.string,
id: PropTypes.string,
status: ImmutablePropTypes.map,
account: PropTypes.oneOfType([ImmutablePropTypes.record, ImmutablePropTypes.listOf(ImmutablePropTypes.record)]),
account: ImmutablePropTypes.record,
previousId: PropTypes.string,
nextInReplyToId: PropTypes.string,
rootId: PropTypes.string,
Expand Down Expand Up @@ -560,8 +559,6 @@ class Status extends ImmutablePureComponent {
let media = contentMedia;
let mediaIcons = contentMediaIcons;

const accounts = ImmutableList.isList(account) ? account : ImmutableList.of(account);

if (settings.getIn(['content_warnings', 'media_outside'])) {
media = extraMedia;
mediaIcons = extraMediaIcons;
Expand Down Expand Up @@ -760,7 +757,7 @@ class Status extends ImmutablePureComponent {
'data-status-by': `@${status.getIn(['account', 'acct'])}`,
};

if (this.props.prepend && accounts) {
if (this.props.prepend && account) {
const notifKind = {
favourite: 'favourited',
reaction: 'reacted',
Expand All @@ -769,13 +766,12 @@ class Status extends ImmutablePureComponent {
status: 'posted',
}[this.props.prepend];

selectorAttribs[`data-${notifKind}-by`] = accounts.map(acct => `@${acct.get('acct')}`).join(',');
selectorAttribs[`data-${notifKind}-by`] = `@${account.get('acct')}`;

prepend = (
<StatusPrepend
type={this.props.prepend}
status={status}
accounts={accounts}
account={account}
parseClick={parseClick}
notificationId={this.props.notificationId}
>
Expand All @@ -791,7 +787,7 @@ class Status extends ImmutablePureComponent {
if (this.props.prepend === 'reblog') {
rebloggedByText = intl.formatMessage(
{ id: 'status.reblogged_by', defaultMessage: '{name} boosted' },
{ name: new Intl.ListFormat(intl.locale, { type: 'conjunction' }).format(accounts.map(acct => acct.get('acct'))) },
{ name: account.get('acct') },
);
}

Expand Down Expand Up @@ -822,7 +818,7 @@ class Status extends ImmutablePureComponent {
<header className='status__info'>
<StatusHeader
status={status}
friends={accounts}
friend={account}
collapsed={isCollapsed}
parseClick={parseClick}
avatarSize={avatarSize}
Expand Down
8 changes: 4 additions & 4 deletions app/javascript/flavours/glitch/components/status_header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class StatusHeader extends PureComponent {

static propTypes = {
status: ImmutablePropTypes.map.isRequired,
friends: ImmutablePropTypes.listOf(ImmutablePropTypes.map),
friend: ImmutablePropTypes.map,
avatarSize: PropTypes.number,
parseClick: PropTypes.func.isRequired,
};
Expand All @@ -33,17 +33,17 @@ export default class StatusHeader extends PureComponent {
render () {
const {
status,
friends,
friend,
avatarSize,
} = this.props;

const account = status.get('account');

let statusAvatar;
if (friends === undefined || friends === null || !friends.get(0)) {
if (friend === undefined || friend === null) {
statusAvatar = <Avatar account={account} size={avatarSize} />;
} else {
statusAvatar = <AvatarOverlay account={account} friend={friends.get(0)} />;
statusAvatar = <AvatarOverlay account={account} friend={friend} />;
}

return (
Expand Down
60 changes: 27 additions & 33 deletions app/javascript/flavours/glitch/components/status_prepend.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,19 @@ import StarIcon from '@/material-icons/400-24px/star-fill.svg?react';
import { Icon } from 'flavours/glitch/components/icon';
import { me } from 'flavours/glitch/initial_state';

import NameList from './name_list';

export default class StatusPrepend extends PureComponent {

static propTypes = {
type: PropTypes.string.isRequired,
status: ImmutablePropTypes.map.isRequired,
accounts: ImmutablePropTypes.listOf(ImmutablePropTypes.map.isRequired),
account: ImmutablePropTypes.map.isRequired,
parseClick: PropTypes.func.isRequired,
notificationId: PropTypes.number,
children: PropTypes.node,
};

handleClick = (acct, e) => {
const { status, parseClick } = this.props;

if (!acct) {
const originalAuthor = status.getIn(['reblog', 'account', 'acct'], status.getIn(['account', 'acct']));
const originalStatusId = status.getIn(['reblog', 'id'], status.get('id'));
parseClick(e, `/@${originalAuthor}/${originalStatusId}` + this.getUrlSuffix());
} else {
parseClick(e, `/@${acct.get('acct')}`);
}
handleClick = (e) => {
const { account, parseClick } = this.props;
parseClick(e, `/@${account.get('acct')}`);
};

getUrlSuffix = () => {
Expand All @@ -54,18 +44,22 @@ export default class StatusPrepend extends PureComponent {
};

Message = () => {
const { type, accounts, status } = this.props;

const viewMoreHref = status.get('url') + this.getUrlSuffix();

const linkifiedAccounts = (
<span>
<NameList
accounts={accounts}
viewMoreHref={viewMoreHref}
onClick={this.handleClick}
/>
</span>
const { type, account } = this.props;
let link = (
<a
onClick={this.handleClick}
href={account.get('url')}
className='status__display-name'
data-hover-card-account={account.get('id')}
>
<bdi>
<strong
dangerouslySetInnerHTML={{
__html : account.get('display_name_html') || account.get('username'),
}}
/>
</bdi>
</a>
);

switch (type) {
Expand All @@ -78,43 +72,43 @@ export default class StatusPrepend extends PureComponent {
<FormattedMessage
id='status.reblogged_by'
defaultMessage='{name} boosted'
values={{ name : linkifiedAccounts }}
values={{ name : link }}
/>
);
case 'favourite':
return (
<FormattedMessage
id='notification.favourite'
defaultMessage='{name} favourited your status'
values={{ name : linkifiedAccounts }}
values={{ name : link }}
/>
);
case 'reaction':
return (
<FormattedMessage
id='notification.reaction'
defaultMessage='{name} reacted to your status'
values={{ name: linkifiedAccounts }}
values={{ name: link }}
/>
);
case 'reblog':
return (
<FormattedMessage
id='notification.reblog'
defaultMessage='{name} boosted your status'
values={{ name : linkifiedAccounts }}
values={{ name : link }}
/>
);
case 'status':
return (
<FormattedMessage
id='notification.status'
defaultMessage='{name} just posted'
values={{ name: linkifiedAccounts }}
values={{ name: link }}
/>
);
case 'poll':
if (me === accounts.get(0).get('id')) {
if (me === account.get('id')) {
return (
<FormattedMessage
id='notification.own_poll'
Expand All @@ -134,7 +128,7 @@ export default class StatusPrepend extends PureComponent {
<FormattedMessage
id='notification.update'
defaultMessage='{name} edited a post'
values={{ name: linkifiedAccounts }}
values={{ name: link }}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ class ColumnSettings extends PureComponent {
render () {
const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = this.props;

const groupReactions = <FormattedMessage id='notifications.column_settings.notification_grouping.reaction' defaultMessage='Group Reactions' />;
const groupFavorites = <FormattedMessage id='notifications.column_settings.notification_grouping.favourite' defaultMessage='Group Favourites' />;
const groupBoosts = <FormattedMessage id='notifications.column_settings.notification_grouping.boost' defaultMessage='Group Boosts' />;
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 filterBarShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show_bar' defaultMessage='Show filter bar' />;
Expand Down Expand Up @@ -84,18 +81,6 @@ class ColumnSettings extends PureComponent {
</section>
)}

<section role='group' aria-labelledby='notifications-grouping'>
<span id='notifications-grouping' className='column-settings__section'>
<FormattedMessage id='notifications.column_settings.notification_grouping.category' defaultMessage='Notification Grouping' />
</span>

<div className='column-settings__row'>
<SettingToggle id='group-reactions' prefix='notifications' settings={settings} settingPath={['grouping', 'reaction']} onChange={onChange} label={groupReactions} />
<SettingToggle id='group-favourites' prefix='notifications' settings={settings} settingPath={['grouping', 'favourite']} onChange={onChange} label={groupFavorites} />
<SettingToggle id='group-boosts' prefix='notifications' settings={settings} settingPath={['grouping', 'reblog']} onChange={onChange} label={groupBoosts} />
</div>
</section>

<section>
<h3><FormattedMessage id='notifications.policy.title' defaultMessage='Filter out notifications from…' /></h3>

Expand Down
Loading

0 comments on commit c423fa9

Please sign in to comment.