mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-28 04:12:41 +03:00
Fix leaked follow requests from Notifications popover to page
This commit is contained in:
parent
a697fb04df
commit
78a6f13380
1 changed files with 37 additions and 33 deletions
|
@ -379,39 +379,43 @@ function Notifications({ columnMode }) {
|
|||
)}
|
||||
{snapStates.notifications.length ? (
|
||||
<>
|
||||
{snapStates.notifications.map((notification) => {
|
||||
if (onlyMentions && notification.type !== 'mention') {
|
||||
return null;
|
||||
}
|
||||
const notificationDay = new Date(notification.createdAt);
|
||||
const differentDay =
|
||||
notificationDay.toDateString() !== currentDay.toDateString();
|
||||
if (differentDay) {
|
||||
currentDay = notificationDay;
|
||||
}
|
||||
// if notificationDay is yesterday, show "Yesterday"
|
||||
// if notificationDay is before yesterday, show date
|
||||
const heading =
|
||||
notificationDay.toDateString() === yesterdayDate.toDateString()
|
||||
? 'Yesterday'
|
||||
: niceDateTime(currentDay, {
|
||||
hideTime: true,
|
||||
});
|
||||
return (
|
||||
<>
|
||||
{differentDay && <h2 class="timeline-header">{heading}</h2>}
|
||||
<Notification
|
||||
instance={instance}
|
||||
notification={notification}
|
||||
key={notification.id}
|
||||
reload={() => {
|
||||
loadNotifications(true);
|
||||
loadFollowRequests();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
{snapStates.notifications
|
||||
// This is leaked from Notifications popover
|
||||
.filter((n) => n.type !== 'follow_request')
|
||||
.map((notification) => {
|
||||
if (onlyMentions && notification.type !== 'mention') {
|
||||
return null;
|
||||
}
|
||||
const notificationDay = new Date(notification.createdAt);
|
||||
const differentDay =
|
||||
notificationDay.toDateString() !== currentDay.toDateString();
|
||||
if (differentDay) {
|
||||
currentDay = notificationDay;
|
||||
}
|
||||
// if notificationDay is yesterday, show "Yesterday"
|
||||
// if notificationDay is before yesterday, show date
|
||||
const heading =
|
||||
notificationDay.toDateString() ===
|
||||
yesterdayDate.toDateString()
|
||||
? 'Yesterday'
|
||||
: niceDateTime(currentDay, {
|
||||
hideTime: true,
|
||||
});
|
||||
return (
|
||||
<>
|
||||
{differentDay && <h2 class="timeline-header">{heading}</h2>}
|
||||
<Notification
|
||||
instance={instance}
|
||||
notification={notification}
|
||||
key={notification.id}
|
||||
reload={() => {
|
||||
loadNotifications(true);
|
||||
loadFollowRequests();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue