mirror of https://github.com/vector-im/riot-web
Merge pull request #6118 from aaronraimist/share-room
commit
826d56585e
|
@ -19,11 +19,11 @@ limitations under the License.
|
|||
* TODO: Convert this to a real TypeScript interface
|
||||
*/
|
||||
export default class PermalinkConstructor {
|
||||
forEvent(roomId: string, eventId: string, serverCandidates: string[]): string {
|
||||
forEvent(roomId: string, eventId: string, serverCandidates: string[] = []): string {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
forRoom(roomIdOrAlias: string, serverCandidates: string[]): string {
|
||||
forRoom(roomIdOrAlias: string, serverCandidates: string[] = []): string {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
|
@ -73,12 +73,12 @@ export class PermalinkParts {
|
|||
return new PermalinkParts(null, null, null, groupId, null);
|
||||
}
|
||||
|
||||
static forRoom(roomIdOrAlias: string, viaServers: string[]): PermalinkParts {
|
||||
return new PermalinkParts(roomIdOrAlias, null, null, null, viaServers || []);
|
||||
static forRoom(roomIdOrAlias: string, viaServers: string[] = []): PermalinkParts {
|
||||
return new PermalinkParts(roomIdOrAlias, null, null, null, viaServers);
|
||||
}
|
||||
|
||||
static forEvent(roomId: string, eventId: string, viaServers: string[]): PermalinkParts {
|
||||
return new PermalinkParts(roomId, eventId, null, null, viaServers || []);
|
||||
static forEvent(roomId: string, eventId: string, viaServers: string[] = []): PermalinkParts {
|
||||
return new PermalinkParts(roomId, eventId, null, null, viaServers);
|
||||
}
|
||||
|
||||
get primaryEntityId(): string {
|
||||
|
|
|
@ -149,7 +149,7 @@ export class RoomPermalinkCreator {
|
|||
// Prefer to use canonical alias for permalink if possible
|
||||
const alias = this.room.getCanonicalAlias();
|
||||
if (alias) {
|
||||
return getPermalinkConstructor().forRoom(alias, this._serverCandidates);
|
||||
return getPermalinkConstructor().forRoom(alias);
|
||||
}
|
||||
}
|
||||
return getPermalinkConstructor().forRoom(this.roomId, this._serverCandidates);
|
||||
|
@ -302,7 +302,7 @@ export function makeRoomPermalink(roomId: string): string {
|
|||
}
|
||||
const permalinkCreator = new RoomPermalinkCreator(room);
|
||||
permalinkCreator.load();
|
||||
return permalinkCreator.forRoom();
|
||||
return permalinkCreator.forShareableRoom();
|
||||
}
|
||||
|
||||
export function makeGroupPermalink(groupId: string): string {
|
||||
|
|
|
@ -34,7 +34,7 @@ function mockRoom(roomId, members, serverACL) {
|
|||
|
||||
return {
|
||||
roomId,
|
||||
getCanonicalAlias: () => roomId,
|
||||
getCanonicalAlias: () => null,
|
||||
getJoinedMembers: () => members,
|
||||
getMember: (userId) => members.find(m => m.userId === userId),
|
||||
currentState: {
|
||||
|
|
Loading…
Reference in New Issue