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
6391cc08
Commit
6391cc08
authored
Mar 31, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename applyUserSettings to applySiteSettings
parent
030c26a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
spec/utils.js
spec/utils.js
+3
-3
src/headless/converse-core.js
src/headless/converse-core.js
+2
-2
src/headless/utils/core.js
src/headless/utils/core.js
+2
-2
No files found.
spec/utils.js
View file @
6391cc08
...
...
@@ -6,7 +6,7 @@
return
describe
(
"
Converse.js Utilities
"
,
function
()
{
it
(
"
apply
User
Settings: recursively applies user settings
"
,
function
()
{
it
(
"
apply
Site
Settings: recursively applies user settings
"
,
function
()
{
var
context
=
{};
var
settings
=
{
show_toolbar
:
true
,
...
...
@@ -37,7 +37,7 @@
'
invalid
'
:
false
}
};
utils
.
apply
User
Settings
(
context
,
settings
,
user_settings
);
utils
.
apply
Site
Settings
(
context
,
settings
,
user_settings
);
expect
(
context
.
something_else
).
toBeUndefined
();
expect
(
context
.
show_toolbar
).
toBeFalsy
();
...
...
@@ -56,7 +56,7 @@
'
toggle_occupants
'
:
true
}
};
utils
.
apply
User
Settings
(
context
,
settings
,
user_settings
);
utils
.
apply
Site
Settings
(
context
,
settings
,
user_settings
);
expect
(
_
.
keys
(
context
.
visible_toolbar_buttons
)).
toEqual
(
_
.
keys
(
settings
.
visible_toolbar_buttons
));
expect
(
context
.
visible_toolbar_buttons
.
toggle_occupants
).
toBeTruthy
();
});
...
...
src/headless/converse-core.js
View file @
6391cc08
...
...
@@ -533,7 +533,7 @@ const api = _converse.api = {
update
(
settings
)
{
u
.
merge
(
DEFAULT_SETTINGS
,
settings
);
u
.
merge
(
_converse
,
settings
);
u
.
apply
UserSettings
(
_converse
,
settings
,
_converse
.
user
_settings
);
u
.
apply
SiteSettings
(
_converse
,
settings
,
_converse
.
site
_settings
);
},
/**
...
...
@@ -1594,7 +1594,7 @@ function initSettings (settings) {
// Allow only whitelisted configuration attributes to be overwritten
assignIn
(
_converse
.
settings
,
pick
(
settings
,
Object
.
keys
(
DEFAULT_SETTINGS
)));
assignIn
(
_converse
,
_converse
.
settings
);
_converse
.
user_settings
=
settings
;
// XXX: See whether _converse can be removed
_converse
.
site_settings
=
settings
;
}
...
...
src/headless/utils/core.js
View file @
6391cc08
...
...
@@ -235,7 +235,7 @@ u.merge = function merge (first, second) {
}
};
u
.
apply
UserSettings
=
function
applyUser
Settings
(
context
,
settings
,
user_settings
)
{
u
.
apply
SiteSettings
=
function
applySite
Settings
(
context
,
settings
,
user_settings
)
{
/* Configuration settings might be nested objects. We only want to
* add settings which are whitelisted.
*/
...
...
@@ -244,7 +244,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin
continue
;
}
if
(
isObject
(
settings
[
k
])
&&
!
Array
.
isArray
(
settings
[
k
]))
{
apply
User
Settings
(
context
[
k
],
settings
[
k
],
user_settings
[
k
]);
apply
Site
Settings
(
context
[
k
],
settings
[
k
],
user_settings
[
k
]);
}
else
{
context
[
k
]
=
user_settings
[
k
];
}
...
...
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