Fixed some chat notifications
parent
b3743c554a
commit
b665927832
|
@ -25,5 +25,6 @@ export {};
|
|||
|
||||
if(__build.target === "client") {
|
||||
/* do this so we don't get a react dev tools warning within the client */
|
||||
(window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__ = (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__ || {};
|
||||
(window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () {};
|
||||
}
|
|
@ -800,9 +800,6 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
this.connection_handler.sound.play(Sound.MESSAGE_RECEIVED, {default_volume: .5});
|
||||
}
|
||||
|
||||
if(!(invoker instanceof LocalClientEntry))
|
||||
this.connection_handler.channelTree.findChannel(channel_id)?.setUnread(true);
|
||||
|
||||
const conversations = this.connection_handler.side_bar.channel_conversations();
|
||||
conversations.findOrCreateConversation(channel_id).handleIncomingMessage({
|
||||
sender_database_id: invoker ? invoker.properties.client_database_id : 0,
|
||||
|
@ -826,9 +823,6 @@ export class ConnectionCommandHandler extends AbstractCommandHandler {
|
|||
}
|
||||
});
|
||||
|
||||
if(!(invoker instanceof LocalClientEntry))
|
||||
this.connection_handler.channelTree.server.setUnread(true);
|
||||
|
||||
conversations.findOrCreateConversation(0).handleIncomingMessage({
|
||||
sender_database_id: invoker ? invoker.properties.client_database_id : 0,
|
||||
sender_name: json["invokername"],
|
||||
|
|
|
@ -73,7 +73,7 @@ export abstract class AbstractChat<Events extends ConversationUIEvents> {
|
|||
if(event.isOwnMessage)
|
||||
this.setUnreadTimestamp(undefined);
|
||||
else if(!this.unreadTimestamp)
|
||||
this.unreadTimestamp = event.message.timestamp;
|
||||
this.setUnreadTimestamp(event.message.timestamp);
|
||||
|
||||
/* let all other events run before */
|
||||
this.events.fire_async("notify_chat_event", {
|
||||
|
@ -583,12 +583,8 @@ export class Conversation extends AbstractChat<ConversationUIEvents> {
|
|||
if(isNaN(timestamp))
|
||||
return;
|
||||
|
||||
if(timestamp > this.lastReadMessage) {
|
||||
if(timestamp > this.lastReadMessage)
|
||||
this.setUnreadTimestamp(this.lastReadMessage);
|
||||
|
||||
/* TODO: Move the whole last read part to the channel entry itself? */
|
||||
this.handle.connection.channelTree.findChannel(this.conversationId)?.setUnread(true);
|
||||
}
|
||||
}
|
||||
|
||||
public handleIncomingMessage(message: ChatMessage, isOwnMessage: boolean) {
|
||||
|
@ -647,6 +643,7 @@ export class Conversation extends AbstractChat<ConversationUIEvents> {
|
|||
|
||||
/* we've to update the last read timestamp regardless of if we're having actual unread stuff */
|
||||
this.handle.connection.settings.changeServer(Settings.FN_CHANNEL_CHAT_READ(this.conversationId), typeof timestamp === "number" ? timestamp : Date.now());
|
||||
this.handle.connection.channelTree.findChannel(this.conversationId)?.setUnread(timestamp !== undefined);
|
||||
}
|
||||
|
||||
public localClientSwitchedChannel(type: "join" | "leave") {
|
||||
|
|
|
@ -251,7 +251,7 @@ export class PrivateConversation extends AbstractChat<PrivateConversationUIEvent
|
|||
|
||||
/* TODO: Move this somehow to the client itself? */
|
||||
if(this.activeClient instanceof ClientEntry)
|
||||
this.activeClient.setUnread(timestamp === undefined);
|
||||
this.activeClient.setUnread(timestamp !== undefined);
|
||||
}
|
||||
|
||||
protected canClientAccessChat(): boolean {
|
||||
|
|
Loading…
Reference in New Issue