diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-24 07:39:41 +0530 |
---|---|---|
committer | Vijay A <avijayr@protonmail.com> | 2021-09-24 07:48:24 +0530 |
commit | 2e96a61955e525bf6269e41342bf3ffce05805a6 (patch) | |
tree | b45118a2000d751b0d22ff08d12385b96d195145 /src/models/Recipe.ts | |
parent | Update submodules, browserslist data updates and linter fixes [skip ci] (diff) | |
download | ferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.tar.gz ferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.tar.zst ferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.zip |
Allow services to delineate favorites vs non-favorites in unread counts (#1979)
implements getferdi/recipes#721 (eg: office365-owa)
Diffstat (limited to 'src/models/Recipe.ts')
-rw-r--r-- | src/models/Recipe.ts | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts index 6022fb520..83d1d4478 100644 --- a/src/models/Recipe.ts +++ b/src/models/Recipe.ts | |||
@@ -1,6 +1,10 @@ | |||
1 | import semver from 'semver'; | 1 | import semver from 'semver'; |
2 | import { pathExistsSync } from 'fs-extra'; | 2 | import { pathExistsSync } from 'fs-extra'; |
3 | import { join } from 'path'; | 3 | import { join } from 'path'; |
4 | import { | ||
5 | ifUndefinedString, | ||
6 | ifUndefinedBoolean, | ||
7 | } from '../jsUtils'; | ||
4 | 8 | ||
5 | interface IRecipe { | 9 | interface IRecipe { |
6 | id: string; | 10 | id: string; |
@@ -22,6 +26,7 @@ interface IRecipe { | |||
22 | autoHibernate?: boolean; | 26 | autoHibernate?: boolean; |
23 | partition?: string; | 27 | partition?: string; |
24 | message?: string; | 28 | message?: string; |
29 | allowFavoritesDelineationInUnreadCount?: boolean; | ||
25 | }; | 30 | }; |
26 | } | 31 | } |
27 | 32 | ||
@@ -59,6 +64,8 @@ export default class Recipe { | |||
59 | 64 | ||
60 | message: string = ''; | 65 | message: string = ''; |
61 | 66 | ||
67 | allowFavoritesDelineationInUnreadCount: boolean = false; | ||
68 | |||
62 | disablewebsecurity: boolean = false; | 69 | disablewebsecurity: boolean = false; |
63 | 70 | ||
64 | autoHibernate: boolean = false; | 71 | autoHibernate: boolean = false; |
@@ -81,30 +88,31 @@ export default class Recipe { | |||
81 | } | 88 | } |
82 | 89 | ||
83 | this.id = data.id || this.id; | 90 | this.id = data.id || this.id; |
84 | this.name = data.name || this.name; | 91 | this.name = ifUndefinedString(data.name, this.name); |
85 | this.version = data.version || this.version; | 92 | this.version = ifUndefinedString(data.version, this.version); |
86 | this.aliases = data.aliases || this.aliases; | 93 | this.aliases = data.aliases || this.aliases; |
87 | this.path = data.path; | 94 | this.path = data.path; |
88 | 95 | ||
89 | this.serviceURL = data.config.serviceURL || this.serviceURL; | 96 | this.serviceURL = ifUndefinedString(data.config.serviceURL, this.serviceURL); |
90 | 97 | ||
91 | this.hasDirectMessages = data.config.hasDirectMessages || this.hasDirectMessages; | 98 | this.hasDirectMessages = ifUndefinedBoolean(data.config.hasDirectMessages, this.hasDirectMessages); |
92 | this.hasIndirectMessages = data.config.hasIndirectMessages || this.hasIndirectMessages; | 99 | this.hasIndirectMessages = ifUndefinedBoolean(data.config.hasIndirectMessages, this.hasIndirectMessages); |
93 | this.hasNotificationSound = data.config.hasNotificationSound || this.hasNotificationSound; | 100 | this.hasNotificationSound = ifUndefinedBoolean(data.config.hasNotificationSound, this.hasNotificationSound); |
94 | this.hasTeamId = data.config.hasTeamId || this.hasTeamId; | 101 | this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId); |
95 | this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl; | 102 | this.hasCustomUrl = ifUndefinedBoolean(data.config.hasCustomUrl, this.hasCustomUrl); |
96 | this.hasHostedOption = data.config.hasHostedOption || this.hasHostedOption; | 103 | this.hasHostedOption = ifUndefinedBoolean(data.config.hasHostedOption, this.hasHostedOption); |
97 | 104 | ||
98 | this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix; | 105 | this.urlInputPrefix = ifUndefinedString(data.config.urlInputPrefix, this.urlInputPrefix); |
99 | this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix; | 106 | this.urlInputSuffix = ifUndefinedString(data.config.urlInputSuffix, this.urlInputSuffix); |
100 | 107 | ||
101 | this.disablewebsecurity = data.config.disablewebsecurity || this.disablewebsecurity; | 108 | this.disablewebsecurity = data.config.disablewebsecurity || this.disablewebsecurity; |
102 | 109 | ||
103 | this.autoHibernate = data.config.autoHibernate || this.autoHibernate; | 110 | this.autoHibernate = data.config.autoHibernate || this.autoHibernate; |
104 | 111 | ||
105 | this.partition = data.config.partition || this.partition; | 112 | this.partition = ifUndefinedString(data.config.partition, this.partition); |
106 | 113 | ||
107 | this.message = data.config.message || this.message; | 114 | this.message = ifUndefinedString(data.config.message, this.message); |
115 | this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean(data.config.allowFavoritesDelineationInUnreadCount, this.allowFavoritesDelineationInUnreadCount); | ||
108 | } | 116 | } |
109 | 117 | ||
110 | // TODO: Need to remove this if its not used anywhere | 118 | // TODO: Need to remove this if its not used anywhere |