Skip to content

Commit 3c42f2d

Browse files
committed
custom notifications: use text as property for action button label
1 parent 33bf38f commit 3c42f2d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/ui/public/notify/__tests__/notifier.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ describe('Notifier', function () {
1616
markdown: 'fooMardown',
1717
lifetime: 10000,
1818
customActions:[{
19-
key: 'Cancel',
19+
text: 'Cancel',
2020
callback: sinon.spy()
2121
}, {
22-
key: 'OK',
22+
text: 'OK',
2323
callback: sinon.spy()
2424
}]
2525
};

src/ui/public/notify/notifier.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ function add(notif, cb) {
9696
} else if (notif.customActions) {
9797
// wrap all of the custom functions in a close
9898
notif.customActions = notif.customActions.map(action => {
99-
action.callback = closeNotif(notif, action.callback, action.key);
100-
return action;
99+
return {
100+
key: action.text,
101+
callback: closeNotif(notif, action.callback, action.text)
102+
};
101103
});
102104
}
103105

@@ -383,10 +385,10 @@ Notifier.prototype.banner = function (msg, cb) {
383385
* markdown: 'Some markdown content',
384386
* type: 'info',
385387
* customActions: [{
386-
* key: 'next',
388+
* text: 'next',
387389
* callback: function() { next(); }
388390
* }, {
389-
* key: 'prev',
391+
* text: 'prev',
390392
* callback: function() { prev(); }
391393
* }]
392394
* }

0 commit comments

Comments
 (0)