mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-24 18:59:17 +00:00
Disable typing notifications for threads (#7180)
This commit is contained in:
@@ -37,7 +37,7 @@ export default class TypingStore {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
static sharedInstance(): TypingStore {
|
||||
public static sharedInstance(): TypingStore {
|
||||
if (window.mxTypingStore === undefined) {
|
||||
window.mxTypingStore = new TypingStore();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export default class TypingStore {
|
||||
* Clears all cached typing states. Intended to be called when the
|
||||
* MatrixClientPeg client changes.
|
||||
*/
|
||||
reset() {
|
||||
public reset() {
|
||||
this.typingStates = {
|
||||
// "roomId": {
|
||||
// isTyping: bool, // Whether the user is typing or not
|
||||
@@ -63,9 +63,12 @@ export default class TypingStore {
|
||||
* @param {string} roomId The room ID to set the typing state in.
|
||||
* @param {boolean} isTyping Whether the user is typing or not.
|
||||
*/
|
||||
setSelfTyping(roomId: string, isTyping: boolean): void {
|
||||
public setSelfTyping(roomId: string, threadId: string | null, isTyping: boolean): void {
|
||||
if (!SettingsStore.getValue('sendTypingNotifications')) return;
|
||||
if (SettingsStore.getValue('lowBandwidth')) return;
|
||||
// Disable typing notification for threads for the initial launch
|
||||
// before we figure out a better user experience for them
|
||||
if (SettingsStore.getValue("feature_thread") && threadId) return;
|
||||
|
||||
let currentTyping = this.typingStates[roomId];
|
||||
if ((!isTyping && !currentTyping) || (currentTyping && currentTyping.isTyping === isTyping)) {
|
||||
@@ -96,7 +99,7 @@ export default class TypingStore {
|
||||
|
||||
if (!currentTyping.userTimer.isRunning()) {
|
||||
currentTyping.userTimer.restart().finished().then(() => {
|
||||
this.setSelfTyping(roomId, false);
|
||||
this.setSelfTyping(roomId, threadId, false);
|
||||
});
|
||||
} else currentTyping.userTimer.restart();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user