Skip to content

Commit be64f4e

Browse files
kushthedudeiamareebjamal
authored andcommitted
fix: adding id to all notify objects in the webapp (#3536)
* Fix: notify service in event,admin dashboard * fix: notify services in event dashboard * controller notification fixed * Consistency in naming
1 parent 64f650d commit be64f4e

40 files changed

+556
-149
lines changed

app/controllers/account/password.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ export default Controller.extend({
1313
this.loader
1414
.post('/auth/change-password', payload)
1515
.then(() => {
16-
this.notify.success(this.l10n.t('Password updated successfully'));
16+
this.notify.success(this.l10n.t('Password updated successfully'),
17+
{
18+
id: 'pass_upd_succ'
19+
});
1720
})
1821
.catch(error => {
1922
if (error.errors) {
20-
this.notify.error(this.l10n.t(`${error.errors[0].detail}`));
23+
this.notify.error(this.l10n.t(`${error.errors[0].detail}`),
24+
{
25+
id: 'err_pass_ser'
26+
});
2127
} else {
22-
this.notify.error(this.l10n.t('Unexpected error. Password did not change.'));
28+
this.notify.error(this.l10n.t('Unexpected error. Password did not change.'),
29+
{
30+
id: 'err_unex_pass'
31+
});
2332
}
2433
})
2534
.finally(() => {

app/controllers/account/profile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ export default Controller.extend({
66
this.set('isLoading', true);
77
try {
88
await this.model.save();
9-
this.notify.success(this.l10n.t('Your Contact Info has been updated'));
9+
this.notify.success(this.l10n.t('Your Contact Info has been updated'),
10+
{
11+
id: 'cont_info_upd'
12+
});
1013
} catch (error) {
11-
this.notify.error(this.l10n.t(error.message));
14+
this.notify.error(this.l10n.t(error.message),
15+
{
16+
id: 'cont_upd_error'
17+
});
1218
}
1319
this.set('isLoading', false);
1420
}

app/controllers/admin/content/events.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export default Controller.extend({
1414
this.set('disableEventSubtopic', false);
1515
this.set('currentTopicSelected', topic);
1616
} catch (e) {
17-
this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.'));
17+
this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.'),
18+
{
19+
id: 'subtop_error'
20+
});
1821
} finally {
1922
this.set('isLoading', false);
2023
}
@@ -32,10 +35,16 @@ export default Controller.extend({
3235
eventProp.destroyRecord()
3336
.then(() => {
3437
this.get(`model.${modelName}s`).removeObject(eventProp);
35-
this.notify.success(this.l10n.t('This Event Property has been deleted successfully.'));
38+
this.notify.success(this.l10n.t('This Event Property has been deleted successfully.'),
39+
{
40+
id: 'event_prop_del'
41+
});
3642
})
3743
.catch(() => {
38-
this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.'));
44+
this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.'),
45+
{
46+
id: 'event_type_error'
47+
});
3948
})
4049
.finally(() => {
4150
this.set('isLoading', false);
@@ -47,10 +56,16 @@ export default Controller.extend({
4756
modelInstance.save()
4857
.then(() => {
4958
this.get(`model.${camelCasedValue}s`).addObject(modelInstance);
50-
this.notify.success(this.l10n.t(`${startCase(camelCasedValue)} has been added successfully.`));
59+
this.notify.success(this.l10n.t(`${startCase(camelCasedValue)} has been added successfully.`),
60+
{
61+
id: 'mode_add_succ'
62+
});
5163
})
5264
.catch(() => {
53-
this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`));
65+
this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`),
66+
{
67+
id: 'mode_err_succ'
68+
});
5469
})
5570
.finally(() => {
5671
this.set('isLoading', false);

app/controllers/admin/content/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ export default Controller.extend({
77
let settings = this.model;
88
settings.save()
99
.then(() => {
10-
this.notify.success(this.l10n.t('Social links have been saved successfully.'));
10+
this.notify.success(this.l10n.t('Social links have been saved successfully.'),
11+
{
12+
id: 'social_link_upd'
13+
});
1114
})
1215
.catch(() => {
13-
this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.'));
16+
this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.'),
17+
{
18+
id: 'unex_social_error'
19+
});
1420
})
1521
.finally(() => {
1622
this.set('isLoading', false);

app/controllers/admin/content/pages.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ export default Controller.extend({
2323
if (this.isCreate) {
2424
this.set('isFormOpen', false);
2525
}
26-
this.notify.success(this.l10n.t('Page details have been saved successfully.'));
26+
this.notify.success(this.l10n.t('Page details have been saved successfully.'),
27+
{
28+
id: 'page_detail_succ'
29+
});
2730
})
2831
.catch(() => {
29-
this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.'));
32+
this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.'),
33+
{
34+
id: 'page_detail_del'
35+
});
3036
});
3137
}
3238
}

app/controllers/admin/content/translations.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ export default class extends Controller {
1414
anchor.href = URL.createObjectURL(new Blob([result], { type: 'octet/stream' }));
1515
anchor.download = 'Translations.zip';
1616
anchor.click();
17-
this.notify.success(this.l10n.t('Translations Zip generated successfully.'));
17+
this.notify.success(this.l10n.t('Translations Zip generated successfully.'),
18+
{
19+
id: 'zip_generated_succ'
20+
});
1821
} catch (e) {
1922
console.warn(e);
20-
this.notify.error(this.l10n.t('Unexpected error occurred.'));
23+
this.notify.error(this.l10n.t('Unexpected error occurred.'),
24+
{
25+
id: 'zip_error'
26+
});
2127
}
2228
this.set('isLoading', false);
2329
}

app/controllers/admin/events/list.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
129129
try {
130130
let event = this.store.peekRecord('event', this.eventId, { backgroundReload: false });
131131
await event.destroyRecord();
132-
this.notify.success(this.l10n.t('Event has been deleted successfully.'));
132+
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
133+
{
134+
id: 'event_del_succ'
135+
});
133136
} catch (e) {
134137
console.warn(e);
135-
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
138+
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
139+
{
140+
id: 'event_delete_error'
141+
});
136142
}
137143
this.setProperties({
138144
isLoading : false,
@@ -146,10 +152,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
146152
let event = this.store.peekRecord('event', event_id, { backgroundReload: false });
147153
event.set('deletedAt', null);
148154
await event.save({ adapterOptions: { getTrashed: true } });
149-
this.notify.success(this.l10n.t('Event has been restored successfully.'));
155+
this.notify.success(this.l10n.t('Event has been restored successfully.'),
156+
{
157+
id: 'event_restored'
158+
});
150159
} catch (e) {
151160
console.warn(e);
152-
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
161+
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
162+
{
163+
id: 'restore_error'
164+
});
153165
}
154166
this.set('isLoading', false);
155167
}
@@ -161,11 +173,17 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
161173
let event = this.store.peekRecord('event', event_id, { backgroundReload: false });
162174
event.toggleProperty('isFeatured');
163175
await event.save();
164-
this.notify.success(this.l10n.t('Event details modified successfully'));
176+
this.notify.success(this.l10n.t('Event details modified successfully'),
177+
{
178+
id: 'event_detail_changed'
179+
});
165180

166181
} catch (e) {
167182
console.warn(e);
168-
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
183+
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
184+
{
185+
id: 'event_det_error'
186+
});
169187
}
170188
this.set('isLoading', false);
171189
}

app/controllers/admin/messages.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ export default Controller.extend({
99
systemMessages.forEach(systemMessage => {
1010
systemMessage.save();
1111
});
12-
this.notify.success(this.l10n.t('Changes have been saved successfully'));
12+
this.notify.success(this.l10n.t('Changes have been saved successfully'),
13+
{
14+
id: 'message_success'
15+
});
1316
} catch (e) {
14-
this.notify.error(this.l10n.t(e.errors[0].detail));
17+
this.notify.error(this.l10n.t(e.errors[0].detail),
18+
{
19+
id: 'change_error_message'
20+
});
1521
}
1622
}
1723
}

app/controllers/admin/modules.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ export default Controller.extend({
77
let modules = this.model;
88
modules.save()
99
.then(() => {
10-
this.notify.success(this.l10n.t('Settings have been saved successfully.'));
10+
this.notify.success(this.l10n.t('Settings have been saved successfully.'),
11+
{
12+
id: 'setting_change'
13+
});
1114
})
1215
.catch(() => {
13-
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
16+
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'),
17+
{
18+
id: 'setting_not_change'
19+
});
1420
})
1521
.finally(() => {
1622
this.set('isLoading', false);

app/controllers/admin/permissions/event-roles.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ export default Controller.extend({
1212
this.set('isLoading', true);
1313
this.get('model.permissions').save()
1414
.then(() => {
15-
this.notify.success(this.l10n.t('Admin Event role permissions have been saved successfully.'));
15+
this.notify.success(this.l10n.t('Admin Event role permissions have been saved successfully.'),
16+
{
17+
id: 'admin_event_succ'
18+
});
1619
})
1720
.catch(err => {
18-
this.notify.error(this.l10n.t(err));
21+
this.notify.error(this.l10n.t(err),
22+
{
23+
id: 'admin_event_error'
24+
});
1925
})
2026
.finally(() => {
2127
this.set('isLoading', false);

0 commit comments

Comments
 (0)