mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Preliminary filter work on notifications
This commit is contained in:
parent
a25bcba8a6
commit
d5e985d6d4
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,7 @@ import { Fragment } from 'preact';
|
||||||
import { memo } from 'preact/compat';
|
import { memo } from 'preact/compat';
|
||||||
|
|
||||||
import { api } from '../utils/api';
|
import { api } from '../utils/api';
|
||||||
|
import { isFiltered } from '../utils/filters';
|
||||||
import shortenNumber from '../utils/shorten-number';
|
import shortenNumber from '../utils/shorten-number';
|
||||||
import states, { statusKey } from '../utils/states';
|
import states, { statusKey } from '../utils/states';
|
||||||
import { getCurrentAccountID } from '../utils/store-utils';
|
import { getCurrentAccountID } from '../utils/store-utils';
|
||||||
|
@ -451,6 +452,16 @@ function Notification({
|
||||||
notificationsCount > 0 && notificationsCount > sampleAccounts?.length;
|
notificationsCount > 0 && notificationsCount > sampleAccounts?.length;
|
||||||
const expandAccounts = diffCount ? 'remote' : 'local';
|
const expandAccounts = diffCount ? 'remote' : 'local';
|
||||||
|
|
||||||
|
// If there's a status and filter action is 'hide', then the notification is hidden
|
||||||
|
// TODO: Handle 'warn' action one day
|
||||||
|
if (!!status?.filtered) {
|
||||||
|
const isOwnPost = status?.account?.id === currentAccount;
|
||||||
|
const filterInfo = isFiltered(status.filtered, 'notifications');
|
||||||
|
if (!isSelf && !isOwnPost && filterInfo?.action === 'hide') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={`notification notification-${type}`}
|
class={`notification notification-${type}`}
|
||||||
|
|
Loading…
Reference in a new issue