aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Recipe.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Recipe.ts')
-rw-r--r--src/models/Recipe.ts34
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 @@
1import semver from 'semver'; 1import semver from 'semver';
2import { pathExistsSync } from 'fs-extra'; 2import { pathExistsSync } from 'fs-extra';
3import { join } from 'path'; 3import { join } from 'path';
4import {
5 ifUndefinedString,
6 ifUndefinedBoolean,
7} from '../jsUtils';
4 8
5interface IRecipe { 9interface 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