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
27378068
Commit
27378068
authored
Sep 07, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1064 /topic without argument sets topic to "undefined"
parent
572cc494
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
84 deletions
+53
-84
dist/converse.js
dist/converse.js
+27
-18
spec/chatroom.js
spec/chatroom.js
+2
-49
src/converse-muc-views.js
src/converse-muc-views.js
+18
-12
src/converse-muc.js
src/converse-muc.js
+5
-4
src/templates/chatroom_head.html
src/templates/chatroom_head.html
+1
-1
No files found.
dist/converse.js
View file @
27378068
...
...
@@ -68757,7 +68757,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
type: "groupchat"
}).c("subject", {
xmlns: "jabber:client"
}).t(match[2]).tree());
}).t(match[2]
|| ""
).tree());
break;
...
...
@@ -69428,19 +69428,25 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// For translators: the %1$s and %2$s parts will get
// replaced by the user and topic text respectively
// Example: Topic set by JC Brand to: Hello World!
const subject = this.model.get('subject');
const subject = this.model.get('subject'),
message = subject.text ? __('Topic set by %1$s', subject.author) : __('Topic cleared by %1$s', subject.author),
date = moment().format();
this.content.insertAdjacentHTML('beforeend', tpl_info({
'data': '',
'isodate':
moment().format()
,
'isodate':
date
,
'extra_classes': 'chat-event',
'message':
__('Topic set by %1$s', subject.author)
'message':
message
}));
if (subject.text) {
this.content.insertAdjacentHTML('beforeend', tpl_info({
'data': '',
'isodate': moment().format()
,
'isodate': date
,
'extra_classes': 'chat-topic',
'message': subject.text
}));
}
this.scrollDown();
}
...
...
@@ -70893,9 +70899,14 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
sender = resource && Strophe.unescapeNode(resource) || '';
if (!this.handleMessageCorrection(stanza)) {
const subject = _.propertyOf(stanza.querySelector('subject'))('textContent');
if (sender === '') {
return;
}
if (subject) {
const subject_el = stanza.querySelector('subject');
if (subject_el) {
const subject = _.propertyOf(subject_el)('textContent') || '';
u.safeSave(this, {
'subject': {
'author': sender,
...
...
@@ -70904,10 +70915,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
});
}
if (sender === '') {
return;
}
this.createMessage(stanza, original_stanza).then(msg => this.incrementUnreadMsgCounter(msg)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
...
...
@@ -78386,8 +78393,10 @@ __e( o.Strophe.getNodeFromJid(o.jid) ) +
__e( o.Strophe.getDomainFromJid(o.jid) ) +
'\n ';
} ;
__p += '\n </div>\n <p class="chatroom-description">' +
__e( o.description ) +
__p += '\n </div>\n <p class="chatroom-description" title="' +
__e(o.description) +
'">' +
__e(o.description) +
'<p/>\n</div>\n<div class="chatbox-buttons row no-gutters">\n <a class="chatbox-btn close-chatbox-button fa fa-sign-out-alt" title="' +
__e(o.info_close) +
'"></a>\n ';
spec/chatroom.js
View file @
27378068
...
...
@@ -770,54 +770,6 @@
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
}));
it
(
"
shows its description in the chat heading
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
function
(
done
,
_converse
)
{
let
sent_IQ
,
IQ_id
,
view
;
const
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQ
=
iq
;
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
_converse
.
api
.
rooms
.
open
(
'
coven@chat.shakespeare.lit
'
,
{
'
nick
'
:
'
some1
'
})
.
then
(()
=>
{
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
const
features_stanza
=
$iq
({
from
:
'
coven@chat.shakespeare.lit
'
,
'
id
'
:
IQ_id
,
'
to
'
:
'
dummy@localhost/desktop
'
,
'
type
'
:
'
result
'
})
.
c
(
'
query
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/disco#info
'
})
.
c
(
'
identity
'
,
{
'
category
'
:
'
conference
'
,
'
name
'
:
'
A Dark Cave
'
,
'
type
'
:
'
text
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_passwordprotected
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_hidden
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_temporary
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_open
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_unmoderated
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
muc_nonanonymous
'
}).
up
()
.
c
(
'
feature
'
,
{
'
var
'
:
'
urn:xmpp:mam:0
'
}).
up
()
.
c
(
'
x
'
,
{
'
xmlns
'
:
'
jabber:x:data
'
,
'
type
'
:
'
result
'
})
.
c
(
'
field
'
,
{
'
var
'
:
'
FORM_TYPE
'
,
'
type
'
:
'
hidden
'
})
.
c
(
'
value
'
).
t
(
'
http://jabber.org/protocol/muc#roominfo
'
).
up
().
up
()
.
c
(
'
field
'
,
{
'
type
'
:
'
text-single
'
,
'
var
'
:
'
muc#roominfo_description
'
,
'
label
'
:
'
Description
'
})
.
c
(
'
value
'
).
t
(
'
This is the description
'
).
up
().
up
()
.
c
(
'
field
'
,
{
'
type
'
:
'
text-single
'
,
'
var
'
:
'
muc#roominfo_occupants
'
,
'
label
'
:
'
Number of participants
'
})
.
c
(
'
value
'
).
t
(
0
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
features_stanza
));
return
test_utils
.
waitUntil
(()
=>
_
.
get
(
view
.
el
.
querySelector
(
'
.chatroom-description
'
),
'
textContent
'
))
}).
then
(
function
()
{
expect
(
view
.
el
.
querySelector
(
'
.chatroom-description
'
).
textContent
).
toBe
(
'
This is the description
'
);
done
();
});
}));
it
(
"
supports the /me command
"
,
mock
.
initConverseWithPromises
(
...
...
@@ -1600,7 +1552,7 @@
});
}));
it
(
"
shows
received groupchat subject messages
"
,
it
(
"
shows
the room topic in the header
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
...
...
@@ -1618,6 +1570,7 @@
var
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
expect
(
$
(
chat_content
).
find
(
'
.chat-event:last
'
).
text
()).
toBe
(
'
Topic set by ralphm
'
);
expect
(
$
(
chat_content
).
find
(
'
.chat-topic:last
'
).
text
()).
toBe
(
text
);
expect
(
view
.
el
.
querySelector
(
'
.chatroom-description
'
).
textContent
).
toBe
(
text
);
done
();
});
}));
...
...
src/converse-muc-views.js
View file @
27378068
...
...
@@ -991,7 +991,7 @@
to
:
this
.
model
.
get
(
'
jid
'
),
from
:
_converse
.
connection
.
jid
,
type
:
"
groupchat
"
}).
c
(
"
subject
"
,
{
xmlns
:
"
jabber:client
"
}).
t
(
match
[
2
]).
tree
()
}).
c
(
"
subject
"
,
{
xmlns
:
"
jabber:client
"
}).
t
(
match
[
2
]
||
""
).
tree
()
);
break
;
case
'
voice
'
:
...
...
@@ -1632,23 +1632,29 @@
// For translators: the %1$s and %2$s parts will get
// replaced by the user and topic text respectively
// Example: Topic set by JC Brand to: Hello World!
const
subject
=
this
.
model
.
get
(
'
subject
'
);
const
subject
=
this
.
model
.
get
(
'
subject
'
),
message
=
subject
.
text
?
__
(
'
Topic set by %1$s
'
,
subject
.
author
)
:
__
(
'
Topic cleared by %1$s
'
,
subject
.
author
),
date
=
moment
().
format
();
this
.
content
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_info
({
'
data
'
:
''
,
'
isodate
'
:
moment
().
format
()
,
'
isodate
'
:
date
,
'
extra_classes
'
:
'
chat-event
'
,
'
message
'
:
__
(
'
Topic set by %1$s
'
,
subject
.
author
)
'
message
'
:
message
}));
if
(
subject
.
text
)
{
this
.
content
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_info
({
'
data
'
:
''
,
'
isodate
'
:
moment
().
format
()
,
'
isodate
'
:
date
,
'
extra_classes
'
:
'
chat-topic
'
,
'
message
'
:
subject
.
text
}));
}
this
.
scrollDown
();
}
});
...
...
src/converse-muc.js
View file @
27378068
...
...
@@ -921,13 +921,14 @@
sender
=
resource
&&
Strophe
.
unescapeNode
(
resource
)
||
''
;
if
(
!
this
.
handleMessageCorrection
(
stanza
))
{
const
subject
=
_
.
propertyOf
(
stanza
.
querySelector
(
'
subject
'
))(
'
textContent
'
);
if
(
subject
)
{
u
.
safeSave
(
this
,
{
'
subject
'
:
{
'
author
'
:
sender
,
'
text
'
:
subject
}});
}
if
(
sender
===
''
)
{
return
;
}
const
subject_el
=
stanza
.
querySelector
(
'
subject
'
);
if
(
subject_el
)
{
const
subject
=
_
.
propertyOf
(
subject_el
)(
'
textContent
'
)
||
''
;
u
.
safeSave
(
this
,
{
'
subject
'
:
{
'
author
'
:
sender
,
'
text
'
:
subject
}});
}
this
.
createMessage
(
stanza
,
original_stanza
)
.
then
(
msg
=>
this
.
incrementUnreadMsgCounter
(
msg
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
...
...
src/templates/chatroom_head.html
View file @
27378068
...
...
@@ -7,7 +7,7 @@
{{{ o.Strophe.getNodeFromJid(o.jid) }}}@{{{ o.Strophe.getDomainFromJid(o.jid) }}}
{[ } ]}
</div>
<p
class=
"chatroom-description"
>
{{{ o.description
}}}
<p/>
<p
class=
"chatroom-description"
title=
"{{{o.description}}}"
>
{{{o.description
}}}
<p/>
</div>
<div
class=
"chatbox-buttons row no-gutters"
>
<a
class=
"chatbox-btn close-chatbox-button fa fa-sign-out-alt"
title=
"{{{o.info_close}}}"
></a>
...
...
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