Use the now-prefixed js-sdk status message API

See 08b3dfa3b5
This commit is contained in:
Travis Ralston 2018-12-12 23:07:03 -07:00
parent b0b7932f5f
commit f2649f7807
5 changed files with 10 additions and 10 deletions

View file

@ -40,7 +40,7 @@ export default class MemberStatusMessageAvatar extends React.Component {
MatrixClientPeg.get().on("RoomState.events", this._onRoomStateEvents);
if (this.props.member.user) {
this.setState({message: this.props.member.user.statusMessage});
this.setState({message: this.props.member.user._unstable_statusMessage});
} else {
this.setState({message: ""});
}
@ -55,7 +55,7 @@ export default class MemberStatusMessageAvatar extends React.Component {
_onRoomStateEvents(ev, state) {
if (ev.getStateKey() !== MatrixClientPeg.get().getUserId()) return;
if (ev.getType() !== "im.vector.user_status") return;
// TODO: We should be relying on `this.props.member.user.statusMessage`
// TODO: We should be relying on `this.props.member.user._unstable_statusMessage`
this.setState({message: ev.getContent()["status"]});
this.forceUpdate();
}
@ -82,7 +82,7 @@ export default class MemberStatusMessageAvatar extends React.Component {
}
render() {
const hasStatus = this.props.member.user ? !!this.props.member.user.statusMessage : false;
const hasStatus = this.props.member.user ? !!this.props.member.user._unstable_statusMessage : false;
const classes = classNames({
"mx_MemberStatusMessageAvatar": true,

View file

@ -29,18 +29,18 @@ export default class StatusMessageContextMenu extends React.Component {
this._onStatusChange = this._onStatusChange.bind(this);
this.state = {
message: props.user ? props.user.statusMessage : "",
message: props.user ? props.user._unstable_statusMessage : "",
};
}
async _onClearClick(e) {
await MatrixClientPeg.get().setStatusMessage("");
await MatrixClientPeg.get()._unstable_setStatusMessage("");
this.setState({message: ""});
}
_onSubmit(e) {
e.preventDefault();
MatrixClientPeg.get().setStatusMessage(this.state.message);
MatrixClientPeg.get()._unstable_setStatusMessage(this.state.message);
}
_onStatusChange(e) {

View file

@ -895,7 +895,7 @@ module.exports = withMatrixClient(React.createClass({
presenceState = this.props.member.user.presence;
presenceLastActiveAgo = this.props.member.user.lastActiveAgo;
presenceCurrentlyActive = this.props.member.user.currentlyActive;
statusMessage = this.props.member.user.statusMessage;
statusMessage = this.props.member.user._unstable_statusMessage;
}
const room = this.props.matrixClient.getRoom(this.props.member.roomId);

View file

@ -84,7 +84,7 @@ module.exports = React.createClass({
const name = this._getDisplayName();
const active = -1;
const presenceState = member.user ? member.user.presence : null;
const statusMessage = member.user ? member.user.statusMessage : null;
const statusMessage = member.user ? member.user._unstable_statusMessage : null;
const av = (
<MemberAvatar member={member} width={36} height={36} />

View file

@ -257,8 +257,8 @@ module.exports = React.createClass({
if (!isInvite && isJoined && looksLikeDm) {
const selfId = MatrixClientPeg.get().getUserId();
const otherMember = this.props.room.currentState.getMembersExcept([selfId])[0];
if (otherMember.user && otherMember.user.statusMessage) {
subtext = otherMember.user.statusMessage;
if (otherMember.user && otherMember.user._unstable_statusMessage) {
subtext = otherMember.user._unstable_statusMessage;
}
}