mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-21 00:29:47 +00:00
Fix case-sensitive check for previously used hashtags (#23526)
This commit is contained in:
parent
841263a548
commit
4da5f77d92
|
@ -186,11 +186,12 @@ const ignoreSuggestion = (state, position, token, completion, path) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortHashtagsByUse = (state, tags) => {
|
const sortHashtagsByUse = (state, tags) => {
|
||||||
const personalHistory = state.get('tagHistory');
|
const personalHistory = state.get('tagHistory').map(tag => tag.toLowerCase());
|
||||||
|
|
||||||
return tags.sort((a, b) => {
|
const tagsWithLowercase = tags.map(t => ({ ...t, lowerName: t.name.toLowerCase() }));
|
||||||
const usedA = personalHistory.includes(a.name);
|
const sorted = tagsWithLowercase.sort((a, b) => {
|
||||||
const usedB = personalHistory.includes(b.name);
|
const usedA = personalHistory.includes(a.lowerName);
|
||||||
|
const usedB = personalHistory.includes(b.lowerName);
|
||||||
|
|
||||||
if (usedA === usedB) {
|
if (usedA === usedB) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -200,6 +201,8 @@ const sortHashtagsByUse = (state, tags) => {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sorted.forEach(tag => delete tag.lowerName);
|
||||||
|
return sorted;
|
||||||
};
|
};
|
||||||
|
|
||||||
const insertEmoji = (state, position, emojiData, needsSpace) => {
|
const insertEmoji = (state, position, emojiData, needsSpace) => {
|
||||||
|
|
Loading…
Reference in a new issue