about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/selectors
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-08-25 04:27:47 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-08-25 09:52:13 +0200
commit0b733ca7909bb96269613ca05df7a91eb083d042 (patch)
tree3ecf3fb849c81f1bec7c19d3e1a9701d390c4a79 /app/javascript/flavours/glitch/selectors
parent28f0dfc0b42cde1e9443df13cae471ee7bb9d988 (diff)
[Glitch] Add ability to filter individual posts
Port 50487db1224851a49ee523bbc013d5f8686a7a55 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/selectors')
-rw-r--r--app/javascript/flavours/glitch/selectors/index.js19
1 files changed, 2 insertions, 17 deletions
diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js
index 7caa5259f..377805f16 100644
--- a/app/javascript/flavours/glitch/selectors/index.js
+++ b/app/javascript/flavours/glitch/selectors/index.js
@@ -1,6 +1,7 @@
 import escapeTextContentForBrowser from 'escape-html';
 import { createSelector } from 'reselect';
 import { List as ImmutableList } from 'immutable';
+import { toServerSideType } from 'flavours/glitch/util/filters';
 import { me } from 'flavours/glitch/util/initial_state';
 
 const getAccountBase         = (state, id) => state.getIn(['accounts', id], null);
@@ -21,23 +22,6 @@ export const makeGetAccount = () => {
   });
 };
 
-export const toServerSideType = columnType => {
-  switch (columnType) {
-  case 'home':
-  case 'notifications':
-  case 'public':
-  case 'thread':
-  case 'account':
-    return columnType;
-  default:
-    if (columnType.indexOf('list:') > -1) {
-      return 'home';
-    } else {
-      return 'public'; // community, account, hashtag
-    }
-  }
-};
-
 const getFilters = (state, { contextType }) => {
   if (!contextType) return null;
 
@@ -68,6 +52,7 @@ export const makeGetStatus = () => {
         if (filterResults.some((result) => filters.getIn([result.get('filter'), 'filter_action']) === 'hide')) {
           return null;
         }
+        filterResults = filterResults.filter(result => filters.has(result.get('filter')));
         if (!filterResults.isEmpty()) {
           filtered = filterResults.map(result => filters.getIn([result.get('filter'), 'title']));
         }