FIX: middle click was reading every notifications (#9252)

This commit is contained in:
Joffrey JAFFEUX 2020-03-23 12:28:16 +01:00 committed by GitHub
parent 445b35381d
commit 3f9b922d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -163,7 +163,7 @@ export const DefaultNotificationItem = createWidget(
this.attrs.set("read", true);
ajax("/notifications/mark-read", {
method: "PUT",
data: this.attrs.id
data: { id: this.attrs.id }
});
}
}

View File

@ -32,8 +32,15 @@ widgetTest("sets notification as read on middle click", {
},
async test(assert) {
let requests = 0;
pretender.put("/notifications/mark-read", () => {
pretender.put("/notifications/mark-read", request => {
++requests;
assert.equal(
request.requestBody,
`id=${this.args.id}`,
"it sets correct request parameters"
);
return [200, { "Content-Type": "application/json" }, { success: true }];
});