Skip to content

Commit

Permalink
feat(lib): deprecate old reporting methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Salet committed Jul 31, 2024
1 parent 91bef3c commit c6dda44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/src/entities/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,20 +750,20 @@ export class Channel {
}

/**
* Flagged messages
* Reported messages
*/

async getFlaggedMessagesHistory(
async getMessageReportsHistory(
params: { startTimetoken?: string; endTimetoken?: string; count?: number } = {}
) {
): Promise<{ events: Event<"report">[]; isMore: boolean }> {
const channel = `${INTERNAL_MODERATION_PREFIX}${this.id}`
return this.chat.getEventsHistory({
...params,
channel,
})
}

listenForFlaggedMessages(callback: (event: Event<"report">) => void) {
streamMessageReports(callback: (event: Event<"report">) => void) {
const channel = `${INTERNAL_MODERATION_PREFIX}${this.id}`
return this.chat.listenForEvents({
channel,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/entities/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ export class Message {
await this.chat.pinMessageToChannel(this, channel!)
}

async report(reason: string) {
/** @deprecated */
async DEPRECATED_report(reason: string) {
const channel = INTERNAL_ADMIN_CHANNEL
const payload = {
text: this.text,
Expand All @@ -380,7 +381,7 @@ export class Message {
return await this.chat.emitEvent({ channel, type: "report", payload })
}

async reportOnChannel(reason: string) {
async report(reason: string) {
const channel = `${INTERNAL_MODERATION_PREFIX}${this.channelId}`
const payload = {
text: this.text,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/entities/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ export class User {
/*
* Other
*/
async report(reason: string) {
/** @deprecated */
async DEPRECATED_report(reason: string) {
const channel = INTERNAL_ADMIN_CHANNEL
const payload = {
reason,
Expand Down

0 comments on commit c6dda44

Please sign in to comment.