kopia lustrzana https://github.com/cheeaun/phanpy
Distinct both implementation of grouped notifications
rodzic
b88376569e
commit
a2b88f1cdd
|
@ -147,9 +147,11 @@ function Notification({
|
||||||
report,
|
report,
|
||||||
event,
|
event,
|
||||||
moderation_warning,
|
moderation_warning,
|
||||||
|
// Client-side grouped notification
|
||||||
|
_ids,
|
||||||
_accounts,
|
_accounts,
|
||||||
_statuses,
|
_statuses,
|
||||||
// Grouped notification
|
// Server-side grouped notification
|
||||||
sampleAccounts,
|
sampleAccounts,
|
||||||
notificationsCount,
|
notificationsCount,
|
||||||
} = notification;
|
} = notification;
|
||||||
|
@ -266,7 +268,7 @@ function Notification({
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={`notification notification-${type}`}
|
class={`notification notification-${type}`}
|
||||||
data-notification-id={id}
|
data-notification-id={_ids || id}
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -177,7 +177,7 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
|
||||||
.slice(0, NOTIFICATIONS_DISPLAY_LIMIT)
|
.slice(0, NOTIFICATIONS_DISPLAY_LIMIT)
|
||||||
.map((notification) => (
|
.map((notification) => (
|
||||||
<Notification
|
<Notification
|
||||||
key={notification.ids || notification.id}
|
key={notification._ids || notification.id}
|
||||||
instance={instance}
|
instance={instance}
|
||||||
notification={notification}
|
notification={notification}
|
||||||
disableContextMenu
|
disableContextMenu
|
||||||
|
|
|
@ -716,12 +716,12 @@ function Notifications({ columnMode }) {
|
||||||
hideTime: true,
|
hideTime: true,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<Fragment key={notification.ids || notification.id}>
|
<Fragment key={notification._ids || notification.id}>
|
||||||
{differentDay && <h2 class="timeline-header">{heading}</h2>}
|
{differentDay && <h2 class="timeline-header">{heading}</h2>}
|
||||||
<Notification
|
<Notification
|
||||||
instance={instance}
|
instance={instance}
|
||||||
notification={notification}
|
notification={notification}
|
||||||
key={notification.ids || notification.id}
|
key={notification._ids || notification.id}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
@ -99,12 +99,12 @@ export function groupNotifications2(groupNotifications) {
|
||||||
const mappedNotification = notificationsMap2[key];
|
const mappedNotification = notificationsMap2[key];
|
||||||
if (mappedNotification) {
|
if (mappedNotification) {
|
||||||
mappedNotification._statuses.push(gn.status);
|
mappedNotification._statuses.push(gn.status);
|
||||||
mappedNotification.ids += `-${gn.id}`;
|
mappedNotification._ids += `-${gn.id}`;
|
||||||
} else {
|
} else {
|
||||||
let n = (notificationsMap2[key] = {
|
let n = (notificationsMap2[key] = {
|
||||||
ids: gn.id,
|
|
||||||
...gn,
|
...gn,
|
||||||
type,
|
type,
|
||||||
|
_ids: gn.id,
|
||||||
_statuses: [gn.status],
|
_statuses: [gn.status],
|
||||||
});
|
});
|
||||||
newGroupNotifications2.push(n);
|
newGroupNotifications2.push(n);
|
||||||
|
@ -145,18 +145,18 @@ export default function groupNotifications(notifications) {
|
||||||
if (mappedAccount) {
|
if (mappedAccount) {
|
||||||
mappedAccount._types.push(type);
|
mappedAccount._types.push(type);
|
||||||
mappedAccount._types.sort().reverse();
|
mappedAccount._types.sort().reverse();
|
||||||
mappedNotification.ids += `-${id}`;
|
mappedNotification._ids += `-${id}`;
|
||||||
} else {
|
} else {
|
||||||
account._types = [type];
|
account._types = [type];
|
||||||
mappedNotification._accounts.push(account);
|
mappedNotification._accounts.push(account);
|
||||||
mappedNotification.ids += `-${id}`;
|
mappedNotification._ids += `-${id}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (account) account._types = [type];
|
if (account) account._types = [type];
|
||||||
let n = (notificationsMap[key] = {
|
let n = (notificationsMap[key] = {
|
||||||
ids: id,
|
|
||||||
...notification,
|
...notification,
|
||||||
type: virtualType,
|
type: virtualType,
|
||||||
|
_ids: id,
|
||||||
_accounts: account ? [account] : [],
|
_accounts: account ? [account] : [],
|
||||||
});
|
});
|
||||||
cleanNotifications[j++] = n;
|
cleanNotifications[j++] = n;
|
||||||
|
@ -179,12 +179,12 @@ export default function groupNotifications(notifications) {
|
||||||
const mappedNotification = notificationsMap2[key];
|
const mappedNotification = notificationsMap2[key];
|
||||||
if (mappedNotification) {
|
if (mappedNotification) {
|
||||||
mappedNotification._statuses.push(notification.status);
|
mappedNotification._statuses.push(notification.status);
|
||||||
mappedNotification.ids += `-${id}`;
|
mappedNotification._ids += `-${id}`;
|
||||||
} else {
|
} else {
|
||||||
let n = (notificationsMap2[key] = {
|
let n = (notificationsMap2[key] = {
|
||||||
ids: id,
|
|
||||||
...notification,
|
...notification,
|
||||||
type,
|
type,
|
||||||
|
_ids: id,
|
||||||
_statuses: [notification.status],
|
_statuses: [notification.status],
|
||||||
});
|
});
|
||||||
cleanNotifications2[j++] = n;
|
cleanNotifications2[j++] = n;
|
||||||
|
|
Ładowanie…
Reference in New Issue