Skip to content

Commit

Permalink
set channel name to other user name if channel type is dm
Browse files Browse the repository at this point in the history
  • Loading branch information
loudar committed May 27, 2024
1 parent d0e6921 commit 7ca4871
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/features/messaging/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {MariaDbDatabase} from "../database/mariaDbDatabase";
import {Request, Response} from "express";
import {ChannelMember, Message, User} from "../database/models";
import {Channel, ChannelMember, Message, User} from "../database/models";
import {CLI} from "../../tooling/CLI";
import {PermissionsList} from "../../enums/permissionsList";
import {SafeUser, safeUser} from "../authentication/actions";
Expand Down Expand Up @@ -200,7 +200,7 @@ export class MessagingEndpoints {
res.json([]);
return;
}
for (const channel of channels) {
for (const channel of channels as UiChannel[]) {
if (channel.type === "dm") {
const members = await db.getChannelMembers(channel.id);
if (members) {
Expand All @@ -212,6 +212,7 @@ export class MessagingEndpoints {
}
}
}
channel.members = members;
}
}
}
Expand All @@ -222,4 +223,8 @@ export class MessagingEndpoints {

export interface ReceivableMessage extends Message {
sender: SafeUser;
}

export interface UiChannel extends Channel {
members: ChannelMember[];
}

0 comments on commit 7ca4871

Please sign in to comment.