mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-26 14:53:41 +01:00
[Glitch] Remove dead code in WebUI filtering code
Port a233a9bfb5
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
bbafe28fbc
commit
93b6ad2c6c
1 changed files with 1 additions and 26 deletions
|
@ -1,6 +1,6 @@
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { List as ImmutableList, is } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import { me } from 'flavours/glitch/util/initial_state';
|
import { me } from 'flavours/glitch/util/initial_state';
|
||||||
|
|
||||||
const getAccountBase = (state, id) => state.getIn(['accounts', id], null);
|
const getAccountBase = (state, id) => state.getIn(['accounts', id], null);
|
||||||
|
@ -38,31 +38,6 @@ export const toServerSideType = columnType => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const escapeRegExp = string =>
|
|
||||||
string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
||||||
|
|
||||||
const regexFromKeywords = keywords => {
|
|
||||||
if (keywords.size === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new RegExp(keywords.map(keyword_filter => {
|
|
||||||
let expr = escapeRegExp(keyword_filter.get('keyword'));
|
|
||||||
|
|
||||||
if (keyword_filter.get('whole_word')) {
|
|
||||||
if (/^[\w]/.test(expr)) {
|
|
||||||
expr = `\\b${expr}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/[\w]$/.test(expr)) {
|
|
||||||
expr = `${expr}\\b`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return expr;
|
|
||||||
}).join('|'), 'i');
|
|
||||||
};
|
|
||||||
|
|
||||||
const getFilters = (state, { contextType }) => {
|
const getFilters = (state, { contextType }) => {
|
||||||
if (!contextType) return null;
|
if (!contextType) return null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue