diff options
author | Maciek Baron <thebezet@gmail.com> | 2018-07-04 16:35:35 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-07-04 17:35:35 +0200 |
commit | f2d9a3c239bcab5fcbede22549b67bfd841a3880 (patch) | |
tree | 9d81a5c7b6a231e31aa5074791a9a4010b5b2489 /app | |
parent | 0bfa0f237495249a322cd3a1100b394211755e8c (diff) |
Refactor privacyPrefence() to use priority list (#7945)
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/mastodon/reducers/compose.js | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 8524ddb8e..552f659c9 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -151,15 +151,8 @@ const insertEmoji = (state, position, emojiData, needsSpace) => { }; 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) => { |