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) {
this.hideAnnotation = function () {
store.annotation.hide({id: self.annotation.id}).then(function () {
annotationUI.hideAnnotation(self.annotation.id);
}).catch(function (err) {
flash.error(err.message);
}).catch(function () {
flash.error('Failed to hide annotation');
});
};
......@@ -43,8 +43,8 @@ function ModerationBannerController(annotationUI, flash, store) {
this.unhideAnnotation = function () {
store.annotation.unhide({id: self.annotation.id}).then(function () {
annotationUI.unhideAnnotation(self.annotation.id);
}).catch(function (err) {
flash.error(err.message);
}).catch(function () {
flash.error('Failed to unhide annotation');
});
};
}
......
......@@ -98,7 +98,7 @@ describe('moderationBanner', function () {
banner.querySelector('button').click();
setTimeout(function () {
assert.calledWith(fakeFlash.error, 'Network Error');
assert.calledWith(fakeFlash.error, 'Failed to hide annotation');
done();
}, 0);
});
......@@ -120,7 +120,7 @@ describe('moderationBanner', function () {
banner.querySelector('button').click();
setTimeout(function () {
assert.calledWith(fakeFlash.error, 'Network Error');
assert.calledWith(fakeFlash.error, 'Failed to unhide annotation');
done();
}, 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