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
0e49ebf6
Commit
0e49ebf6
authored
May 21, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method to clarify that it's not simply an accessor
parent
d1d81bf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
src/headless/converse-muc.js
src/headless/converse-muc.js
+16
-5
No files found.
src/headless/converse-muc.js
View file @
0e49ebf6
...
...
@@ -324,7 +324,7 @@ converse.plugins.add('converse-muc', {
* @param { String } password - Optional password, if required by the groupchat.
*/
async
join
(
nick
,
password
)
{
nick
=
nick
?
nick
:
await
this
.
getNickname
(
);
nick
=
await
this
.
getAndPersistNickname
(
nick
);
if
(
!
nick
)
{
u
.
safeSave
(
this
,
{
'
connection_status
'
:
converse
.
ROOMSTATUS
.
NICKNAME_REQUIRED
});
return
this
;
...
...
@@ -848,17 +848,28 @@ converse.plugins.add('converse-muc', {
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
},
async
getNickname
()
{
let
nick
=
this
.
get
(
'
nick
'
);
/**
* Given a nick name, save it to the model state, otherwise, look
* for a server-side reserved nickname or default configured
* nickname and if found, persist that to the model state.
* @private
* @method _converse.ChatRoom#getAndPersistNickname
* @returns { promise } A promise which resolves with the nickname
*/
async
getAndPersistNickname
(
nick
)
{
nick
=
nick
||
this
.
get
(
'
nick
'
);
const
state
=
{
'
nick
'
:
nick
};
if
(
!
nick
)
{
try
{
nick
=
await
this
.
getReservedNick
();
this
.
save
({
'
reserved_nick
'
:
nick
,
'
nick
'
:
nick
},
{
'
silent
'
:
true
})
;
state
[
'
reserved_nick
'
]
=
nick
;
}
catch
(
e
)
{
nick
=
_converse
.
getDefaultMUCNickname
();
this
.
save
({
'
nick
'
:
nick
},
{
'
silent
'
:
true
});
}
finally
{
state
[
'
nick
'
]
=
nick
;
}
}
this
.
save
(
state
,
{
'
silent
'
:
true
});
return
nick
;
},
...
...
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