diff options
author | kytwb <412895+kytwb@users.noreply.github.com> | 2021-06-12 19:51:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 19:51:28 +0200 |
commit | b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb (patch) | |
tree | aed0253b61ca035f3388a7d6a369ffe75f195a58 /src/stores | |
parent | Bypassed code signing since that is also incorrect in GH settings. (diff) | |
download | ferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.tar.gz ferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.tar.zst ferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.zip |
Fix active Todos service behaviour (#1481)
* Return false instead of null in isTodosServiceAdded
* Resolve from TODOS_RECIPES_ID instead of hardcoded TODOS_RECIPE_ID
* Fix TodosWebview width toggling when isTodosServiceActive
* Add more todo service recipe IDs
* Refactor todos state management
* Moved todos service URL and recipe ID computation logic to todos/store
* Simplified TodosWebview by delegating to the store for the URL and
removing the (unused) payment logic
* Made the todos service computation logic in the Service model depend
on the logic in todos/store
* Made ServicesStore depend on the todos service logic from the Service
model
* Todos appearance fixes
* Hide double horizontal rules if todo settings are hidden due to an
added todo service
* Hide todos panel border when the panel is hidden or expanded
* Make expanded todos panel obey sidebar width and vertical style
settings
* Make todos/store use isValidExternalURL
* Harden isValidExternalURL against malformed URLs
* Reduce todo URL string duplication in config.js
Co-authored-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 48b128966..752f287e8 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -21,7 +21,6 @@ import { workspaceStore } from '../features/workspaces'; | |||
21 | import { serviceLimitStore } from '../features/serviceLimit'; | 21 | import { serviceLimitStore } from '../features/serviceLimit'; |
22 | import { RESTRICTION_TYPES } from '../models/Service'; | 22 | import { RESTRICTION_TYPES } from '../models/Service'; |
23 | import { KEEP_WS_LOADED_USID } from '../config'; | 23 | import { KEEP_WS_LOADED_USID } from '../config'; |
24 | import { TODOS_RECIPE_ID } from '../features/todos'; | ||
25 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 24 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
26 | 25 | ||
27 | const debug = require('debug')('Ferdi:ServiceStore'); | 26 | const debug = require('debug')('Ferdi:ServiceStore'); |
@@ -279,11 +278,11 @@ export default class ServicesStore extends Store { | |||
279 | } | 278 | } |
280 | 279 | ||
281 | @computed get isTodosServiceAdded() { | 280 | @computed get isTodosServiceAdded() { |
282 | return this.allDisplayed.find(service => service.recipe.id === TODOS_RECIPE_ID && service.isEnabled) || null; | 281 | return this.allDisplayed.find(service => service.isTodosService && service.isEnabled) || false; |
283 | } | 282 | } |
284 | 283 | ||
285 | @computed get isTodosServiceActive() { | 284 | @computed get isTodosServiceActive() { |
286 | return this.active && this.active.recipe.id === TODOS_RECIPE_ID; | 285 | return this.active && this.active.isTodosService; |
287 | } | 286 | } |
288 | 287 | ||
289 | one(id) { | 288 | one(id) { |
@@ -484,7 +483,7 @@ export default class ServicesStore extends Store { | |||
484 | this._awake({ serviceId: service.id }); | 483 | this._awake({ serviceId: service.id }); |
485 | service.lastUsed = Date.now(); | 484 | service.lastUsed = Date.now(); |
486 | 485 | ||
487 | if (this.active.recipe.id === TODOS_RECIPE_ID && !this.stores.todos.settings.isFeatureEnabledByUser) { | 486 | if (this.isTodosServiceActive && !this.stores.todos.settings.isFeatureEnabledByUser) { |
488 | this.actions.todos.toggleTodosFeatureVisibility(); | 487 | this.actions.todos.toggleTodosFeatureVisibility(); |
489 | } | 488 | } |
490 | 489 | ||
@@ -718,7 +717,7 @@ export default class ServicesStore extends Store { | |||
718 | service.resetMessageCount(); | 717 | service.resetMessageCount(); |
719 | service.lostRecipeConnection = false; | 718 | service.lostRecipeConnection = false; |
720 | 719 | ||
721 | if (service.recipe.id === TODOS_RECIPE_ID) { | 720 | if (service.isTodosService) { |
722 | return this.actions.todos.reload(); | 721 | return this.actions.todos.reload(); |
723 | } | 722 | } |
724 | 723 | ||
@@ -805,7 +804,7 @@ export default class ServicesStore extends Store { | |||
805 | 804 | ||
806 | @action _openDevTools({ serviceId }) { | 805 | @action _openDevTools({ serviceId }) { |
807 | const service = this.one(serviceId); | 806 | const service = this.one(serviceId); |
808 | if (service.recipe.id === TODOS_RECIPE_ID) { | 807 | if (service.isTodosService) { |
809 | this.actions.todos.openDevTools(); | 808 | this.actions.todos.openDevTools(); |
810 | } else { | 809 | } else { |
811 | service.webview.openDevTools(); | 810 | service.webview.openDevTools(); |