apply filter when sending message
This commit is contained in:
@@ -198,7 +198,7 @@ export default class ChatModel {
|
||||
body: string,
|
||||
inlineReplyId?: string,
|
||||
fileContent?: FileContent<string>,
|
||||
): Promise<boolean> => {
|
||||
): Promise<string|false> => {
|
||||
const nameAndChannel = this.getNameAndChannel();
|
||||
if (nameAndChannel == false) return false;
|
||||
const [senderName, combinedChannel] = nameAndChannel;
|
||||
@@ -214,7 +214,7 @@ export default class ChatModel {
|
||||
|
||||
this.addMessage(chatMessage);
|
||||
this.connectionModel.sendMessageOrStore(chatMessage);
|
||||
return true;
|
||||
return chatMessage.id;
|
||||
};
|
||||
|
||||
readonly decryptMessage = async (
|
||||
|
||||
@@ -171,7 +171,6 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
|
||||
updateMonthGrid = (): void => {
|
||||
const today = formatISO(this.coreViewModel.todayDate.value)
|
||||
console.log(today, this.coreViewModel.todayDate.value);
|
||||
if (
|
||||
this.currentTodayDate == today
|
||||
)
|
||||
|
||||
@@ -35,22 +35,29 @@ export default class MessagePageViewModel extends Context {
|
||||
cannotSendMessage: React.State<boolean>;
|
||||
|
||||
// methods
|
||||
sendMessage = (): void => {
|
||||
sendMessage = async (): Promise<void> => {
|
||||
if (this.cannotSendMessage.value == true) return;
|
||||
|
||||
this.sendMessageFromBody(this.composingMessage.value);
|
||||
const idPromise = this.sendMessageFromBody(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;
|
||||
if (this.replyingMessage.value) {
|
||||
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;
|
||||
|
||||
return id;
|
||||
};
|
||||
|
||||
decryptMessage = async (
|
||||
|
||||
Reference in New Issue
Block a user