Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
7527aeba
Commit
7527aeba
authored
Mar 25, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorise out setUserStatus.
parent
d8db7567
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
static/galene.js
static/galene.js
+20
-16
No files found.
static/galene.js
View file @
7527aeba
...
@@ -2107,12 +2107,7 @@ function addUser(id, userinfo) {
...
@@ -2107,12 +2107,7 @@ function addUser(id, userinfo) {
let
user
=
document
.
createElement
(
'
div
'
);
let
user
=
document
.
createElement
(
'
div
'
);
user
.
id
=
'
user-
'
+
id
;
user
.
id
=
'
user-
'
+
id
;
user
.
classList
.
add
(
"
user-p
"
);
user
.
classList
.
add
(
"
user-p
"
);
user
.
textContent
=
userinfo
.
username
?
userinfo
.
username
:
'
(anon)
'
;
setUserStatus
(
id
,
user
,
userinfo
);
if
(
userinfo
.
data
.
raisehand
)
user
.
classList
.
add
(
'
user-status-raisehand
'
);
else
user
.
classList
.
remove
(
'
user-status-raisehand
'
);
user
.
addEventListener
(
'
click
'
,
function
(
e
)
{
user
.
addEventListener
(
'
click
'
,
function
(
e
)
{
let
elt
=
e
.
target
;
let
elt
=
e
.
target
;
if
(
!
elt
||
!
(
elt
instanceof
HTMLElement
))
if
(
!
elt
||
!
(
elt
instanceof
HTMLElement
))
...
@@ -2148,21 +2143,30 @@ function addUser(id, userinfo) {
...
@@ -2148,21 +2143,30 @@ function addUser(id, userinfo) {
div
.
appendChild
(
user
);
div
.
appendChild
(
user
);
}
}
/**
/**
* @param {string} id
* @param {string} id
* @param {user} userinfo
* @param {user} userinfo
*/
*/
function
changeUser
(
id
,
userinfo
)
{
function
changeUser
(
id
,
userinfo
)
{
let
user
=
document
.
getElementById
(
'
user-
'
+
id
);
let
elt
=
document
.
getElementById
(
'
user-
'
+
id
);
if
(
!
user
)
{
if
(
!
elt
)
{
console
.
warn
(
'
Unknown user
'
+
id
);
console
.
warn
(
'
Unknown user
'
+
id
);
return
;
return
;
}
}
user
.
textContent
=
userinfo
.
username
?
userinfo
.
username
:
'
(anon)
'
;
setUserStatus
(
id
,
elt
,
userinfo
);
if
(
userinfo
.
data
.
raisehand
)
}
user
.
classList
.
add
(
'
user-status-raisehand
'
);
/**
* @param {string} id
* @param {HTMLElement} elt
* @param {user} userinfo
*/
function
setUserStatus
(
id
,
elt
,
userinfo
)
{
elt
.
textContent
=
userinfo
.
username
?
userinfo
.
username
:
'
(anon)
'
;
if
(
userinfo
.
data
.
raisehand
)
elt
.
classList
.
add
(
'
user-status-raisehand
'
);
else
else
user
.
classList
.
remove
(
'
user-status-raisehand
'
);
elt
.
classList
.
remove
(
'
user-status-raisehand
'
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment