If I set my presence and add a status text like this:
mx.setPresence({
presence: 'online',
status_msg: 'Hello world!'
});
My status text in mx.getUser(mx.getUserId())?.presenceStatusMsg is updated to return 'Hello world!'.
If I then try to clear it like so:
mx.setPresence({
presence: 'online',
//status_msg: 'Hello world!'
});
The status text in mx.getUser(mx.getUserId())?.presenceStatusMsg will still return Hello world instead of undefined/null.
This behaviour happens because the event handler checks whether the status_msg has a value before updating it:
|
if (event.getContent().status_msg) { |
|
this.presenceStatusMsg = event.getContent().status_msg; |
|
} |
When I restart my client, the text is gone correctly. From my quick testing synapse seems to always include the status text in the presence if it is set, so maybe the value check can just be dropped? Not sure how other server implementations handle that though...
If I set my presence and add a status text like this:
My status text in
mx.getUser(mx.getUserId())?.presenceStatusMsgis updated to return 'Hello world!'.If I then try to clear it like so:
The status text in
mx.getUser(mx.getUserId())?.presenceStatusMsgwill still return Hello world instead of undefined/null.This behaviour happens because the event handler checks whether the status_msg has a value before updating it:
matrix-js-sdk/src/models/user.ts
Lines 222 to 224 in b274c74
When I restart my client, the text is gone correctly. From my quick testing synapse seems to always include the status text in the presence if it is set, so maybe the value check can just be dropped? Not sure how other server implementations handle that though...