-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from Automattic/allow_navigating_away_from_un…
…known_room_view Allow navigating away from unknown room view
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {UnknownRoomViewModel as BaseUnknownRoomViewModel} from "hydrogen-web/src/domain/session/room/UnknownRoomViewModel"; | ||
import {SegmentType} from "hydrogen-web/src/domain/navigation"; | ||
import {Segment} from "hydrogen-web/src/domain/navigation/Navigation"; | ||
|
||
export class UnknownRoomViewModel extends BaseUnknownRoomViewModel { | ||
private readonly _singleRoomId: any; | ||
|
||
constructor(options) { | ||
super(options); | ||
this._singleRoomId = options.singleRoomId; | ||
} | ||
|
||
get navigation() { | ||
return super.navigation; | ||
} | ||
|
||
get urlRouter() { | ||
return super.urlRouter; | ||
} | ||
|
||
get closeUrl() { | ||
if (this._singleRoomId) { | ||
const path = this.navigation.path.with(new Segment<SegmentType>("session")); | ||
return this.urlRouter.urlForPath(path); | ||
} | ||
|
||
return super.closeUrl; | ||
} | ||
} |