mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 12:05:07 +01:00
Refactor privacyPrefence() to use priority list (#7945)
This commit is contained in:
parent
0bfa0f2374
commit
f2d9a3c239
@ -151,15 +151,8 @@ const insertEmoji = (state, position, emojiData, needsSpace) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user