aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-01-02 22:54:17 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-01-02 22:54:47 +0100
commit6b97e42537879be306cd2aaf95dd8aebf8655fcb (patch)
tree2c2628d507cbf34c953dc97d9a5fe30d8ffcd5db /src/stores
parentFirst working draft of icon upload (diff)
downloadferdium-app-6b97e42537879be306cd2aaf95dd8aebf8655fcb.tar.gz
ferdium-app-6b97e42537879be306cd2aaf95dd8aebf8655fcb.tar.zst
ferdium-app-6b97e42537879be306cd2aaf95dd8aebf8655fcb.zip
feat(Service): Add custom service icon upload
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/ServicesStore.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 4fb5c9767..f2a8683ba 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -177,13 +177,21 @@ export default class ServicesStore extends Store {
177 await request._promise; 177 await request._promise;
178 178
179 newData.iconUrl = request.result.data.iconUrl; 179 newData.iconUrl = request.result.data.iconUrl;
180 newData.hasCustomUploadedIcon = true;
180 } 181 }
181 182
182 this.allServicesRequest.patch((result) => { 183 this.allServicesRequest.patch((result) => {
183 if (!result) return; 184 if (!result) return;
184 185
186 // patch custom icon deletion
185 if (data.customIcon === 'delete') { 187 if (data.customIcon === 'delete') {
186 data.iconUrl = ''; 188 data.iconUrl = '';
189 data.hasCustomUploadedIcon = false;
190 }
191
192 // patch custom icon url
193 if (data.customIconUrl) {
194 data.iconUrl = data.customIconUrl;
187 } 195 }
188 196
189 Object.assign(result.find(c => c.id === serviceId), newData); 197 Object.assign(result.find(c => c.id === serviceId), newData);
@@ -328,7 +336,7 @@ export default class ServicesStore extends Store {
328 } 336 }
329 } else if (channel === 'avatar') { 337 } else if (channel === 'avatar') {
330 const url = args[0]; 338 const url = args[0];
331 if (service.customIconUrl !== url) { 339 if (service.iconUrl !== url && !service.hasCustomUploadedIcon) {
332 service.customIconUrl = url; 340 service.customIconUrl = url;
333 341
334 this.actions.service.updateService({ 342 this.actions.service.updateService({