Show the chatroom occupants JID in the tooltip

if you're allowed to see it.
This commit is contained in:
JC Brand 2017-02-19 00:57:06 +00:00
parent a6ca5aad35
commit 441f7a2a15
4 changed files with 18 additions and 12 deletions

View File

@ -17,6 +17,7 @@
- The chat room `description` is now shown in the heading, not the `subject`.
[jcbrand]
- Chat room features are shown in the sidebar. [jcbrand]
- Show the chat room occupant's JID in the tooltip (if you're allowed to see it). [jcbrand]
- Created a new non-core plugin `converse-muc-embedded` which embeds a single
chat room into a page. An example can be found at https://conversejs.org/demo/embedded.html
[jcbrand]

View File

@ -737,13 +737,14 @@
it("indicates moderators by means of a special css class and tooltip", mock.initConverse(function (_converse) {
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy');
var view = _converse.chatboxviews.get('lounge@localhost');
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
var presence = $pres({
to:'dummy@localhost/pda',
from:'lounge@localhost/moderatorman'
}).c('x').attrs({xmlns:'http://jabber.org/protocol/muc#user'})
.c('item').attrs({
affiliation: 'admin',
jid: name.replace(/ /g,'.').toLowerCase() + '@localhost',
jid: contact_jid,
role: 'moderator',
}).up()
.c('status').attrs({code:'110'}).nodeTree;
@ -754,7 +755,7 @@
expect($(occupant).first().text()).toBe("dummy");
expect($(occupant).last().text()).toBe("moderatorman");
expect($(occupant).last().attr('class').indexOf('moderator')).not.toBe(-1);
expect($(occupant).last().attr('title')).toBe('This user is a moderator. Click to mention this user in your message.');
expect($(occupant).last().attr('title')).toBe(contact_jid + ' This user is a moderator. Click to mention this user in your message.');
}));
it("will use the user's reserved nickname, if it exists", mock.initConverse(function (_converse) {

View File

@ -1941,12 +1941,13 @@
render: function () {
var new_el = _converse.templates.occupant(
_.extend(
this.model.toJSON(), {
'hint_occupant': __('Click to mention this user in your message.'),
'desc_moderator': __('This user is a moderator.'),
'desc_occupant': __('This user can send messages in this room.'),
'desc_visitor': __('This user can NOT send messages in this room.')
})
{ 'jid': '',
'hint_occupant': __('Click to mention this user in your message.'),
'desc_moderator': __('This user is a moderator.'),
'desc_occupant': __('This user can send messages in this room.'),
'desc_visitor': __('This user can NOT send messages in this room.')
}, this.model.toJSON()
)
);
var $parents = this.$el.parents();
if ($parents.length) {

View File

@ -1,10 +1,13 @@
<li class="{{{role}}} occupant" id="{{{id}}}"
<li class="{{{ role }}} occupant" id="{{{ id }}}"
{[ if (role === "moderator") { ]}
title="{{{desc_moderator}}} {{{hint_occupant}}}"
title="{{{ jid }}} {{{ desc_moderator }}} {{{ hint_occupant }}}"
{[ } ]}
{[ if (role === "occupant") { ]}
title="{{{desc_occupant}}} {{{hint_occupant}}}"
title="{{{ jid }}} {{{ desc_occupant }}} {{{ hint_occupant }}}"
{[ } ]}
{[ if (role === "visitor") { ]}
title="{{{desc_visitor}}} {{{hint_occupant}}}"
title="{{{ jid }}} {{{ desc_visitor }}} {{{ hint_occupant }}}"
{[ } ]}
{[ if (!_.includes(["visitor", "occupant", "moderator"], role)) { ]}
title="{{{ jid }}} {{{ hint_occupant }}}"
{[ } ]}>{{{nick}}}</li>