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

Commit d082758

Browse files
authored
Merge pull request #1676 from turt2live/travis/remove-presence
Remove presence management
2 parents 9794526 + fe2cbc5 commit d082758

File tree

6 files changed

+6
-211
lines changed

6 files changed

+6
-211
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
@@ -235,15 +235,15 @@ export default class MessageComposer extends React.Component {
235235
render() {
236236
const me = this.props.room.getMember(MatrixClientPeg.get().credentials.userId);
237237
const uploadInputStyle = {display: 'none'};
238-
const MemberPresenceAvatar = sdk.getComponent('avatars.MemberPresenceAvatar');
238+
const MemberAvatar = sdk.getComponent('avatars.MemberAvatar');
239239
const TintableSvg = sdk.getComponent("elements.TintableSvg");
240240
const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput");
241241

242242
const controls = [];
243243

244244
controls.push(
245245
<div key="controls_avatar" className="mx_MessageComposer_avatar">
246-
<MemberPresenceAvatar member={me} width={24} height={24} />
246+
<MemberAvatar member={me} width={24} height={24} />
247247
</div>,
248248
);
249249

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",

src/settings/Settings.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ export const SETTINGS = {
8888
supportedLevels: LEVELS_FEATURE,
8989
default: false,
9090
},
91-
"feature_presence_management": {
92-
isFeature: true,
93-
displayName: _td("Presence Management"),
94-
supportedLevels: LEVELS_FEATURE,
95-
default: false,
96-
},
9791
"feature_tag_panel": {
9892
isFeature: true,
9993
displayName: _td("Tag Panel"),

0 commit comments

Comments
 (0)