apply filter when sending message

This commit is contained in:
marlon-erler
2026-09-26 13:31:36 +02:00
parent 6a8febfbd4
commit b6eeba365c
3 changed files with 111 additions and 105 deletions
+2 -2
View File
@@ -198,7 +198,7 @@ export default class ChatModel {
body: string, body: string,
inlineReplyId?: string, inlineReplyId?: string,
fileContent?: FileContent<string>, fileContent?: FileContent<string>,
): Promise<boolean> => { ): Promise<string|false> => {
const nameAndChannel = this.getNameAndChannel(); const nameAndChannel = this.getNameAndChannel();
if (nameAndChannel == false) return false; if (nameAndChannel == false) return false;
const [senderName, combinedChannel] = nameAndChannel; const [senderName, combinedChannel] = nameAndChannel;
@@ -214,7 +214,7 @@ export default class ChatModel {
this.addMessage(chatMessage); this.addMessage(chatMessage);
this.connectionModel.sendMessageOrStore(chatMessage); this.connectionModel.sendMessageOrStore(chatMessage);
return true; return chatMessage.id;
}; };
readonly decryptMessage = async ( readonly decryptMessage = async (
@@ -171,7 +171,6 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
updateMonthGrid = (): void => { updateMonthGrid = (): void => {
const today = formatISO(this.coreViewModel.todayDate.value) const today = formatISO(this.coreViewModel.todayDate.value)
console.log(today, this.coreViewModel.todayDate.value);
if ( if (
this.currentTodayDate == today this.currentTodayDate == today
) )
+12 -5
View File
@@ -35,22 +35,29 @@ export default class MessagePageViewModel extends Context {
cannotSendMessage: React.State<boolean>; cannotSendMessage: React.State<boolean>;
// methods // methods
sendMessage = (): void => { sendMessage = async (): Promise<void> => {
if (this.cannotSendMessage.value == true) return; if (this.cannotSendMessage.value == true) return;
this.sendMessageFromBody(this.composingMessage.value); const idPromise = this.sendMessageFromBody(this.composingMessage.value);
this.composingMessage.value = ""; this.composingMessage.value = "";
const id = await idPromise;
if (id && this.reactionFilter.value != undefined) {
this.sendReaction(id, this.reactionFilter.value, false);
}
}; };
sendMessageFromBody = (body: string): void => { sendMessageFromBody = (body: string): Promise<string|false>=> {
let replyId: string | undefined = undefined; let replyId: string | undefined = undefined;
if (this.replyingMessage.value) { if (this.replyingMessage.value) {
replyId = this.replyingMessage.value.chatMessage.id; replyId = this.replyingMessage.value.chatMessage.id;
} }
this.chatViewModel.chatModel.sendMessage(body, replyId); const id = this.chatViewModel.chatModel.sendMessage(body, replyId);
if (this.replyViewSelectedMessage.value != undefined) return; if (this.replyViewSelectedMessage.value == undefined)
this.replyingMessage.value = undefined; this.replyingMessage.value = undefined;
return id;
}; };
decryptMessage = async ( decryptMessage = async (