implement display of sender name in chat

This commit is contained in:
marlon-erler
2026-09-27 02:06:04 +02:00
parent a96ae1833e
commit 315a6ab8f0
9 changed files with 17 additions and 15 deletions
+5 -5
View File
@@ -181,8 +181,8 @@ export default class ChatModel {
}; };
readonly getSendingData = (): [string, string, string] => { readonly getSendingData = (): [string, string, string] => {
const senderName: string = this.settingsModel.username || "?";
const id: string = this.settingsModel.userid; const id: string = this.settingsModel.userid;
const senderName: string = this.settingsModel.username || "?";
const allChannels: string[] = [this.id]; const allChannels: string[] = [this.id];
for (const secondaryChannel of this.info.secondaryChannels) { for (const secondaryChannel of this.info.secondaryChannels) {
@@ -395,8 +395,8 @@ export default class ChatModel {
static createChatMessage = async ( static createChatMessage = async (
channel: string, channel: string,
sender: string,
senderId: string, senderId: string,
senderName: string,
encryptionKey: string, encryptionKey: string,
body: string, body: string,
inlineReplyId?: string, inlineReplyId?: string,
@@ -408,7 +408,7 @@ export default class ChatModel {
id: v4(), id: v4(),
channel, channel,
sender, senderName,
senderId, senderId,
body, body,
dateSent: createTimestamp(), dateSent: createTimestamp(),
@@ -495,8 +495,8 @@ export interface ChatMessage extends ValidObject {
readonly id: string; readonly id: string;
readonly channel: string; readonly channel: string;
readonly sender: string;
readonly senderId: string; readonly senderId: string;
readonly senderName: string;
body: string; body: string;
readonly dateSent: string; readonly dateSent: string;
readonly inlineReplyId?: string; readonly inlineReplyId?: string;
@@ -539,7 +539,7 @@ export const ChatMessageReference: ChatMessage = {
id: "", id: "",
channel: "", channel: "",
sender: "", senderName: "",
senderId: "", senderId: "",
body: "", body: "",
dateSent: "", dateSent: "",
+1 -1
View File
@@ -38,7 +38,7 @@ export function ChatMessage(
<div class="main tile"> <div class="main tile">
<div class="text-container"> <div class="text-container">
<span class="sender-name ellipsis"> <span class="sender-name ellipsis">
{chatMessageViewModel.sender} {chatMessageViewModel.senderName}
</span> </span>
<span <span
class="body" class="body"
+1 -1
View File
@@ -12,7 +12,7 @@ export function InlineReply(chatMessageViewModel: ChatMessageViewModel) {
return ( return (
<div class="inline-reply" on:click={scroll}> <div class="inline-reply" on:click={scroll}>
<span>{reply.sender}</span> <span>{reply.senderId}</span>
<b class="ellipsis" subscribe:innerText={reply.body}></b> <b class="ellipsis" subscribe:innerText={reply.body}></b>
</div> </div>
); );
+1 -1
View File
@@ -9,7 +9,7 @@ export function ReplyPreview(
return ( return (
<div class="reply-preview"> <div class="reply-preview">
<div class="surface blur"> <div class="surface blur">
<span class="secondary">{chatMessageViewModel.sender}</span> <span class="secondary">{chatMessageViewModel.senderId}</span>
<b <b
class="ellipsis" class="ellipsis"
subscribe:innerText={chatMessageViewModel.body} subscribe:innerText={chatMessageViewModel.body}
+1 -1
View File
@@ -18,7 +18,7 @@ export function ReplyViewHeader(
? "" ? ""
: coreViewModel.translations.chatPage.message.replyHeaderLabel( : coreViewModel.translations.chatPage.message.replyHeaderLabel(
messagePageViewModel.replyViewSelectedMessage.value messagePageViewModel.replyViewSelectedMessage.value
.sender, .senderId,
), ),
); );
const message = React.createProxyState( const message = React.createProxyState(
+1 -1
View File
@@ -27,7 +27,7 @@ export function ChatMessageInfoModal(
{InfoTile( {InfoTile(
"account_circle", "account_circle",
coreViewModel.translations.chatPage.message.sentBy, coreViewModel.translations.chatPage.message.sentBy,
chatMessageViewModel.sender, chatMessageViewModel.senderId,
)} )}
{InfoTile( {InfoTile(
"schedule", "schedule",
+5 -3
View File
@@ -12,7 +12,8 @@ export default class ChatMessageViewModel {
// data // data
chatMessage: ChatMessage; chatMessage: ChatMessage;
channel: string = ""; channel: string = "";
sender: string = ""; senderId: string = "";
senderName: string = "";
dateSent: string = ""; dateSent: string = "";
body: React.State<string> = new React.State(""); body: React.State<string> = new React.State("");
inlineReply: ChatMessageViewModel | undefined = undefined; inlineReply: ChatMessageViewModel | undefined = undefined;
@@ -165,7 +166,7 @@ export default class ChatMessageViewModel {
this.allReactions.set(reaction.senderId, reaction); this.allReactions.set(reaction.senderId, reaction);
} }
if (reaction.senderId != this.coreViewModel.settingsModel.username) if (reaction.senderId != this.coreViewModel.settingsModel.userid)
return; return;
this.userReaction.value = reaction.isDeleting this.userReaction.value = reaction.isDeleting
? undefined ? undefined
@@ -183,7 +184,8 @@ export default class ChatMessageViewModel {
// load // load
loadData = (): void => { loadData = (): void => {
this.channel = this.chatMessage.channel; this.channel = this.chatMessage.channel;
this.sender = this.chatMessage.sender; this.senderId = this.chatMessage.senderId;
this.senderName = this.chatMessage.senderName;
this.dateSent = new Date(this.chatMessage.dateSent).toLocaleString(); this.dateSent = new Date(this.chatMessage.dateSent).toLocaleString();
this.body.value = this.chatMessage.body; this.body.value = this.chatMessage.body;
this.status.value = this.chatMessage.status; this.status.value = this.chatMessage.status;
@@ -87,7 +87,7 @@ export default class NotificationViewModel {
messageId: message.id, messageId: message.id,
chat, chat,
fullChannel, fullChannel,
sender: message.sender, sender: message.senderName,
body: message.body, body: message.body,
}; };
} }
+1 -1
View File
@@ -110,7 +110,7 @@ export default class MessagePageViewModel extends Context {
this.coreViewModel, this.coreViewModel,
this, this,
chatMessage, chatMessage,
chatMessage.sender == chatMessage.senderName ==
this.chatViewModel.settingsViewModel.username.value, this.chatViewModel.settingsViewModel.username.value,
); );