summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-19 15:28:15 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-20 19:09:04 +0100
commited1452d7a067d383371dcd165ad86e01f174840b (patch)
tree52a61cf01f2573944840fd12b02269a43ac7bf86 /core
parentfcef15af801b4e88f857b5621ad028abdeebec28 (diff)
downloadnextcloud-server-ed1452d7a067d383371dcd165ad86e01f174840b.tar.gz
nextcloud-server-ed1452d7a067d383371dcd165ad86e01f174840b.zip
Use "showTemporary" instead of explicitly hiding the notification
"OC.Notification.hide" expects the notification to be hidden to be passed as an argument. As it was being used to show a temporary notification the combination of "OC.Notification.show" and "OC.Notification.hide" was replaced by a single call to "OC.Notification.showTemporary". The timeout could have been specified in the options of the call, but it was left to the default value (7 seconds) for consistency with other notifications. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialogview.js3
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js8
2 files changed, 5 insertions, 6 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index fc867e31968..9e3de2636ce 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -334,8 +334,7 @@
$loading.addClass('hidden');
$loading.removeClass('inlineblock');
$confirm.removeClass('hidden');
- OC.Notification.show(t('core', 'An error occurred. Please try again'));
- window.setTimeout(OC.Notification.hide, 5000);
+ OC.Notification.showTemporary(t('core', 'An error occurred. Please try again'));
});
},
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 63434c3b1ee..c12c734a5df 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -472,14 +472,14 @@ describe('OC.Share.ShareDialogView', function() {
});
});
describe('autocompletion of users', function() {
- var showNotificationStub;
+ var showTemporaryNotificationStub;
beforeEach(function() {
- showNotificationStub = sinon.stub(OC.Notification, 'show');
+ showTemporaryNotificationStub = sinon.stub(OC.Notification, 'show');
});
afterEach(function() {
- showNotificationStub.restore();
+ showTemporaryNotificationStub.restore();
});
describe('triggers autocomplete display and focus with data when ajax search succeeds', function () {
@@ -1486,7 +1486,7 @@ describe('OC.Share.ShareDialogView', function() {
dialog.render();
dialog.autocompleteHandler({term: 'bob'}, sinon.stub());
fakeServer.requests[0].respond(500);
- expect(showNotificationStub.calledOnce).toEqual(true);
+ expect(showTemporaryNotificationStub.calledOnce).toEqual(true);
});
describe('renders the autocomplete elements', function() {