diff options
author | 2022-11-21 20:31:49 +0530 | |
---|---|---|
committer | 2022-11-21 20:31:49 +0530 | |
commit | 009813cbc40bfd186037ccb7f327225357ef34e9 (patch) | |
tree | 1fcbee64b0b10256d694ba0cf687d968ae7d8da1 /src/containers/settings | |
parent | 6.2.1-nightly.48 [skip ci] (diff) | |
download | ferdium-app-009813cbc40bfd186037ccb7f327225357ef34e9.tar.gz ferdium-app-009813cbc40bfd186037ccb7f327225357ef34e9.tar.zst ferdium-app-009813cbc40bfd186037ccb7f327225357ef34e9.zip |
Fix for services self hosted url / Team Id / Include pre-releases not updating (#785)
* fix: self hosted team/url options not working properly in edit service form
* fix: Include pre-releases toggle not working
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/EditServiceScreen.tsx | 132 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.tsx | 1 |
2 files changed, 58 insertions, 75 deletions
diff --git a/src/containers/settings/EditServiceScreen.tsx b/src/containers/settings/EditServiceScreen.tsx index 09dd19925..05375d352 100644 --- a/src/containers/settings/EditServiceScreen.tsx +++ b/src/containers/settings/EditServiceScreen.tsx | |||
@@ -288,27 +288,20 @@ class EditServiceScreen extends Component<IProps> { | |||
288 | }; | 288 | }; |
289 | 289 | ||
290 | if (recipe.hasTeamId) { | 290 | if (recipe.hasTeamId) { |
291 | config.fields = { | 291 | config.fields.team = { |
292 | ...config.fields, | 292 | label: intl.formatMessage(messages.team), |
293 | 293 | placeholder: intl.formatMessage(messages.team), | |
294 | team: { | 294 | value: service?.team, |
295 | label: intl.formatMessage(messages.team), | 295 | validators: [required], |
296 | placeholder: intl.formatMessage(messages.team), | ||
297 | value: service?.team, | ||
298 | validators: [required], | ||
299 | }, | ||
300 | }; | 296 | }; |
301 | } | 297 | } |
302 | 298 | ||
303 | if (recipe.hasCustomUrl) { | 299 | if (recipe.hasCustomUrl) { |
304 | config.fields = { | 300 | config.fields.customUrl = { |
305 | ...config.fields, | 301 | label: intl.formatMessage(messages.customUrl), |
306 | customUrl: { | 302 | placeholder: "'http://' or 'https://' or 'file:///'", |
307 | label: intl.formatMessage(messages.customUrl), | 303 | value: service?.customUrl || recipe.serviceURL, |
308 | placeholder: "'http://' or 'https://' or 'file:///'", | 304 | validators: [required, url], |
309 | value: service?.customUrl || recipe.serviceURL, | ||
310 | validators: [required, url], | ||
311 | }, | ||
312 | }; | 305 | }; |
313 | } | 306 | } |
314 | 307 | ||
@@ -332,82 +325,71 @@ class EditServiceScreen extends Component<IProps> { | |||
332 | } | 325 | } |
333 | 326 | ||
334 | if (recipe.hasIndirectMessages) { | 327 | if (recipe.hasIndirectMessages) { |
335 | config.fields = { | 328 | config.fields.isIndirectMessageBadgeEnabled = { |
336 | ...config.fields, | 329 | label: intl.formatMessage(messages.indirectMessages), |
337 | isIndirectMessageBadgeEnabled: { | 330 | value: service?.isIndirectMessageBadgeEnabled, |
338 | label: intl.formatMessage(messages.indirectMessages), | 331 | default: DEFAULT_SERVICE_SETTINGS.hasIndirectMessages, |
339 | value: service?.isIndirectMessageBadgeEnabled, | 332 | type: 'checkbox', |
340 | default: DEFAULT_SERVICE_SETTINGS.hasIndirectMessages, | ||
341 | type: 'checkbox', | ||
342 | }, | ||
343 | }; | 333 | }; |
344 | } | 334 | } |
345 | 335 | ||
346 | if (recipe.allowFavoritesDelineationInUnreadCount) { | 336 | if (recipe.allowFavoritesDelineationInUnreadCount) { |
347 | config.fields = { | 337 | config.fields.onlyShowFavoritesInUnreadCount = { |
348 | ...config.fields, | 338 | label: intl.formatMessage(messages.onlyShowFavoritesInUnreadCount), |
349 | onlyShowFavoritesInUnreadCount: { | 339 | value: service?.onlyShowFavoritesInUnreadCount, |
350 | label: intl.formatMessage(messages.onlyShowFavoritesInUnreadCount), | 340 | default: DEFAULT_APP_SETTINGS.onlyShowFavoritesInUnreadCount, |
351 | value: service?.onlyShowFavoritesInUnreadCount, | 341 | type: 'checkbox', |
352 | default: DEFAULT_APP_SETTINGS.onlyShowFavoritesInUnreadCount, | ||
353 | type: 'checkbox', | ||
354 | }, | ||
355 | }; | 342 | }; |
356 | } | 343 | } |
357 | 344 | ||
358 | if (proxy.isEnabled) { | 345 | if (proxy.isEnabled) { |
359 | let serviceProxyConfig: IProxyConfig = {}; | 346 | const serviceProxyConfig: IProxyConfig = service |
360 | if (service) { | 347 | ? stores.settings.proxy[service.id] |
361 | serviceProxyConfig = stores.settings.proxy[service.id] || {}; | 348 | : {}; |
362 | } | 349 | |
363 | 350 | config.fields.proxy = { | |
364 | config.fields = { | 351 | name: 'proxy', |
365 | ...config.fields, | 352 | label: 'proxy', |
366 | proxy: { | 353 | fields: { |
367 | name: 'proxy', | 354 | isEnabled: { |
368 | label: 'proxy', | 355 | label: intl.formatMessage(messages.enableProxy), |
369 | fields: { | 356 | value: serviceProxyConfig.isEnabled, |
370 | isEnabled: { | 357 | default: DEFAULT_APP_SETTINGS.proxyFeatureEnabled, |
371 | label: intl.formatMessage(messages.enableProxy), | 358 | type: 'checkbox', |
372 | value: serviceProxyConfig.isEnabled, | 359 | }, |
373 | default: DEFAULT_APP_SETTINGS.proxyFeatureEnabled, | 360 | host: { |
374 | type: 'checkbox', | 361 | label: intl.formatMessage(messages.proxyHost), |
375 | }, | 362 | value: serviceProxyConfig.host, |
376 | host: { | 363 | default: '', |
377 | label: intl.formatMessage(messages.proxyHost), | 364 | }, |
378 | value: serviceProxyConfig.host, | 365 | port: { |
379 | default: '', | 366 | label: intl.formatMessage(messages.proxyPort), |
380 | }, | 367 | value: serviceProxyConfig.port, |
381 | port: { | 368 | default: '', |
382 | label: intl.formatMessage(messages.proxyPort), | 369 | }, |
383 | value: serviceProxyConfig.port, | 370 | user: { |
384 | default: '', | 371 | label: intl.formatMessage(messages.proxyUser), |
385 | }, | 372 | value: serviceProxyConfig.user, |
386 | user: { | 373 | default: '', |
387 | label: intl.formatMessage(messages.proxyUser), | 374 | }, |
388 | value: serviceProxyConfig.user, | 375 | password: { |
389 | default: '', | 376 | label: intl.formatMessage(messages.proxyPassword), |
390 | }, | 377 | value: serviceProxyConfig.password, |
391 | password: { | 378 | default: '', |
392 | label: intl.formatMessage(messages.proxyPassword), | 379 | type: 'password', |
393 | value: serviceProxyConfig.password, | ||
394 | default: '', | ||
395 | type: 'password', | ||
396 | }, | ||
397 | }, | 380 | }, |
398 | }, | 381 | }, |
399 | }; | 382 | }; |
400 | } | 383 | } |
401 | 384 | ||
402 | // @ts-ignore: Remove this ignore once mobx-react-form v4 with typescript | ||
403 | return new Form(config); | 385 | return new Form(config); |
404 | } | 386 | } |
405 | 387 | ||
406 | deleteService(): void { | 388 | deleteService(): void { |
407 | const { deleteService } = this.props.actions.service; | ||
408 | const { action } = this.props.params; | 389 | const { action } = this.props.params; |
409 | 390 | ||
410 | if (action === 'edit') { | 391 | if (action === 'edit') { |
392 | const { deleteService } = this.props.actions.service; | ||
411 | const { activeSettings: service } = this.props.stores.services; | 393 | const { activeSettings: service } = this.props.stores.services; |
412 | deleteService({ | 394 | deleteService({ |
413 | serviceId: service?.id, | 395 | serviceId: service?.id, |
@@ -437,8 +419,8 @@ class EditServiceScreen extends Component<IProps> { | |||
437 | } = this.props.stores; | 419 | } = this.props.stores; |
438 | const { action } = this.props.params; | 420 | const { action } = this.props.params; |
439 | 421 | ||
440 | let recipe: null | IRecipe = null; | 422 | let recipe: IRecipe | null = null; |
441 | let service: null | Service = null; | 423 | let service: Service | null = null; |
442 | let isLoading = false; | 424 | let isLoading = false; |
443 | 425 | ||
444 | if (action === 'add') { | 426 | if (action === 'add') { |
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx index f18eb24a7..2dbd8d2be 100644 --- a/src/containers/settings/EditSettingsScreen.tsx +++ b/src/containers/settings/EditSettingsScreen.tsx | |||
@@ -933,6 +933,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
933 | label: intl.formatMessage(messages.beta), | 933 | label: intl.formatMessage(messages.beta), |
934 | value: user.data.beta, | 934 | value: user.data.beta, |
935 | default: DEFAULT_APP_SETTINGS.beta, | 935 | default: DEFAULT_APP_SETTINGS.beta, |
936 | type: 'checkbox', | ||
936 | }, | 937 | }, |
937 | automaticUpdates: { | 938 | automaticUpdates: { |
938 | label: intl.formatMessage(messages.automaticUpdates), | 939 | label: intl.formatMessage(messages.automaticUpdates), |