Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 91a4139

Browse files
turt2livedbkr
authored andcommitted
Remove presence management
The feature is incredibly buggy and doesn't work as expected due to server behaviour and client interaction. One of the major problems is the constantly confused presence state - this is caused by the mobile apps conflicting on the state of the web app, causing it to consider the user offline or online (and rarely away) depending on how riot-android/ios is behaving at the time. This reverts two PRs: * #1620 * #1482 The changes to the context menu positioning were not reverted as they are useful outside of presence management. Signed-off-by: Travis Ralston <[email protected]>
1 parent 760f21b commit 91a4139

File tree

5 files changed

+6
-205
lines changed

5 files changed

+6
-205
lines changed

src/MatrixClientPeg.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class MatrixClientPeg {
9898
const opts = utils.deepCopy(this.opts);
9999
// the react sdk doesn't work without this, so don't allow
100100
opts.pendingEventOrdering = "detached";
101-
opts.disablePresence = true; // we do this manually
102101

103102
try {
104103
const promise = this.matrixClient.store.startup();

src/Presence.js

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,13 @@ class Presence {
5757
return this.state;
5858
}
5959

60-
/**
61-
* Get the current status message.
62-
* @returns {String} the status message, may be null
63-
*/
64-
getStatusMessage() {
65-
return this.statusMessage;
66-
}
67-
6860
/**
6961
* Set the presence state.
7062
* If the state has changed, the Home Server will be notified.
7163
* @param {string} newState the new presence state (see PRESENCE enum)
72-
* @param {String} statusMessage an optional status message for the presence
73-
* @param {boolean} maintain true to have this status maintained by this tracker
7464
*/
75-
setState(newState, statusMessage=null, maintain=false) {
76-
if (this.maintain) {
77-
// Don't update presence if we're maintaining a particular status
78-
return;
79-
}
80-
if (newState === this.state && statusMessage === this.statusMessage) {
65+
setState(newState) {
66+
if (newState === this.state) {
8167
return;
8268
}
8369
if (PRESENCE_STATES.indexOf(newState) === -1) {
@@ -87,37 +73,21 @@ class Presence {
8773
return;
8874
}
8975
const old_state = this.state;
90-
const old_message = this.statusMessage;
9176
this.state = newState;
92-
this.statusMessage = statusMessage;
93-
this.maintain = maintain;
9477

9578
if (MatrixClientPeg.get().isGuest()) {
9679
return; // don't try to set presence when a guest; it won't work.
9780
}
9881

99-
const updateContent = {
100-
presence: this.state,
101-
status_msg: this.statusMessage ? this.statusMessage : '',
102-
};
103-
10482
const self = this;
105-
MatrixClientPeg.get().setPresence(updateContent).done(function() {
83+
MatrixClientPeg.get().setPresence(this.state).done(function() {
10684
console.log("Presence: %s", newState);
107-
108-
// We have to dispatch because the js-sdk is unreliable at telling us about our own presence
109-
dis.dispatch({action: "self_presence_updated", statusInfo: updateContent});
11085
}, function(err) {
11186
console.error("Failed to set presence: %s", err);
11287
self.state = old_state;
113-
self.statusMessage = old_message;
11488
});
11589
}
11690

117-
stopMaintainingStatus() {
118-
this.maintain = false;
119-
}
120-
12191
/**
12292
* Callback called when the user made no action on the page for UNAVAILABLE_TIME ms.
12393
* @private

src/components/views/avatars/MemberPresenceAvatar.js

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/components/views/rooms/MessageComposer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@ export default class MessageComposer extends React.Component {
251251
render() {
252252
const me = this.props.room.getMember(MatrixClientPeg.get().credentials.userId);
253253
const uploadInputStyle = {display: 'none'};
254-
const MemberPresenceAvatar = sdk.getComponent('avatars.MemberPresenceAvatar');
254+
const MemberAvatar = sdk.getComponent('avatars.MemberAvatar');
255255
const TintableSvg = sdk.getComponent("elements.TintableSvg");
256256
const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput");
257257

258258
const controls = [];
259259

260260
controls.push(
261261
<div key="controls_avatar" className="mx_MessageComposer_avatar">
262-
<MemberPresenceAvatar member={me} width={24} height={24} />
262+
<MemberAvatar member={me} width={24} height={24} />
263263
</div>,
264264
);
265265

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
"%(widgetName)s widget modified by %(senderName)s": "%(widgetName)s widget modified by %(senderName)s",
171171
"%(widgetName)s widget added by %(senderName)s": "%(widgetName)s widget added by %(senderName)s",
172172
"%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s",
173+
"Message Pinning": "Message Pinning",
173174
"%(displayName)s is typing": "%(displayName)s is typing",
174175
"%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing",
175176
"%(names)s and %(count)s others are typing|one": "%(names)s and one other is typing",

0 commit comments

Comments
 (0)