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
565283b8
Commit
565283b8
authored
Dec 17, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rosterview: Let the default chat state filter be `online`
Also replaced some lodash methods with native ones.
parent
03b7ae0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
src/converse-rosterview.js
src/converse-rosterview.js
+10
-12
No files found.
src/converse-rosterview.js
View file @
565283b8
...
@@ -200,7 +200,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -200,7 +200,7 @@ converse.plugins.add('converse-rosterview', {
this
.
set
({
this
.
set
({
'
filter_text
'
:
''
,
'
filter_text
'
:
''
,
'
filter_type
'
:
'
contacts
'
,
'
filter_type
'
:
'
contacts
'
,
'
chat_state
'
:
''
'
chat_state
'
:
'
online
'
});
});
},
},
});
});
...
@@ -242,9 +242,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -242,9 +242,7 @@ converse.plugins.add('converse-rosterview', {
changeChatStateFilter
(
ev
)
{
changeChatStateFilter
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
this
.
model
.
save
({
this
.
model
.
save
({
'
chat_state
'
:
this
.
el
.
querySelector
(
'
.state-type
'
).
value
});
'
chat_state
'
:
this
.
el
.
querySelector
(
'
.state-type
'
).
value
});
},
},
changeTypeFilter
(
ev
)
{
changeTypeFilter
(
ev
)
{
...
@@ -309,7 +307,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -309,7 +307,7 @@ converse.plugins.add('converse-rosterview', {
if
(
!
u
.
isVisible
(
this
.
el
))
{
return
this
;
}
if
(
!
u
.
isVisible
(
this
.
el
))
{
return
this
;
}
this
.
model
.
save
({
this
.
model
.
save
({
'
filter_text
'
:
''
,
'
filter_text
'
:
''
,
'
chat_state
'
:
''
'
chat_state
'
:
'
online
'
});
});
this
.
el
.
classList
.
add
(
'
hidden
'
);
this
.
el
.
classList
.
add
(
'
hidden
'
);
return
this
;
return
this
;
...
@@ -611,7 +609,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -611,7 +609,7 @@ converse.plugins.add('converse-rosterview', {
let
shown
=
0
;
let
shown
=
0
;
this
.
model
.
contacts
.
forEach
(
contact
=>
{
this
.
model
.
contacts
.
forEach
(
contact
=>
{
const
contact_view
=
this
.
get
(
contact
.
get
(
'
id
'
));
const
contact_view
=
this
.
get
(
contact
.
get
(
'
id
'
));
if
(
_
.
includes
(
contacts
,
contact
))
{
if
(
contacts
.
includes
(
contact
))
{
u
.
hideElement
(
contact_view
.
el
);
u
.
hideElement
(
contact_view
.
el
);
}
else
if
(
contact_view
.
mayBeShown
())
{
}
else
if
(
contact_view
.
mayBeShown
())
{
u
.
showElement
(
contact_view
.
el
);
u
.
showElement
(
contact_view
.
el
);
...
@@ -644,17 +642,17 @@ converse.plugins.add('converse-rosterview', {
...
@@ -644,17 +642,17 @@ converse.plugins.add('converse-rosterview', {
// When filtering by chat state, we still want to
// When filtering by chat state, we still want to
// show requesting contacts, even though they don't
// show requesting contacts, even though they don't
// have the state in question.
// have the state in question.
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
!
_
.
includes
(
c
.
presence
.
get
(
'
show
'
),
q
)
&&
!
c
.
get
(
'
requesting
'
));
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
!
c
.
presence
.
get
(
'
show
'
).
includes
(
q
)
&&
!
c
.
get
(
'
requesting
'
));
}
else
if
(
q
===
'
unread_messages
'
)
{
}
else
if
(
q
===
'
unread_messages
'
)
{
matches
=
this
.
model
.
contacts
.
filter
({
'
num_unread
'
:
0
});
matches
=
this
.
model
.
contacts
.
filter
({
'
num_unread
'
:
0
});
}
else
if
(
q
===
'
online
'
)
{
}
else
if
(
q
===
'
online
'
)
{
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
[
"
offline
"
,
"
unavailable
"
].
includes
(
c
.
presence
.
get
(
'
show
'
)));
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
[
"
offline
"
,
"
unavailable
"
].
includes
(
c
.
presence
.
get
(
'
show
'
)));
}
else
{
}
else
{
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
!
_
.
includes
(
c
.
presence
.
get
(
'
show
'
),
q
));
matches
=
this
.
model
.
contacts
.
filter
(
c
=>
!
c
.
presence
.
get
(
'
show
'
).
includes
(
q
));
}
}
}
else
{
}
else
{
matches
=
this
.
model
.
contacts
.
filter
((
contact
)
=>
{
matches
=
this
.
model
.
contacts
.
filter
((
contact
)
=>
{
return
!
_
.
includes
(
contact
.
getDisplayName
().
toLowerCase
(),
q
.
toLowerCase
());
return
!
contact
.
getDisplayName
().
toLowerCase
().
includes
(
q
.
toLowerCase
());
});
});
}
}
return
matches
;
return
matches
;
...
@@ -685,7 +683,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -685,7 +683,7 @@ converse.plugins.add('converse-rosterview', {
async
toggle
(
ev
)
{
async
toggle
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
const
icon_el
=
ev
.
target
.
matches
(
'
.fa
'
)
?
ev
.
target
:
ev
.
target
.
querySelector
(
'
.fa
'
);
const
icon_el
=
ev
.
target
.
matches
(
'
.fa
'
)
?
ev
.
target
:
ev
.
target
.
querySelector
(
'
.fa
'
);
if
(
_
.
includes
(
icon_el
.
classList
,
"
fa-caret-down
"
))
{
if
(
u
.
hasClass
(
"
fa-caret-down
"
,
icon_el
))
{
this
.
model
.
save
({
state
:
_converse
.
CLOSED
});
this
.
model
.
save
({
state
:
_converse
.
CLOSED
});
await
this
.
collapse
();
await
this
.
collapse
();
icon_el
.
classList
.
remove
(
"
fa-caret-down
"
);
icon_el
.
classList
.
remove
(
"
fa-caret-down
"
);
...
@@ -701,7 +699,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -701,7 +699,7 @@ converse.plugins.add('converse-rosterview', {
},
},
onContactGroupChange
(
contact
)
{
onContactGroupChange
(
contact
)
{
const
in_this_group
=
_
.
includes
(
contact
.
get
(
'
groups
'
),
this
.
model
.
get
(
'
name
'
));
const
in_this_group
=
contact
.
get
(
'
groups
'
).
includes
(
this
.
model
.
get
(
'
name
'
));
const
cid
=
contact
.
get
(
'
id
'
);
const
cid
=
contact
.
get
(
'
id
'
);
const
in_this_overview
=
!
this
.
get
(
cid
);
const
in_this_overview
=
!
this
.
get
(
cid
);
if
(
in_this_group
&&
!
in_this_overview
)
{
if
(
in_this_group
&&
!
in_this_overview
)
{
...
@@ -891,7 +889,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -891,7 +889,7 @@ converse.plugins.add('converse-rosterview', {
if
(
_
.
has
(
contact
.
changed
,
'
subscription
'
))
{
if
(
_
.
has
(
contact
.
changed
,
'
subscription
'
))
{
if
(
contact
.
changed
.
subscription
===
'
from
'
)
{
if
(
contact
.
changed
.
subscription
===
'
from
'
)
{
this
.
addContactToGroup
(
contact
,
_converse
.
HEADER_PENDING_CONTACTS
);
this
.
addContactToGroup
(
contact
,
_converse
.
HEADER_PENDING_CONTACTS
);
}
else
if
(
_
.
includes
([
'
both
'
,
'
to
'
],
contact
.
get
(
'
subscription
'
)))
{
}
else
if
(
[
'
both
'
,
'
to
'
].
includes
(
contact
.
get
(
'
subscription
'
)))
{
this
.
addExistingContact
(
contact
);
this
.
addExistingContact
(
contact
);
}
}
}
}
...
...
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