diff options
author | 2018-01-06 23:51:04 +0100 | |
---|---|---|
committer | 2018-01-06 23:51:04 +0100 | |
commit | fb16f121e8ff6678c74148cd456b964a85742fbe (patch) | |
tree | 5534162572aca6bda4d22984ab6103c76510d193 /src/stores | |
parent | Merge pull request #541 from meetfranz/feature/external-links (diff) | |
parent | fix displaying old icon while uploading new icon (diff) | |
download | ferdium-app-fb16f121e8ff6678c74148cd456b964a85742fbe.tar.gz ferdium-app-fb16f121e8ff6678c74148cd456b964a85742fbe.tar.zst ferdium-app-fb16f121e8ff6678c74148cd456b964a85742fbe.zip |
Merge pull request #525 from meetfranz/feature/icon-upload
[PR] Feature/icon upload
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index bd5014aaa..7300a76c8 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -174,9 +174,29 @@ export default class ServicesStore extends Store { | |||
174 | const data = this._cleanUpTeamIdAndCustomUrl(service.recipe.id, serviceData); | 174 | const data = this._cleanUpTeamIdAndCustomUrl(service.recipe.id, serviceData); |
175 | const request = this.updateServiceRequest.execute(serviceId, data); | 175 | const request = this.updateServiceRequest.execute(serviceId, data); |
176 | 176 | ||
177 | const newData = serviceData; | ||
178 | if (serviceData.iconFile) { | ||
179 | await request._promise; | ||
180 | |||
181 | newData.iconUrl = request.result.data.iconUrl; | ||
182 | newData.hasCustomUploadedIcon = true; | ||
183 | } | ||
184 | |||
177 | this.allServicesRequest.patch((result) => { | 185 | this.allServicesRequest.patch((result) => { |
178 | if (!result) return; | 186 | if (!result) return; |
179 | Object.assign(result.find(c => c.id === serviceId), serviceData); | 187 | |
188 | // patch custom icon deletion | ||
189 | if (data.customIcon === 'delete') { | ||
190 | data.iconUrl = ''; | ||
191 | data.hasCustomUploadedIcon = false; | ||
192 | } | ||
193 | |||
194 | // patch custom icon url | ||
195 | if (data.customIconUrl) { | ||
196 | data.iconUrl = data.customIconUrl; | ||
197 | } | ||
198 | |||
199 | Object.assign(result.find(c => c.id === serviceId), newData); | ||
180 | }); | 200 | }); |
181 | 201 | ||
182 | await request._promise; | 202 | await request._promise; |
@@ -325,7 +345,7 @@ export default class ServicesStore extends Store { | |||
325 | } | 345 | } |
326 | } else if (channel === 'avatar') { | 346 | } else if (channel === 'avatar') { |
327 | const url = args[0]; | 347 | const url = args[0]; |
328 | if (service.customIconUrl !== url) { | 348 | if (service.iconUrl !== url && !service.hasCustomUploadedIcon) { |
329 | service.customIconUrl = url; | 349 | service.customIconUrl = url; |
330 | 350 | ||
331 | this.actions.service.updateService({ | 351 | this.actions.service.updateService({ |