mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
[Glitch] Add quoted_update notification type
Port f3a932d8a1 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -31,7 +31,8 @@ export type NotificationWithStatusType =
|
||||
| 'mention'
|
||||
| 'quote'
|
||||
| 'poll'
|
||||
| 'update';
|
||||
| 'update'
|
||||
| 'quoted_update';
|
||||
|
||||
export type NotificationType =
|
||||
| NotificationWithStatusType
|
||||
|
||||
@@ -7,6 +7,7 @@ import { FormattedMessage } from 'react-intl';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
import EditIcon from '@/material-icons/400-24px/edit.svg?react';
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote.svg?react';
|
||||
import HomeIcon from '@/material-icons/400-24px/home-fill.svg?react';
|
||||
import InsertChartIcon from '@/material-icons/400-24px/insert_chart.svg?react';
|
||||
import PushPinIcon from '@/material-icons/400-24px/push_pin.svg?react';
|
||||
@@ -101,6 +102,14 @@ export default class StatusPrepend extends PureComponent {
|
||||
values={{ name: link }}
|
||||
/>
|
||||
);
|
||||
case 'quoted_update':
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='notification.quoted_update'
|
||||
defaultMessage='{name} edited a post you have quoted'
|
||||
values={{ name: link }}
|
||||
/>
|
||||
);
|
||||
case 'quote':
|
||||
return (
|
||||
<FormattedMessage
|
||||
@@ -142,9 +151,13 @@ export default class StatusPrepend extends PureComponent {
|
||||
iconComponent = HomeIcon;
|
||||
break;
|
||||
case 'update':
|
||||
case 'quoted_update':
|
||||
iconId = 'pencil';
|
||||
iconComponent = EditIcon;
|
||||
break;
|
||||
case 'quote':
|
||||
iconId = 'quote';
|
||||
iconComponent = FormatQuoteIcon;
|
||||
}
|
||||
|
||||
return !type ? null : (
|
||||
|
||||
@@ -9,7 +9,6 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import FlagIcon from '@/material-icons/400-24px/flag-fill.svg?react';
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote.svg?react';
|
||||
import PersonIcon from '@/material-icons/400-24px/person-fill.svg?react';
|
||||
import PersonAddIcon from '@/material-icons/400-24px/person_add-fill.svg?react';
|
||||
import { Account } from 'flavours/glitch/components/account';
|
||||
@@ -286,6 +285,31 @@ class Notification extends ImmutablePureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
renderQuotedUpdate (notification) {
|
||||
return (
|
||||
<StatusQuoteManager
|
||||
containerId={notification.get('id')}
|
||||
hidden={!!this.props.hidden}
|
||||
id={notification.get('status')}
|
||||
account={notification.get('account')}
|
||||
prepend='quoted_update'
|
||||
muted
|
||||
notification={notification}
|
||||
onMoveDown={this.handleMoveDown}
|
||||
onMoveUp={this.handleMoveUp}
|
||||
onMention={this.props.onMention}
|
||||
contextType='notifications'
|
||||
getScrollPosition={this.props.getScrollPosition}
|
||||
updateScrollBottom={this.props.updateScrollBottom}
|
||||
cachedMediaWidth={this.props.cachedMediaWidth}
|
||||
cacheMediaWidth={this.props.cacheMediaWidth}
|
||||
onUnmount={this.props.onUnmount}
|
||||
withDismiss
|
||||
unread={this.props.unread}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderPoll (notification) {
|
||||
return (
|
||||
<StatusQuoteManager
|
||||
@@ -448,6 +472,8 @@ class Notification extends ImmutablePureComponent {
|
||||
return this.renderStatus(notification);
|
||||
case 'update':
|
||||
return this.renderUpdate(notification);
|
||||
case 'quoted_update':
|
||||
return this.renderQuotedUpdate(notification);
|
||||
case 'poll':
|
||||
return this.renderPoll(notification);
|
||||
case 'severed_relationships':
|
||||
|
||||
@@ -16,6 +16,7 @@ import { NotificationMention } from './notification_mention';
|
||||
import { NotificationModerationWarning } from './notification_moderation_warning';
|
||||
import { NotificationPoll } from './notification_poll';
|
||||
import { NotificationQuote } from './notification_quote';
|
||||
import { NotificationQuotedUpdate } from './notification_quoted_update';
|
||||
import { NotificationReblog } from './notification_reblog';
|
||||
import { NotificationSeveredRelationships } from './notification_severed_relationships';
|
||||
import { NotificationStatus } from './notification_status';
|
||||
@@ -115,6 +116,14 @@ export const NotificationGroup: React.FC<{
|
||||
<NotificationUpdate unread={unread} notification={notificationGroup} />
|
||||
);
|
||||
break;
|
||||
case 'quoted_update':
|
||||
content = (
|
||||
<NotificationQuotedUpdate
|
||||
unread={unread}
|
||||
notification={notificationGroup}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case 'admin.sign_up':
|
||||
content = (
|
||||
<NotificationAdminSignUp
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import EditIcon from '@/material-icons/400-24px/edit.svg?react';
|
||||
import type { NotificationGroupQuotedUpdate } from 'flavours/glitch/models/notification_group';
|
||||
|
||||
import type { LabelRenderer } from './notification_group_with_status';
|
||||
import { NotificationWithStatus } from './notification_with_status';
|
||||
|
||||
const labelRenderer: LabelRenderer = (displayedName) => (
|
||||
<FormattedMessage
|
||||
id='notification.quoted_update'
|
||||
defaultMessage='{name} edited a post you have quoted'
|
||||
values={{ name: displayedName }}
|
||||
/>
|
||||
);
|
||||
|
||||
export const NotificationQuotedUpdate: React.FC<{
|
||||
notification: NotificationGroupQuotedUpdate;
|
||||
unread: boolean;
|
||||
}> = ({ notification, unread }) => (
|
||||
<NotificationWithStatus
|
||||
type='update'
|
||||
icon={EditIcon}
|
||||
iconId='edit'
|
||||
accountIds={notification.sampleAccountIds}
|
||||
count={notification.notifications_count}
|
||||
statusId={notification.statusId}
|
||||
labelRenderer={labelRenderer}
|
||||
unread={unread}
|
||||
/>
|
||||
);
|
||||
@@ -39,6 +39,8 @@ export type NotificationGroupMention = BaseNotificationWithStatus<'mention'>;
|
||||
export type NotificationGroupQuote = BaseNotificationWithStatus<'quote'>;
|
||||
export type NotificationGroupPoll = BaseNotificationWithStatus<'poll'>;
|
||||
export type NotificationGroupUpdate = BaseNotificationWithStatus<'update'>;
|
||||
export type NotificationGroupQuotedUpdate =
|
||||
BaseNotificationWithStatus<'quoted_update'>;
|
||||
export type NotificationGroupFollow = BaseNotification<'follow'>;
|
||||
export type NotificationGroupFollowRequest = BaseNotification<'follow_request'>;
|
||||
export type NotificationGroupAdminSignUp = BaseNotification<'admin.sign_up'>;
|
||||
@@ -91,6 +93,7 @@ export type NotificationGroup =
|
||||
| NotificationGroupQuote
|
||||
| NotificationGroupPoll
|
||||
| NotificationGroupUpdate
|
||||
| NotificationGroupQuotedUpdate
|
||||
| NotificationGroupFollow
|
||||
| NotificationGroupFollowRequest
|
||||
| NotificationGroupModerationWarning
|
||||
@@ -141,7 +144,8 @@ export function createNotificationGroupFromJSON(
|
||||
case 'mention':
|
||||
case 'quote':
|
||||
case 'poll':
|
||||
case 'update': {
|
||||
case 'update':
|
||||
case 'quoted_update': {
|
||||
const { status_id: statusId, ...groupWithoutStatus } = group;
|
||||
return {
|
||||
statusId: statusId ?? undefined,
|
||||
@@ -215,6 +219,7 @@ export function createNotificationGroupFromNotificationJSON(
|
||||
case 'quote':
|
||||
case 'poll':
|
||||
case 'update':
|
||||
case 'quoted_update':
|
||||
return {
|
||||
...group,
|
||||
type: notification.type,
|
||||
|
||||
Reference in New Issue
Block a user