Browse Source

Refactor privacyPrefence() to use priority list (#7945)

master
Maciek Baron 6 years ago
committed by Eugen Rochko
parent
commit
f2d9a3c239
1 changed files with 2 additions and 9 deletions
  1. +2
    -9
      app/javascript/mastodon/reducers/compose.js

+ 2
- 9
app/javascript/mastodon/reducers/compose.js View File

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

Loading…
Cancel
Save