extract alias handling to separate function
This commit is contained in:
parent
6670c727a4
commit
5544ee6408
2 changed files with 6 additions and 2 deletions
|
@ -146,7 +146,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
|
||||||
const events = this.props.target.getLiveTimeline().getEvents();
|
const events = this.props.target.getLiveTimeline().getEvents();
|
||||||
matrixToUrl = this.state.permalinkCreator.forEvent(events[events.length - 1].getId());
|
matrixToUrl = this.state.permalinkCreator.forEvent(events[events.length - 1].getId());
|
||||||
} else {
|
} else {
|
||||||
matrixToUrl = this.state.permalinkCreator.forRoom();
|
matrixToUrl = this.state.permalinkCreator.forShareableRoom();
|
||||||
}
|
}
|
||||||
} else if (this.props.target instanceof User || this.props.target instanceof RoomMember) {
|
} else if (this.props.target instanceof User || this.props.target instanceof RoomMember) {
|
||||||
matrixToUrl = makeUserPermalink(this.props.target.userId);
|
matrixToUrl = makeUserPermalink(this.props.target.userId);
|
||||||
|
|
|
@ -129,7 +129,7 @@ export class RoomPermalinkCreator {
|
||||||
return getPermalinkConstructor().forEvent(this._roomId, eventId, this._serverCandidates);
|
return getPermalinkConstructor().forEvent(this._roomId, eventId, this._serverCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
forRoom() {
|
forShareableRoom() {
|
||||||
if (this._room) {
|
if (this._room) {
|
||||||
// Prefer to use canonical alias for permalink if possible
|
// Prefer to use canonical alias for permalink if possible
|
||||||
const alias = this._room.getCanonicalAlias();
|
const alias = this._room.getCanonicalAlias();
|
||||||
|
@ -140,6 +140,10 @@ export class RoomPermalinkCreator {
|
||||||
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
|
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forRoom() {
|
||||||
|
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
|
||||||
|
}
|
||||||
|
|
||||||
onRoomState(event) {
|
onRoomState(event) {
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case "m.room.server_acl":
|
case "m.room.server_acl":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue