Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chatterbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
chatterbox
Commits
f97a4849
Commit
f97a4849
authored
2 years ago
by
RMidhunSuresh
Browse files
Options
Downloads
Patches
Plain Diff
Show a disabled view
parent
42f846d1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ui/views/ChatterboxView.ts
+12
-1
12 additions, 1 deletion
src/ui/views/ChatterboxView.ts
src/viewmodels/ChatterboxViewModel.ts
+22
-1
22 additions, 1 deletion
src/viewmodels/ChatterboxViewModel.ts
with
34 additions
and
2 deletions
src/ui/views/ChatterboxView.ts
+
12
−
1
View file @
f97a4849
...
...
@@ -38,7 +38,7 @@ export class ChatterboxView extends TemplateView<ChatterboxViewModel> {
),
t
.
mapView
(
(
vm
)
=>
vm
.
messageComposerViewModel
,
(
vm
)
=>
(
vm
?
new
MessageComposer
(
vm
)
:
n
ull
)
(
vm
)
=>
(
vm
.
kind
===
"
composer
"
?
new
MessageComposer
(
vm
)
:
n
ew
WaitingForOperatorJoinView
()
)
),
t
.
view
(
new
FooterView
(
vm
.
footerViewModel
)),
]);
...
...
@@ -65,3 +65,14 @@ class RoomHeaderView extends TemplateView<ChatterboxViewModel> {
]);
}
}
class
WaitingForOperatorJoinView
extends
TemplateView
{
render
(
t
)
{
return
t
.
div
({
className
:
"
WaitingForOperatorJoinView
"
},
[
t
.
div
({
className
:
"
FakeComposerContainer
"
},
[
t
.
span
(
"
Waiting for operator to join
"
),
t
.
div
({
className
:
"
loader
"
})]
)]
);
}
}
This diff is collapsed.
Click to expand it.
src/viewmodels/ChatterboxViewModel.ts
+
22
−
1
View file @
f97a4849
...
...
@@ -25,6 +25,7 @@ export class ChatterboxViewModel extends ViewModel {
super
(
options
);
this
.
_client
=
options
.
client
;
this
.
_loginPromise
=
options
.
loginPromise
;
this
.
emitOnRoomViewModelChange
=
this
.
emitOnRoomViewModelChange
.
bind
(
this
);
}
async
load
()
{
...
...
@@ -48,11 +49,17 @@ export class ChatterboxViewModel extends ViewModel {
tileClassForEntry
:
createCustomTileClassForEntry
(
this
.
_session
.
userId
),
})));
await
this
.
_roomViewModel
.
load
();
this
.
_roomViewModel
.
on
(
"
change
"
,
this
.
emitOnRoomViewModelChange
);
this
.
emitChange
(
"
roomViewModel
"
);
}
private
emitOnRoomViewModelChange
()
{
this
.
emitChange
(
"
roomViewModel
"
);
}
private
async
createRoomWithUserSpecifiedInConfig
()
{
const
userId
=
this
.
_options
.
config
[
"
invite_user
"
];
const
ownUserId
=
this
.
_session
.
userId
;
let
room
=
await
this
.
findPreviouslyCreatedRoom
();
if
(
room
)
{
// we already have a room with this user
...
...
@@ -67,6 +74,15 @@ export class ChatterboxViewModel extends ViewModel {
alias
:
undefined
,
avatar
:
undefined
,
invites
:
[
userId
],
powerLevelContentOverride
:
{
users
:
{
[
userId
]:
100
,
[
ownUserId
]:
60
},
events
:
{
"
m.room.message
"
:
80
,
}
},
});
const
roomStatusObservable
=
await
this
.
_session
.
observeRoomStatus
(
roomBeingCreated
.
id
);
await
roomStatusObservable
.
waitFor
(
status
=>
status
===
(
RoomStatus
.
BeingCreated
|
RoomStatus
.
Replaced
)).
promise
;
...
...
@@ -107,7 +123,7 @@ export class ChatterboxViewModel extends ViewModel {
return
promise
;
}
private
async
findPreviouslyCreatedRoom
():
Promise
<
string
|
null
>
{
private
async
findPreviouslyCreatedRoom
():
Promise
<
any
|
null
>
{
const
createdRoomId
=
await
this
.
platform
.
settingsStorage
.
getString
(
"
created-room-id
"
);
const
lastKnownInviteUserId
=
await
this
.
platform
.
settingsStorage
.
getString
(
"
invite-user
"
);
const
currentInviteUserId
=
this
.
_options
.
config
[
"
invite_user
"
];
...
...
@@ -117,6 +133,11 @@ export class ChatterboxViewModel extends ViewModel {
return
null
;
}
dispose
()
{
super
.
dispose
();
this
.
_roomViewModel
.
off
(
"
change
"
,
this
.
emitOnRoomViewModelChange
);
}
minimize
()
{
(
window
as
any
).
sendMinimizeToParent
();
this
.
navigation
.
push
(
"
minimize
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment