Unverified Commit 8d745a50 authored by Robert Knight's avatar Robert Knight Committed by Sean Hammond

Replace hide/unhide errors with hardcoded strings

The previous code was incorrect because depending on the failure, the
error might not be an `Error`. This needs to be fixed in the API client
but for the moment, sidestep the problem by just displaying a fixed
string.
parent dce257e3
...@@ -32,8 +32,8 @@ function ModerationBannerController(annotationUI, flash, store) { ...@@ -32,8 +32,8 @@ function ModerationBannerController(annotationUI, flash, store) {
this.hideAnnotation = function () { this.hideAnnotation = function () {
store.annotation.hide({id: self.annotation.id}).then(function () { store.annotation.hide({id: self.annotation.id}).then(function () {
annotationUI.hideAnnotation(self.annotation.id); annotationUI.hideAnnotation(self.annotation.id);
}).catch(function (err) { }).catch(function () {
flash.error(err.message); flash.error('Failed to hide annotation');
}); });
}; };
...@@ -43,8 +43,8 @@ function ModerationBannerController(annotationUI, flash, store) { ...@@ -43,8 +43,8 @@ function ModerationBannerController(annotationUI, flash, store) {
this.unhideAnnotation = function () { this.unhideAnnotation = function () {
store.annotation.unhide({id: self.annotation.id}).then(function () { store.annotation.unhide({id: self.annotation.id}).then(function () {
annotationUI.unhideAnnotation(self.annotation.id); annotationUI.unhideAnnotation(self.annotation.id);
}).catch(function (err) { }).catch(function () {
flash.error(err.message); flash.error('Failed to unhide annotation');
}); });
}; };
} }
......
...@@ -98,7 +98,7 @@ describe('moderationBanner', function () { ...@@ -98,7 +98,7 @@ describe('moderationBanner', function () {
banner.querySelector('button').click(); banner.querySelector('button').click();
setTimeout(function () { setTimeout(function () {
assert.calledWith(fakeFlash.error, 'Network Error'); assert.calledWith(fakeFlash.error, 'Failed to hide annotation');
done(); done();
}, 0); }, 0);
}); });
...@@ -120,7 +120,7 @@ describe('moderationBanner', function () { ...@@ -120,7 +120,7 @@ describe('moderationBanner', function () {
banner.querySelector('button').click(); banner.querySelector('button').click();
setTimeout(function () { setTimeout(function () {
assert.calledWith(fakeFlash.error, 'Network Error'); assert.calledWith(fakeFlash.error, 'Failed to unhide annotation');
done(); done();
}, 0); }, 0);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment