add guard cannotSendMessage

This commit is contained in:
marlon-erler
2024-07-20 21:04:41 +02:00
parent 9f93856829
commit f3e4be375f
6 changed files with 51 additions and 18 deletions
+7 -3
View File
@@ -161,7 +161,10 @@ export class ChatModel {
};
// messaging
sendMessage = (body: string): void => {
sendMessage = (body: string): boolean => {
const senderName = this.settingsModel.username;
if (senderName == "") return false;
const allChannels = [this.info.primaryChannel];
for (const secondaryChannel of this.info.secondaryChannels) {
allChannels.push(secondaryChannel);
@@ -171,11 +174,12 @@ export class ChatModel {
const chatMessage: ChatMessage = ChatModel.createChatMessage(
combinedChannel,
this.settingsModel.username,
senderName,
body
);
this.connectionModel.sendMessageOrStore(chatMessage);
return true;
};
// memory