diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-12-15 14:44:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 14:44:46 +0100 |
commit | dc1dd2e857114fac2462f18ea774ddacb287fa81 (patch) | |
tree | 32b701de50c505abc95ceddc7c429df85c81f041 /src/containers/settings | |
parent | Remove IME handlers (diff) | |
parent | Merge pull request #475 from meetfranz/feature/service-improvements (diff) | |
download | ferdium-app-dc1dd2e857114fac2462f18ea774ddacb287fa81.tar.gz ferdium-app-dc1dd2e857114fac2462f18ea774ddacb287fa81.tar.zst ferdium-app-dc1dd2e857114fac2462f18ea774ddacb287fa81.zip |
Merge branch 'develop' into feature/macOS-copy-paste
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 191ef447b..3c52152b1 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -26,6 +26,10 @@ const messages = defineMessages({ | |||
26 | id: 'settings.service.form.enableNotification', | 26 | id: 'settings.service.form.enableNotification', |
27 | defaultMessage: '!!!Enable Notifications', | 27 | defaultMessage: '!!!Enable Notifications', |
28 | }, | 28 | }, |
29 | enableBadge: { | ||
30 | id: 'settings.service.form.enableBadge', | ||
31 | defaultMessage: '!!!Show unread message badges', | ||
32 | }, | ||
29 | enableAudio: { | 33 | enableAudio: { |
30 | id: 'settings.service.form.enableAudio', | 34 | id: 'settings.service.form.enableAudio', |
31 | defaultMessage: '!!!Enable audio', | 35 | defaultMessage: '!!!Enable audio', |
@@ -88,6 +92,11 @@ export default class EditServiceScreen extends Component { | |||
88 | value: service.isNotificationEnabled, | 92 | value: service.isNotificationEnabled, |
89 | default: true, | 93 | default: true, |
90 | }, | 94 | }, |
95 | isBadgeEnabled: { | ||
96 | label: intl.formatMessage(messages.enableBadge), | ||
97 | value: service.isBadgeEnabled, | ||
98 | default: true, | ||
99 | }, | ||
91 | isMuted: { | 100 | isMuted: { |
92 | label: intl.formatMessage(messages.enableAudio), | 101 | label: intl.formatMessage(messages.enableAudio), |
93 | value: !service.isMuted, | 102 | value: !service.isMuted, |
@@ -118,11 +127,22 @@ export default class EditServiceScreen extends Component { | |||
118 | }); | 127 | }); |
119 | } | 128 | } |
120 | 129 | ||
130 | // More fine grained and use case specific validation rules | ||
121 | if (recipe.hasTeamId && recipe.hasCustomUrl) { | 131 | if (recipe.hasTeamId && recipe.hasCustomUrl) { |
122 | config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; | 132 | config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; |
123 | config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; | 133 | config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; |
124 | } | 134 | } |
125 | 135 | ||
136 | // If a service can be hosted and has a teamId or customUrl | ||
137 | if (recipe.hasHostedOption && (recipe.hasTeamId || recipe.hasCustomUrl)) { | ||
138 | if (config.fields.team) { | ||
139 | config.fields.team.validate = []; | ||
140 | } | ||
141 | if (config.fields.customUrl) { | ||
142 | config.fields.customUrl.validate = [url]; | ||
143 | } | ||
144 | } | ||
145 | |||
126 | if (recipe.hasIndirectMessages) { | 146 | if (recipe.hasIndirectMessages) { |
127 | Object.assign(config.fields, { | 147 | Object.assign(config.fields, { |
128 | isIndirectMessageBadgeEnabled: { | 148 | isIndirectMessageBadgeEnabled: { |