[FIX] Typing when UI_Use_Real_Name is enabled (#2216)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
ff74f6ec9e
commit
8fe0615e68
|
@ -89,12 +89,14 @@ export default class RoomSubscription {
|
||||||
}
|
}
|
||||||
if (ev === 'typing') {
|
if (ev === 'typing') {
|
||||||
const { user } = reduxStore.getState().login;
|
const { user } = reduxStore.getState().login;
|
||||||
const [username, typing] = ddpMessage.fields.args;
|
const { UI_Use_Real_Name } = reduxStore.getState().settings;
|
||||||
if (username !== user.username) {
|
const [name, typing] = ddpMessage.fields.args;
|
||||||
|
const key = UI_Use_Real_Name ? 'name' : 'username';
|
||||||
|
if (name !== user[key]) {
|
||||||
if (typing) {
|
if (typing) {
|
||||||
reduxStore.dispatch(addUserTyping(username));
|
reduxStore.dispatch(addUserTyping(name));
|
||||||
} else {
|
} else {
|
||||||
reduxStore.dispatch(removeUserTyping(username));
|
reduxStore.dispatch(removeUserTyping(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ev === 'deleteMessage') {
|
} else if (ev === 'deleteMessage') {
|
||||||
|
|
|
@ -705,9 +705,12 @@ const RocketChat = {
|
||||||
onStreamData(...args) {
|
onStreamData(...args) {
|
||||||
return this.sdk.onStreamData(...args);
|
return this.sdk.onStreamData(...args);
|
||||||
},
|
},
|
||||||
emitTyping(room, t = true) {
|
emitTyping(room, typing = true) {
|
||||||
const { login } = reduxStore.getState();
|
const { login, settings } = reduxStore.getState();
|
||||||
return this.methodCall('stream-notify-room', `${ room }/typing`, login.user.username, t);
|
const { UI_Use_Real_Name } = settings;
|
||||||
|
const { user } = login;
|
||||||
|
const name = UI_Use_Real_Name ? user.name : user.username;
|
||||||
|
return this.methodCall('stream-notify-room', `${ room }/typing`, name, typing);
|
||||||
},
|
},
|
||||||
setUserPresenceAway() {
|
setUserPresenceAway() {
|
||||||
return this.methodCall('UserPresence:away');
|
return this.methodCall('UserPresence:away');
|
||||||
|
|
Loading…
Reference in New Issue