Remove unused variables (#3906)
This commit is contained in:
parent
6fbb3841a6
commit
eff9416469
63 changed files with 60 additions and 182 deletions
|
@ -14,60 +14,6 @@ const initialState = Immutable.Map({
|
|||
results: Immutable.Map(),
|
||||
});
|
||||
|
||||
const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => {
|
||||
let newSuggestions = [];
|
||||
|
||||
if (accounts.length > 0) {
|
||||
newSuggestions.push({
|
||||
title: 'account',
|
||||
items: accounts.map(item => ({
|
||||
type: 'account',
|
||||
id: item.id,
|
||||
value: item.acct,
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
if (value.indexOf('@') === -1 && value.indexOf(' ') === -1 || hashtags.length > 0) {
|
||||
let hashtagItems = hashtags.map(item => ({
|
||||
type: 'hashtag',
|
||||
id: item,
|
||||
value: `#${item}`,
|
||||
}));
|
||||
|
||||
if (value.indexOf('@') === -1 && value.indexOf(' ') === -1 && !value.startsWith('http://') && !value.startsWith('https://') && hashtags.indexOf(value) === -1) {
|
||||
hashtagItems.unshift({
|
||||
type: 'hashtag',
|
||||
id: value,
|
||||
value: `#${value}`,
|
||||
});
|
||||
}
|
||||
|
||||
if (hashtagItems.length > 0) {
|
||||
newSuggestions.push({
|
||||
title: 'hashtag',
|
||||
items: hashtagItems,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (statuses.length > 0) {
|
||||
newSuggestions.push({
|
||||
title: 'status',
|
||||
items: statuses.map(item => ({
|
||||
type: 'status',
|
||||
id: item.id,
|
||||
value: item.id,
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
return state.withMutations(map => {
|
||||
map.set('suggestions', newSuggestions);
|
||||
map.set('loaded_value', value);
|
||||
});
|
||||
};
|
||||
|
||||
export default function search(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case SEARCH_CHANGE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue