@@ -15,9 +15,6 @@ limitations under the License.
1515*/
1616
1717import { ViewModel } from "../../ViewModel" ;
18- import { TimelineViewModel } from "./timeline/TimelineViewModel" ;
19- import { tileClassForEntry as defaultTileClassForEntry } from "./timeline/tiles/index" ;
20- import { getAvatarHttpUrl } from "../../avatar" ;
2118
2219export class UnknownRoomViewModel extends ViewModel {
2320 constructor ( options ) {
@@ -27,12 +24,6 @@ export class UnknownRoomViewModel extends ViewModel {
2724 this . roomIdOrAlias = roomIdOrAlias ;
2825 this . _error = null ;
2926 this . _busy = false ;
30- this . _worldReadable = false ; // won't know until load() finishes with isWorldReadableRoom() call
31- this . _checkingPreviewCapability = false ; // won't know until load() finishes with isWorldReadableRoom() call
32- }
33-
34- get room ( ) {
35- return this . _room ;
3627 }
3728
3829 get error ( ) {
@@ -61,60 +52,7 @@ export class UnknownRoomViewModel extends ViewModel {
6152 return this . _busy ;
6253 }
6354
64- // matrix.org can choose not to return messages for a world_readable room
65- // so this getter is used to render the correct view, if it's possible to preview the room right now
66- get previewPossible ( ) {
67- return this . _worldReadable && ! ! this . _room ;
68- }
69-
70- get checkingPreviewCapability ( ) {
71- return this . _checkingPreviewCapability ;
72- }
73-
7455 get kind ( ) {
75- return this . _worldReadable ? "worldReadableRoom" : "unknown" ;
76- }
77-
78- get timelineViewModel ( ) {
79- return this . _timelineVM ;
80- }
81-
82- avatarUrl ( size ) {
83- return getAvatarHttpUrl ( this . _room . avatarUrl , size , this . platform , this . _room . mediaRepository ) ;
84- }
85-
86- async load ( ) {
87- this . _checkingPreviewCapability = true ;
88- this . _worldReadable = await this . _session . isWorldReadableRoom ( this . roomIdOrAlias ) ;
89- this . _checkingPreviewCapability = false ;
90-
91- if ( ! this . _worldReadable ) {
92- this . emitChange ( "checkingPreviewCapability" ) ;
93- return ;
94- }
95-
96- try {
97- this . _room = await this . _session . loadWorldReadableRoom ( this . roomIdOrAlias ) ;
98- const timeline = await this . _room . openTimeline ( ) ;
99- this . _tileOptions = this . childOptions ( {
100- roomVM : this ,
101- timeline,
102- tileClassForEntry : defaultTileClassForEntry ,
103- } ) ;
104- this . _timelineVM = this . track ( new TimelineViewModel ( this . childOptions ( {
105- tileOptions : this . _tileOptions ,
106- timeline,
107- } ) ) ) ;
108- this . emitChange ( "timelineViewModel" ) ;
109- } catch ( err ) {
110- console . error ( `room.openTimeline(): ${ err . message } :\n${ err . stack } ` ) ;
111- this . _timelineError = err ;
112- this . emitChange ( "error" ) ;
113- }
114- }
115-
116- dispose ( ) {
117- super . dispose ( ) ;
118- void this . _session . deleteWorldReadableRoomData ( this . roomIdOrAlias ) ;
56+ return "unknown" ;
11957 }
12058}
0 commit comments