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
531ebf33
Commit
531ebf33
authored
Apr 06, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly test and fix show/hide of MUC topic
parent
10da630d
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
138 additions
and
71 deletions
+138
-71
CHANGES.md
CHANGES.md
+1
-1
sass/_chatbox.scss
sass/_chatbox.scss
+2
-2
spec/bookmarks.js
spec/bookmarks.js
+3
-4
spec/muc.js
spec/muc.js
+95
-47
spec/xss.js
spec/xss.js
+1
-2
src/components/dropdown.js
src/components/dropdown.js
+0
-1
src/converse-bookmark-views.js
src/converse-bookmark-views.js
+2
-2
src/converse-minimize.js
src/converse-minimize.js
+2
-2
src/converse-muc-views.js
src/converse-muc-views.js
+11
-8
src/headless/converse-core.js
src/headless/converse-core.js
+21
-2
No files found.
CHANGES.md
View file @
531ebf33
...
...
@@ -18,6 +18,7 @@ Soon we'll deprecate the latter, so prepare now.
-
#1826: A user can now add himself as a contact
-
#1839: Headline messages are shown in controlbox
-
#1896: Don't send receipts for messages fetched from the archive
-
#1937: Editing a message removes the mentions highlight
-
Allow ignoring of bootstrap modules at build using environment variable. For xample:
`export BOOTSTRAP_IGNORE_MODULES="Modal,Dropdown" && make dist`
-
Bugfix. Handle stanza that clears the MUC subject
-
New config option
[
modtools_disable_assign
](
https://conversejs.org/docs/html/configuration.html#modtools-disable-assign
)
...
...
@@ -26,7 +27,6 @@ Soon we'll deprecate the latter, so prepare now.
-
Start using
[
lit-html
](
https://lit-html.polymer-project.org/
)
instead of lodash for templating.
-
[
muc_fetch_members
](
https://conversejs.org/docs/html/configuration.html#muc-fetch-members
)
now also accepts an array of affiliations to fetch.
-
Remove the configuration setting
`muc_show_join_leave_status`
. The optional status message is no longer shown at all.
-
#1937: Editing a message removes the mentions highlight
## 6.0.0 (2020-01-09)
...
...
sass/_chatbox.scss
View file @
531ebf33
...
...
@@ -57,10 +57,10 @@
font-size
:
var
(
--
font-size-small
);
margin
:
0
;
overflow
:
hidden
;
padding
:
0
.5rem
1rem
1
rem
1rem
;
padding
:
0
.5rem
1rem
0
.5
rem
1rem
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
width
:
100%
;
max-height
:
5em
;
}
.chatbox-title
{
...
...
spec/bookmarks.js
View file @
531ebf33
...
...
@@ -37,7 +37,7 @@
spyOn
(
view
,
'
renderBookmarkForm
'
).
and
.
callThrough
();
spyOn
(
view
,
'
closeForm
'
).
and
.
callThrough
();
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
)
!==
null
);
le
t
toggle
=
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
);
cons
t
toggle
=
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
);
expect
(
toggle
.
title
).
toBe
(
'
Bookmark this groupchat
'
);
toggle
.
click
();
expect
(
view
.
renderBookmarkForm
).
toHaveBeenCalled
();
...
...
@@ -130,10 +130,9 @@
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
await
u
.
waitUntil
(()
=>
view
.
model
.
get
(
'
bookmarked
'
));
toggle
=
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
));
expect
(
view
.
model
.
get
(
'
bookmarked
'
)).
toBeTruthy
();
expect
(
toggle
.
title
).
toBe
(
'
Unbookmark this groupchat
'
);
expect
(
u
.
hasClass
(
'
on-button
'
,
toggle
),
true
);
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
)?.
title
===
'
Unbookmark this groupchat
'
);
expect
(
u
.
hasClass
(
'
on-button
'
,
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
)
),
true
);
// We ignore this IQ stanza... (unless it's an error stanza), so
// nothing to test for here.
done
();
...
...
spec/muc.js
View file @
531ebf33
This diff is collapsed.
Click to expand it.
spec/xss.js
View file @
531ebf33
...
...
@@ -236,8 +236,7 @@
'
author
'
:
'
ralphm
'
}});
expect
(
sizzle
(
'
.chat-event:last
'
).
pop
().
textContent
.
trim
()).
toBe
(
'
Topic set by ralphm
'
);
const
desc
=
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-head__desc
'
));
expect
(
desc
.
textContent
.
trim
()).
toBe
(
subject
);
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-head__desc
'
)?.
textContent
.
trim
()
===
subject
);
done
();
}));
});
...
...
src/components/dropdown.js
View file @
531ebf33
...
...
@@ -8,7 +8,6 @@ import converse from "@converse/headless/converse-core";
const
u
=
converse
.
env
.
utils
;
export
class
Dropdown
extends
CustomElement
{
static
get
properties
()
{
...
...
src/converse-bookmark-views.js
View file @
531ebf33
...
...
@@ -36,9 +36,9 @@ converse.plugins.add('converse-bookmark-views', {
// plugin architecture they will replace existing methods on the
// relevant objects or classes.
ChatRoomView
:
{
async
getHeadingButtons
()
{
getHeadingButtons
()
{
const
{
_converse
}
=
this
.
__super__
;
const
buttons
=
await
this
.
__super__
.
getHeadingButtons
.
call
(
thi
s
);
const
buttons
=
this
.
__super__
.
getHeadingButtons
.
apply
(
this
,
argument
s
);
if
(
_converse
.
allow_bookmarks
)
{
const
supported
=
_converse
.
checkBookmarksSupport
();
const
bookmarked
=
this
.
model
.
get
(
'
bookmarked
'
);
...
...
src/converse-minimize.js
View file @
531ebf33
...
...
@@ -139,9 +139,9 @@ converse.plugins.add('converse-minimize', {
return
result
;
},
async
getHeadingButtons
()
{
getHeadingButtons
()
{
const
{
_converse
}
=
this
.
__super__
;
const
buttons
=
await
this
.
__super__
.
getHeadingButtons
.
call
(
thi
s
);
const
buttons
=
this
.
__super__
.
getHeadingButtons
.
apply
(
this
,
argument
s
);
const
data
=
{
'
a_class
'
:
'
toggle-chatbox-button
'
,
'
handler
'
:
ev
=>
this
.
minimize
(
ev
),
...
...
src/converse-muc-views.js
View file @
531ebf33
...
...
@@ -8,7 +8,7 @@ import "converse-modal";
import
"
@converse/headless/utils/muc
"
;
import
{
Model
}
from
'
skeletor.js/src/model.js
'
;
import
{
View
}
from
'
skeletor.js/src/view.js
'
;
import
{
head
,
isString
,
isUndefined
}
from
"
lodash
"
;
import
{
debounce
,
head
,
isString
,
isUndefined
}
from
"
lodash
"
;
import
{
BootstrapModal
}
from
"
./converse-modal.js
"
;
import
{
render
}
from
"
lit-html
"
;
import
{
__
}
from
'
@converse/headless/i18n
'
;
...
...
@@ -703,7 +703,10 @@ converse.plugins.add('converse-muc-views', {
this
.
listenTo
(
this
.
model
.
notifications
,
'
change
'
,
this
.
renderNotifications
);
this
.
listenTo
(
this
.
model
.
session
,
'
change:connection_status
'
,
this
.
onConnectionStatusChanged
);
this
.
listenTo
(
this
.
model
,
'
change
'
,
this
.
renderHeading
);
const
user_settings
=
_converse
.
api
.
user
.
settings
.
getModel
();
this
.
listenTo
(
user_settings
,
'
change:mucs_with_hidden_subject
'
,
this
.
renderHeading
);
this
.
listenTo
(
this
.
model
,
'
change
'
,
debounce
(()
=>
this
.
renderHeading
(),
250
));
this
.
listenTo
(
this
.
model
,
'
change:hidden_occupants
'
,
this
.
updateOccupantsToggle
);
this
.
listenTo
(
this
.
model
,
'
change:subject
'
,
this
.
setChatRoomSubject
);
this
.
listenTo
(
this
.
model
,
'
configurationNeeded
'
,
this
.
getAndRenderConfigurationForm
);
...
...
@@ -1171,7 +1174,7 @@ converse.plugins.add('converse-muc-views', {
}
},
async
getHeadingButtons
(
)
{
getHeadingButtons
(
subject_hidden
)
{
const
buttons
=
[{
'
i18n_text
'
:
__
(
'
Details
'
),
'
i18n_title
'
:
__
(
'
Show more information about this groupchat
'
),
...
...
@@ -1227,9 +1230,6 @@ converse.plugins.add('converse-muc-views', {
});
}
const
muc_jid
=
this
.
model
.
get
(
'
jid
'
);
const
jids
=
await
api
.
user
.
settings
.
get
(
'
mucs_with_hidden_subject
'
,
[])
const
subject_hidden
=
jids
.
includes
(
muc_jid
);
const
subject
=
this
.
model
.
get
(
'
subject
'
);
if
(
subject
&&
subject
.
text
)
{
buttons
.
push
({
...
...
@@ -1238,7 +1238,7 @@ converse.plugins.add('converse-muc-views', {
__
(
'
Show the topic message in the heading
'
)
:
__
(
'
Hide the topic in the heading
'
),
'
handler
'
:
ev
=>
this
.
toggleTopic
(
ev
),
'
a_class
'
:
''
,
'
a_class
'
:
'
hide-topic
'
,
'
icon_class
'
:
'
fa-minus-square
'
,
'
name
'
:
'
toggle-topic
'
});
...
...
@@ -1268,12 +1268,15 @@ converse.plugins.add('converse-muc-views', {
* @method _converse.ChatRoomView#generateHeadingTemplate
*/
async
generateHeadingTemplate
()
{
const
heading_btns
=
await
this
.
getHeadingButtons
();
const
jids
=
await
api
.
user
.
settings
.
get
(
'
mucs_with_hidden_subject
'
,
[])
const
subject_hidden
=
jids
.
includes
(
this
.
model
.
get
(
'
jid
'
));
const
heading_btns
=
this
.
getHeadingButtons
(
subject_hidden
);
const
standalone_btns
=
heading_btns
.
filter
(
b
=>
b
.
standalone
);
const
dropdown_btns
=
heading_btns
.
filter
(
b
=>
!
b
.
standalone
);
return
tpl_chatroom_head
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
_converse
,
subject_hidden
,
'
dropdown_btns
'
:
dropdown_btns
.
map
(
b
=>
this
.
getHeadingDropdownItem
(
b
)),
'
standalone_btns
'
:
standalone_btns
.
map
(
b
=>
this
.
getHeadingStandaloneButton
(
b
)),
'
title
'
:
this
.
model
.
getDisplayName
(),
...
...
src/headless/converse-core.js
View file @
531ebf33
...
...
@@ -529,6 +529,16 @@ const api = _converse.api = {
* @memberOf _converse.api.user
*/
settings
:
{
/**
* Returns the user settings model. Useful when you want to listen for change events.
* @method _converse.api.user.settings.getModel
* @returns {Model}
* @example _converse.api.user.settings.getModel
*/
getModel
()
{
return
user_settings
;
},
/**
* Get the value of a particular user setting.
* @method _converse.api.user.settings.get
...
...
@@ -558,8 +568,13 @@ const api = _converse.api = {
*/
async
set
(
key
,
val
)
{
await
initUserSettings
();
const
o
=
isObject
(
key
)
?
key
:
{
key
:
val
};
return
user_settings
.
save
(
o
,
{
'
promise
'
:
true
});
if
(
isObject
(
key
))
{
return
user_settings
.
save
(
key
,
{
'
promise
'
:
true
});
}
else
{
const
o
=
{};
o
[
key
]
=
val
;
return
user_settings
.
save
(
o
,
{
'
promise
'
:
true
});
}
}
}
},
...
...
@@ -1086,6 +1101,10 @@ function clearSession () {
_converse
.
session
.
destroy
();
delete
_converse
.
session
;
}
if
(
_converse
.
shouldClearCache
())
{
const
model
=
_converse
.
api
.
user
.
settings
.
getModel
();
model
.
clear
();
}
/**
* Synchronouse event triggered once the user session has been cleared,
* for example when the user has logged out or when Converse has
...
...
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