Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5fe23f47
Commit
5fe23f47
authored
Feb 21, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modtools: Fetch affiliation list when we haven't fetched it by default
parent
2c5cde05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
src/converse-muc-views.js
src/converse-muc-views.js
+15
-1
src/headless/converse-muc.js
src/headless/converse-muc.js
+9
-5
No files found.
src/converse-muc-views.js
View file @
5fe23f47
...
...
@@ -237,7 +237,7 @@ converse.plugins.add('converse-muc-views', {
this
.
users_with_affiliation
=
null
;
this
.
render
();
const
affiliation
=
this
.
model
.
get
(
'
affiliation
'
);
if
(
!
_converse
.
muc_fetch_members
||
affiliation
===
'
outcast
'
)
{
if
(
this
.
shouldFetchAffiliationsList
()
)
{
this
.
users_with_affiliation
=
await
this
.
chatroomview
.
model
.
getAffiliationList
(
affiliation
);
}
else
{
this
.
users_with_affiliation
=
this
.
getUsersWithAffiliation
();
...
...
@@ -275,6 +275,20 @@ converse.plugins.add('converse-muc-views', {
}));
},
shouldFetchAffiliationsList
()
{
const
affiliation
=
this
.
model
.
get
(
'
affiliation
'
);
if
(
affiliation
===
'
none
'
)
{
return
false
;
}
const
chatroom
=
this
.
chatroomview
.
model
;
const
auto_fetched_affs
=
chatroom
.
occupants
.
getAutoFetchedAffiliationLists
();
if
(
auto_fetched_affs
.
includes
(
affiliation
))
{
return
false
;
}
else
{
return
true
;
}
},
toggleForm
(
ev
)
{
ev
.
stopPropagation
();
ev
.
preventDefault
();
...
...
src/headless/converse-muc.js
View file @
5fe23f47
...
...
@@ -2238,15 +2238,19 @@ converse.plugins.add('converse-muc', {
}
},
async
fetchMember
s
()
{
getAutoFetchedAffiliationList
s
()
{
const
affs
=
_converse
.
muc_fetch_members
;
const
all_affiliations
=
Array
.
isArray
(
affs
)
?
affs
:
(
affs
?
[
'
member
'
,
'
admin
'
,
'
owner
'
]
:
[]);
if
(
affs
.
length
===
0
)
{
return
Array
.
isArray
(
affs
)
?
affs
:
(
affs
?
[
'
member
'
,
'
admin
'
,
'
owner
'
]
:
[]);
},
async
fetchMembers
()
{
const
affiliations
=
this
.
getAutoFetchedAffiliationLists
();
if
(
affiliations
.
length
===
0
)
{
return
;
}
const
aff_lists
=
await
Promise
.
all
(
a
ll_a
ffiliations
.
map
(
a
=>
this
.
chatroom
.
getAffiliationList
(
a
)));
const
aff_lists
=
await
Promise
.
all
(
affiliations
.
map
(
a
=>
this
.
chatroom
.
getAffiliationList
(
a
)));
const
new_members
=
aff_lists
.
reduce
((
acc
,
val
)
=>
(
u
.
isErrorObject
(
val
)
?
acc
:
[...
val
,
...
acc
]),
[]);
const
known_affiliations
=
a
ll_affiliations
.
filter
(
a
=>
!
u
.
isErrorObject
(
aff_lists
[
all_
affiliations
.
indexOf
(
a
)]));
const
known_affiliations
=
a
ffiliations
.
filter
(
a
=>
!
u
.
isErrorObject
(
aff_lists
[
affiliations
.
indexOf
(
a
)]));
const
new_jids
=
new_members
.
map
(
m
=>
m
.
jid
).
filter
(
m
=>
m
!==
undefined
);
const
new_nicks
=
new_members
.
map
(
m
=>
!
m
.
jid
&&
m
.
nick
||
undefined
).
filter
(
m
=>
m
!==
undefined
);
const
removed_members
=
this
.
filter
(
m
=>
{
...
...
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