1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-02 16:58:53 +09:00

[Glitch] Refactor privacyPrefence() to use priority list

Port f2d9a3c239 to glitch-soc
This commit is contained in:
Thibaut Girka 2018-07-12 11:30:47 +02:00 committed by ThibG
parent d67cb13d84
commit cd05378b59

View File

@ -207,15 +207,8 @@ const insertEmoji = (state, position, emojiData) => {
}; };
const privacyPreference = (a, b) => { const privacyPreference = (a, b) => {
if (a === 'direct' || b === 'direct') { const order = ['public', 'unlisted', 'private', 'direct'];
return 'direct'; return order[Math.max(order.indexOf(a), order.indexOf(b), 0)];
} else if (a === 'private' || b === 'private') {
return 'private';
} else if (a === 'unlisted' || b === 'unlisted') {
return 'unlisted';
} else {
return 'public';
}
}; };
const hydrate = (state, hydratedState) => { const hydrate = (state, hydratedState) => {