Rename Notification Blacklist to Blocklist
Summary: per title Reviewed By: mweststrate Differential Revision: D25021786 fbshipit-source-id: 444e0959b5a4157171dad5c81b102abf105a99ed
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f68cef3046
commit
21ad9ad433
@@ -27,8 +27,8 @@ import React, {Component, Fragment} from 'react';
|
|||||||
import {clipboard} from 'electron';
|
import {clipboard} from 'electron';
|
||||||
import {
|
import {
|
||||||
PluginNotification,
|
PluginNotification,
|
||||||
updatePluginBlacklist,
|
updatePluginBlocklist,
|
||||||
updateCategoryBlacklist,
|
updateCategoryBlocklist,
|
||||||
} from './reducers/notifications';
|
} from './reducers/notifications';
|
||||||
import {selectPlugin} from './reducers/connections';
|
import {selectPlugin} from './reducers/connections';
|
||||||
import {State as StoreState} from './reducers/index';
|
import {State as StoreState} from './reducers/index';
|
||||||
@@ -45,8 +45,8 @@ type OwnProps = {
|
|||||||
type StateFromProps = {
|
type StateFromProps = {
|
||||||
activeNotifications: Array<PluginNotification>;
|
activeNotifications: Array<PluginNotification>;
|
||||||
invalidatedNotifications: Array<PluginNotification>;
|
invalidatedNotifications: Array<PluginNotification>;
|
||||||
blacklistedPlugins: Array<string>;
|
blocklistedPlugins: Array<string>;
|
||||||
blacklistedCategories: Array<string>;
|
blocklistedCategories: Array<string>;
|
||||||
devicePlugins: DevicePluginMap;
|
devicePlugins: DevicePluginMap;
|
||||||
clientPlugins: ClientPluginMap;
|
clientPlugins: ClientPluginMap;
|
||||||
};
|
};
|
||||||
@@ -57,8 +57,8 @@ type DispatchFromProps = {
|
|||||||
selectedApp: string | null;
|
selectedApp: string | null;
|
||||||
deepLinkPayload: unknown;
|
deepLinkPayload: unknown;
|
||||||
}) => any;
|
}) => any;
|
||||||
updatePluginBlacklist: (blacklist: Array<string>) => any;
|
updatePluginBlocklist: (blocklist: Array<string>) => any;
|
||||||
updateCategoryBlacklist: (blacklist: Array<string>) => any;
|
updateCategoryBlocklist: (blocklist: Array<string>) => any;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = OwnProps & StateFromProps & DispatchFromProps;
|
type Props = OwnProps & StateFromProps & DispatchFromProps;
|
||||||
@@ -106,7 +106,7 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
|
|||||||
|
|
||||||
componentDidUpdate(prevProps: Props & SearchableProps) {
|
componentDidUpdate(prevProps: Props & SearchableProps) {
|
||||||
if (this.props.filters.length !== prevProps.filters.length) {
|
if (this.props.filters.length !== prevProps.filters.length) {
|
||||||
this.props.updatePluginBlacklist(
|
this.props.updatePluginBlocklist(
|
||||||
this.props.filters
|
this.props.filters
|
||||||
.filter(
|
.filter(
|
||||||
(f) => f.type === 'exclude' && f.key.toLowerCase() === 'plugin',
|
(f) => f.type === 'exclude' && f.key.toLowerCase() === 'plugin',
|
||||||
@@ -114,7 +114,7 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
|
|||||||
.map((f) => String(f.value)),
|
.map((f) => String(f.value)),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.props.updateCategoryBlacklist(
|
this.props.updateCategoryBlocklist(
|
||||||
this.props.filters
|
this.props.filters
|
||||||
.filter(
|
.filter(
|
||||||
(f) => f.type === 'exclude' && f.key.toLowerCase() === 'category',
|
(f) => f.type === 'exclude' && f.key.toLowerCase() === 'category',
|
||||||
@@ -140,8 +140,8 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
|
|||||||
type: 'exclude',
|
type: 'exclude',
|
||||||
key: 'plugin',
|
key: 'plugin',
|
||||||
});
|
});
|
||||||
this.props.updatePluginBlacklist(
|
this.props.updatePluginBlocklist(
|
||||||
this.props.blacklistedPlugins.concat(pluginId),
|
this.props.blocklistedPlugins.concat(pluginId),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,8 +152,8 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
|
|||||||
type: 'exclude',
|
type: 'exclude',
|
||||||
key: 'category',
|
key: 'category',
|
||||||
});
|
});
|
||||||
this.props.updatePluginBlacklist(
|
this.props.updatePluginBlocklist(
|
||||||
this.props.blacklistedCategories.concat(category),
|
this.props.blocklistedCategories.concat(category),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,20 +163,20 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
|
|||||||
const searchTerm = this.props.searchTerm.toLowerCase();
|
const searchTerm = this.props.searchTerm.toLowerCase();
|
||||||
|
|
||||||
// filter plugins
|
// filter plugins
|
||||||
const blacklistedPlugins = new Set(
|
const blocklistedPlugins = new Set(
|
||||||
this.props.blacklistedPlugins.map((p) => p.toLowerCase()),
|
this.props.blocklistedPlugins.map((p) => p.toLowerCase()),
|
||||||
);
|
);
|
||||||
if (blacklistedPlugins.has(n.pluginId.toLowerCase())) {
|
if (blocklistedPlugins.has(n.pluginId.toLowerCase())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter categories
|
// filter categories
|
||||||
const {category} = n.notification;
|
const {category} = n.notification;
|
||||||
if (category) {
|
if (category) {
|
||||||
const blacklistedCategories = new Set(
|
const blocklistedCategories = new Set(
|
||||||
this.props.blacklistedCategories.map((p) => p.toLowerCase()),
|
this.props.blocklistedCategories.map((p) => p.toLowerCase()),
|
||||||
);
|
);
|
||||||
if (blacklistedCategories.has(category.toLowerCase())) {
|
if (blocklistedCategories.has(category.toLowerCase())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,21 +277,21 @@ export const ConnectedNotificationsTable = connect<
|
|||||||
notifications: {
|
notifications: {
|
||||||
activeNotifications,
|
activeNotifications,
|
||||||
invalidatedNotifications,
|
invalidatedNotifications,
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
},
|
},
|
||||||
plugins: {devicePlugins, clientPlugins},
|
plugins: {devicePlugins, clientPlugins},
|
||||||
}) => ({
|
}) => ({
|
||||||
activeNotifications,
|
activeNotifications,
|
||||||
invalidatedNotifications,
|
invalidatedNotifications,
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
devicePlugins,
|
devicePlugins,
|
||||||
clientPlugins,
|
clientPlugins,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
updatePluginBlacklist,
|
updatePluginBlocklist,
|
||||||
updateCategoryBlacklist,
|
updateCategoryBlocklist,
|
||||||
selectPlugin,
|
selectPlugin,
|
||||||
},
|
},
|
||||||
)(Searchable(NotificationsTable));
|
)(Searchable(NotificationsTable));
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import React from 'react';
|
|||||||
|
|
||||||
type StateFromProps = {
|
type StateFromProps = {
|
||||||
deepLinkPayload: unknown;
|
deepLinkPayload: unknown;
|
||||||
blacklistedPlugins: Array<string>;
|
blocklistedPlugins: Array<string>;
|
||||||
blacklistedCategories: Array<string>;
|
blocklistedCategories: Array<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DispatchFromProps = {
|
type DispatchFromProps = {
|
||||||
@@ -50,8 +50,8 @@ const Container = styled(FlexColumn)({
|
|||||||
class Notifications extends PureComponent<Props, State> {
|
class Notifications extends PureComponent<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
deepLinkPayload,
|
deepLinkPayload,
|
||||||
logger,
|
logger,
|
||||||
clearAllNotifications,
|
clearAllNotifications,
|
||||||
@@ -68,12 +68,12 @@ class Notifications extends PureComponent<Props, State> {
|
|||||||
onSelectPlugin={selectPlugin}
|
onSelectPlugin={selectPlugin}
|
||||||
logger={logger}
|
logger={logger}
|
||||||
defaultFilters={[
|
defaultFilters={[
|
||||||
...blacklistedPlugins.map((value) => ({
|
...blocklistedPlugins.map((value) => ({
|
||||||
value,
|
value,
|
||||||
type: 'exclude',
|
type: 'exclude',
|
||||||
key: 'plugin',
|
key: 'plugin',
|
||||||
})),
|
})),
|
||||||
...blacklistedCategories.map((value) => ({
|
...blocklistedCategories.map((value) => ({
|
||||||
value,
|
value,
|
||||||
type: 'exclude',
|
type: 'exclude',
|
||||||
key: 'category',
|
key: 'category',
|
||||||
@@ -94,11 +94,11 @@ class Notifications extends PureComponent<Props, State> {
|
|||||||
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
||||||
({
|
({
|
||||||
connections: {deepLinkPayload},
|
connections: {deepLinkPayload},
|
||||||
notifications: {blacklistedPlugins, blacklistedCategories},
|
notifications: {blocklistedPlugins, blocklistedCategories},
|
||||||
}) => ({
|
}) => ({
|
||||||
deepLinkPayload,
|
deepLinkPayload,
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
}),
|
}),
|
||||||
{clearAllNotifications, selectPlugin},
|
{clearAllNotifications, selectPlugin},
|
||||||
)(Notifications);
|
)(Notifications);
|
||||||
|
|||||||
@@ -430,13 +430,13 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
|||||||
uninitializedClients,
|
uninitializedClients,
|
||||||
staticView,
|
staticView,
|
||||||
},
|
},
|
||||||
notifications: {activeNotifications, blacklistedPlugins},
|
notifications: {activeNotifications, blocklistedPlugins},
|
||||||
plugins: {devicePlugins, clientPlugins},
|
plugins: {devicePlugins, clientPlugins},
|
||||||
}) => ({
|
}) => ({
|
||||||
numNotifications: (() => {
|
numNotifications: (() => {
|
||||||
const blacklist = new Set(blacklistedPlugins);
|
const blocklist = new Set(blocklistedPlugins);
|
||||||
return activeNotifications.filter(
|
return activeNotifications.filter(
|
||||||
(n: PluginNotification) => !blacklist.has(n.pluginId),
|
(n: PluginNotification) => !blocklist.has(n.pluginId),
|
||||||
).length;
|
).length;
|
||||||
})(),
|
})(),
|
||||||
windowIsFocused,
|
windowIsFocused,
|
||||||
|
|||||||
@@ -143,12 +143,12 @@ const RenderNotificationsEntry = connect<
|
|||||||
>(
|
>(
|
||||||
({
|
({
|
||||||
connections: {staticView},
|
connections: {staticView},
|
||||||
notifications: {activeNotifications, blacklistedPlugins},
|
notifications: {activeNotifications, blocklistedPlugins},
|
||||||
}) => ({
|
}) => ({
|
||||||
numNotifications: (() => {
|
numNotifications: (() => {
|
||||||
const blacklist = new Set(blacklistedPlugins);
|
const blocklist = new Set(blocklistedPlugins);
|
||||||
return activeNotifications.filter(
|
return activeNotifications.filter(
|
||||||
(n: PluginNotification) => !blacklist.has(n.pluginId),
|
(n: PluginNotification) => !blocklist.has(n.pluginId),
|
||||||
).length;
|
).length;
|
||||||
})(),
|
})(),
|
||||||
staticView,
|
staticView,
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import {setStaticView} from '../reducers/connections';
|
|||||||
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
||||||
import {
|
import {
|
||||||
setActiveNotifications,
|
setActiveNotifications,
|
||||||
updatePluginBlacklist,
|
updatePluginBlocklist,
|
||||||
updateCategoryBlacklist,
|
updateCategoryBlocklist,
|
||||||
} from '../reducers/notifications';
|
} from '../reducers/notifications';
|
||||||
import {textContent} from '../utils/index';
|
import {textContent} from '../utils/index';
|
||||||
import GK from '../fb-stubs/GK';
|
import GK from '../fb-stubs/GK';
|
||||||
@@ -63,21 +63,21 @@ export default (store: Store, logger: Logger) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const {category} = pluginNotification.notification;
|
const {category} = pluginNotification.notification;
|
||||||
const {blacklistedCategories} = store.getState().notifications;
|
const {blocklistedCategories} = store.getState().notifications;
|
||||||
if (category && blacklistedCategories.indexOf(category) === -1) {
|
if (category && blocklistedCategories.indexOf(category) === -1) {
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateCategoryBlacklist([...blacklistedCategories, category]),
|
updateCategoryBlocklist([...blocklistedCategories, category]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (arg === 2) {
|
} else if (arg === 2) {
|
||||||
// Hide plugin
|
// Hide plugin
|
||||||
logger.track('usage', 'notification-hide-plugin', pluginNotification);
|
logger.track('usage', 'notification-hide-plugin', pluginNotification);
|
||||||
|
|
||||||
const {blacklistedPlugins} = store.getState().notifications;
|
const {blocklistedPlugins} = store.getState().notifications;
|
||||||
if (blacklistedPlugins.indexOf(pluginNotification.pluginId) === -1) {
|
if (blocklistedPlugins.indexOf(pluginNotification.pluginId) === -1) {
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updatePluginBlacklist([
|
updatePluginBlocklist([
|
||||||
...blacklistedPlugins,
|
...blocklistedPlugins,
|
||||||
pluginNotification.pluginId,
|
pluginNotification.pluginId,
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
@@ -144,8 +144,8 @@ export default (store: Store, logger: Logger) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
activeNotifications,
|
activeNotifications,
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
} = notifications;
|
} = notifications;
|
||||||
|
|
||||||
activeNotifications
|
activeNotifications
|
||||||
@@ -161,9 +161,9 @@ export default (store: Store, logger: Logger) => {
|
|||||||
!isHeadless() &&
|
!isHeadless() &&
|
||||||
store.getState().connections.selectedPlugin !== 'notifications' &&
|
store.getState().connections.selectedPlugin !== 'notifications' &&
|
||||||
!knownNotifications.has(n.notification.id) &&
|
!knownNotifications.has(n.notification.id) &&
|
||||||
blacklistedPlugins.indexOf(n.pluginId) === -1 &&
|
blocklistedPlugins.indexOf(n.pluginId) === -1 &&
|
||||||
(!n.notification.category ||
|
(!n.notification.category ||
|
||||||
blacklistedCategories.indexOf(n.notification.category) === -1)
|
blocklistedCategories.indexOf(n.notification.category) === -1)
|
||||||
) {
|
) {
|
||||||
const prevNotificationTime: number =
|
const prevNotificationTime: number =
|
||||||
lastNotificationTime.get(n.pluginId) || 0;
|
lastNotificationTime.get(n.pluginId) || 0;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
default as reducer,
|
default as reducer,
|
||||||
setActiveNotifications,
|
setActiveNotifications,
|
||||||
clearAllNotifications,
|
clearAllNotifications,
|
||||||
updatePluginBlacklist,
|
updatePluginBlocklist,
|
||||||
updateCategoryBlacklist,
|
updateCategoryBlocklist,
|
||||||
} from '../notifications';
|
} from '../notifications';
|
||||||
|
|
||||||
import {Notification} from '../../plugin';
|
import {Notification} from '../../plugin';
|
||||||
@@ -30,33 +30,33 @@ function getInitialState(): State {
|
|||||||
return {
|
return {
|
||||||
activeNotifications: [],
|
activeNotifications: [],
|
||||||
invalidatedNotifications: [],
|
invalidatedNotifications: [],
|
||||||
blacklistedPlugins: [],
|
blocklistedPlugins: [],
|
||||||
blacklistedCategories: [],
|
blocklistedCategories: [],
|
||||||
clearedNotifications: new Set(),
|
clearedNotifications: new Set(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
test('reduce updateCategoryBlacklist', () => {
|
test('reduce updateCategoryBlocklist', () => {
|
||||||
const blacklistedCategories = ['blacklistedCategory'];
|
const blocklistedCategories = ['blocklistedCategory'];
|
||||||
const res = reducer(
|
const res = reducer(
|
||||||
getInitialState(),
|
getInitialState(),
|
||||||
updateCategoryBlacklist(blacklistedCategories),
|
updateCategoryBlocklist(blocklistedCategories),
|
||||||
);
|
);
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
...getInitialState(),
|
...getInitialState(),
|
||||||
blacklistedCategories,
|
blocklistedCategories,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('reduce updatePluginBlacklist', () => {
|
test('reduce updatePluginBlocklist', () => {
|
||||||
const blacklistedPlugins = ['blacklistedPlugin'];
|
const blocklistedPlugins = ['blocklistedPlugin'];
|
||||||
const res = reducer(
|
const res = reducer(
|
||||||
getInitialState(),
|
getInitialState(),
|
||||||
updatePluginBlacklist(blacklistedPlugins),
|
updatePluginBlocklist(blocklistedPlugins),
|
||||||
);
|
);
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
...getInitialState(),
|
...getInitialState(),
|
||||||
blacklistedPlugins,
|
blocklistedPlugins,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -149,8 +149,8 @@ test('addNotification removes duplicates', () => {
|
|||||||
"pluginId": "test",
|
"pluginId": "test",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"blacklistedCategories": Array [],
|
"blocklistedCategories": Array [],
|
||||||
"blacklistedPlugins": Array [],
|
"blocklistedPlugins": Array [],
|
||||||
"clearedNotifications": Set {},
|
"clearedNotifications": Set {},
|
||||||
"invalidatedNotifications": Array [],
|
"invalidatedNotifications": Array [],
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ test('reduce removeNotification', () => {
|
|||||||
"pluginId": "test",
|
"pluginId": "test",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"blacklistedCategories": Array [],
|
"blocklistedCategories": Array [],
|
||||||
"blacklistedPlugins": Array [],
|
"blocklistedPlugins": Array [],
|
||||||
"clearedNotifications": Set {},
|
"clearedNotifications": Set {},
|
||||||
"invalidatedNotifications": Array [],
|
"invalidatedNotifications": Array [],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ export type PluginNotificationReference = {
|
|||||||
export type State = {
|
export type State = {
|
||||||
activeNotifications: Array<PluginNotification>;
|
activeNotifications: Array<PluginNotification>;
|
||||||
invalidatedNotifications: Array<PluginNotification>;
|
invalidatedNotifications: Array<PluginNotification>;
|
||||||
blacklistedPlugins: Array<string>;
|
blocklistedPlugins: Array<string>;
|
||||||
blacklistedCategories: Array<string>;
|
blocklistedCategories: Array<string>;
|
||||||
clearedNotifications: Set<string>;
|
clearedNotifications: Set<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,11 +52,11 @@ export type Action =
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'UPDATE_PLUGIN_BLACKLIST';
|
type: 'UPDATE_PLUGIN_BLOCKLIST';
|
||||||
payload: Array<string>;
|
payload: Array<string>;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'UPDATE_CATEGORY_BLACKLIST';
|
type: 'UPDATE_CATEGORY_BLOCKLIST';
|
||||||
payload: Array<string>;
|
payload: Array<string>;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@@ -71,8 +71,8 @@ export type Action =
|
|||||||
const INITIAL_STATE: State = {
|
const INITIAL_STATE: State = {
|
||||||
activeNotifications: [],
|
activeNotifications: [],
|
||||||
invalidatedNotifications: [],
|
invalidatedNotifications: [],
|
||||||
blacklistedPlugins: [],
|
blocklistedPlugins: [],
|
||||||
blacklistedCategories: [],
|
blocklistedCategories: [],
|
||||||
clearedNotifications: new Set(),
|
clearedNotifications: new Set(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,15 +99,15 @@ export default function reducer(
|
|||||||
activeNotifications: [],
|
activeNotifications: [],
|
||||||
invalidatedNotifications: [],
|
invalidatedNotifications: [],
|
||||||
};
|
};
|
||||||
case 'UPDATE_PLUGIN_BLACKLIST':
|
case 'UPDATE_PLUGIN_BLOCKLIST':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
blacklistedPlugins: action.payload,
|
blocklistedPlugins: action.payload,
|
||||||
};
|
};
|
||||||
case 'UPDATE_CATEGORY_BLACKLIST':
|
case 'UPDATE_CATEGORY_BLOCKLIST':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
blacklistedCategories: action.payload,
|
blocklistedCategories: action.payload,
|
||||||
};
|
};
|
||||||
case 'ADD_NOTIFICATION':
|
case 'ADD_NOTIFICATION':
|
||||||
return {
|
return {
|
||||||
@@ -233,16 +233,16 @@ export function clearAllNotifications(): Action {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updatePluginBlacklist(payload: Array<string>): Action {
|
export function updatePluginBlocklist(payload: Array<string>): Action {
|
||||||
return {
|
return {
|
||||||
type: 'UPDATE_PLUGIN_BLACKLIST',
|
type: 'UPDATE_PLUGIN_BLOCKLIST',
|
||||||
payload,
|
payload,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateCategoryBlacklist(payload: Array<string>): Action {
|
export function updateCategoryBlocklist(payload: Array<string>): Action {
|
||||||
return {
|
return {
|
||||||
type: 'UPDATE_CATEGORY_BLACKLIST',
|
type: 'UPDATE_CATEGORY_BLOCKLIST',
|
||||||
payload,
|
payload,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ function NotificationButton({
|
|||||||
const notifications = useStore((state) => state.notifications);
|
const notifications = useStore((state) => state.notifications);
|
||||||
const activeNotifications = useMemoize(filterNotifications, [
|
const activeNotifications = useMemoize(filterNotifications, [
|
||||||
notifications.activeNotifications,
|
notifications.activeNotifications,
|
||||||
notifications.blacklistedPlugins,
|
notifications.blocklistedPlugins,
|
||||||
notifications.blacklistedCategories,
|
notifications.blocklistedCategories,
|
||||||
]);
|
]);
|
||||||
return (
|
return (
|
||||||
<LeftRailButton
|
<LeftRailButton
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import {deconstructClientId} from '../../utils/clientUtils';
|
|||||||
import {selectPlugin} from '../../reducers/connections';
|
import {selectPlugin} from '../../reducers/connections';
|
||||||
import {
|
import {
|
||||||
clearAllNotifications,
|
clearAllNotifications,
|
||||||
updateCategoryBlacklist,
|
updateCategoryBlocklist,
|
||||||
updatePluginBlacklist,
|
updatePluginBlocklist,
|
||||||
} from '../../reducers/notifications';
|
} from '../../reducers/notifications';
|
||||||
import {filterNotifications} from './notificationUtils';
|
import {filterNotifications} from './notificationUtils';
|
||||||
import {useMemoize} from '../../utils/useMemoize';
|
import {useMemoize} from '../../utils/useMemoize';
|
||||||
@@ -217,8 +217,8 @@ export function Notification() {
|
|||||||
|
|
||||||
const activeNotifications = useMemoize(filterNotifications, [
|
const activeNotifications = useMemoize(filterNotifications, [
|
||||||
notifications.activeNotifications,
|
notifications.activeNotifications,
|
||||||
notifications.blacklistedPlugins,
|
notifications.blocklistedPlugins,
|
||||||
notifications.blacklistedCategories,
|
notifications.blocklistedCategories,
|
||||||
]);
|
]);
|
||||||
const displayedNotifications: Array<PluginNotification> = useMemo(
|
const displayedNotifications: Array<PluginNotification> = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -238,16 +238,16 @@ export function Notification() {
|
|||||||
onHideSimilar: noti.notification.category
|
onHideSimilar: noti.notification.category
|
||||||
? () =>
|
? () =>
|
||||||
dispatch(
|
dispatch(
|
||||||
updateCategoryBlacklist([
|
updateCategoryBlocklist([
|
||||||
...notifications.blacklistedCategories,
|
...notifications.blocklistedCategories,
|
||||||
noti.notification.category!,
|
noti.notification.category!,
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
onHidePlugin: () =>
|
onHidePlugin: () =>
|
||||||
dispatch(
|
dispatch(
|
||||||
updatePluginBlacklist([
|
updatePluginBlocklist([
|
||||||
...notifications.blacklistedPlugins,
|
...notifications.blocklistedPlugins,
|
||||||
noti.pluginId,
|
noti.pluginId,
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user