Skip to content

Commit

Permalink
feat: add the ability to ignore reports on an item
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed Mar 14, 2021
1 parent 6e77a74 commit 31f6cc1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/controls/voteable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@ export default abstract class VoteableControls extends BaseControls {
return this.client.post("api/remove", { id: this.namespace(id), spam });
}

/**
* Ignore any future reports of an item.
*
* @param id The ID of the item to ignore reports for.
*
* @returns A promise that resolves when the setting has been changed.
*/
async ignoreFutureReports(id: string): Promise<void> {
return this.client.post("api/ignore_reports", { id: this.namespace(id) });
}

/**
* Unignore any future reports of an item.
*
* @param id The ID of the item to unignore reports for.
*
* @returns A promise that resolves when the setting has been changed.
*/
async unignoreFutureReports(id: string): Promise<void> {
return this.client.post("api/unignore_reports", { id: this.namespace(id) });
}

/**
* Give Reddit gold to the author of an item.
*
Expand Down
23 changes: 23 additions & 0 deletions src/objects/voteable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export interface VoteableData extends ContentData {
/** The guildings that this item has received. */
gildings: Gildings;

/** Whether or not future reports of this item will be ignored. */
ignoreReports: boolean;

/**
* Whether and how you voted on this item.
*
Expand Down Expand Up @@ -251,6 +254,7 @@ export default abstract class Voteable extends Content implements VoteableData {
edited: number | false;
gilded: number;
gildings: Gildings;
ignoreReports: boolean;
likes: boolean | null;
modNote: string | null;
modReasonBy: string | null;
Expand Down Expand Up @@ -302,6 +306,7 @@ export default abstract class Voteable extends Content implements VoteableData {
this.edited = data.edited;
this.gilded = data.gilded;
this.gildings = data.gildings;
this.ignoreReports = data.ignoreReports;
this.likes = data.likes;
this.modNote = data.modNote;
this.modReasonBy = data.modReasonBy;
Expand Down Expand Up @@ -421,6 +426,24 @@ export default abstract class Voteable extends Content implements VoteableData {
return this.controls.remove(this.id, spam);
}

/**
* Ignore any future reports on this item.
*
* @returns A promise that resolves when the setting has been changed.
*/
async ignoreFutureReports(): Promise<void> {
return this.controls.ignoreFutureReports(this.id);
}

/**
* Unignore any future reports on this item.
*
* @returns A promise that resolves when the setting has been changed.
*/
async unignoreFutureReports(): Promise<void> {
return this.controls.unignoreFutureReports(this.id);
}

/**
* Give Reddit gold to the author of this item.
*
Expand Down

0 comments on commit 31f6cc1

Please sign in to comment.