Skip to content

Commit 69ffb2d

Browse files
committed
added unfollowComments to QPixel API
1 parent c50a502 commit 69ffb2d

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

app/assets/javascripts/qpixel_api.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ window.QPixel = {
473473

474474
followComments: async (postId) => {
475475
const resp = await QPixel.fetchJSON(`/comments/post/${postId}/follow`, {}, {
476-
headers: { 'Accept': 'application/json' },
476+
headers: { 'Accept': 'application/json' }
477477
});
478478

479479
const data = await resp.json();
@@ -492,6 +492,16 @@ window.QPixel = {
492492
return data;
493493
},
494494

495+
unfollowComments: async (postId) => {
496+
const resp = await QPixel.fetchJSON(`/comments/post/${postId}/unfollow`, {}, {
497+
headers: { 'Accept': 'application/json' }
498+
});
499+
500+
const data = await resp.json();
501+
502+
return data;
503+
},
504+
495505
lockThread: async (id) => {
496506
const resp = await QPixel.fetchJSON(`/comments/thread/${id}/restrict`, {
497507
type: 'lock'

global.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,13 @@ interface QPixel {
389389
*/
390390
undeleteComment?: (id: string) => Promise<QPixelResponseJSON>
391391

392+
/**
393+
* Attempts to stop following comments on a given post
394+
* @param postId id of the post to stop following comments on
395+
* @returns result of the operation
396+
*/
397+
unfollowComments?: (postId: string) => Promise<QPixelResponseJSON>
398+
392399
/**
393400
* Attempts to lock a comment thread
394401
* @param id id of the comment thread to lock

0 commit comments

Comments
 (0)