mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Allow the user to open a privat channel
This commit is contained in:
parent
8279759294
commit
476954fe8d
@ -490,60 +490,64 @@ Rebuild the userlist based on the given `users`.
|
|||||||
foundUsers = { }
|
foundUsers = { }
|
||||||
|
|
||||||
for user in users
|
for user in users
|
||||||
id = "timsChatUser#{user.userID}"
|
do (user) ->
|
||||||
|
id = "timsChatUser#{user.userID}"
|
||||||
|
|
||||||
Move the user to the new position if he was found in the old list.
|
Move the user to the new position if he was found in the old list.
|
||||||
|
|
||||||
if $.wcfIsset id
|
if $.wcfIsset id
|
||||||
console.log "Moving User: '#{user.username}'"
|
console.log "Moving User: '#{user.username}'"
|
||||||
element = $("##{id}").detach()
|
element = $("##{id}").detach()
|
||||||
|
|
||||||
if user.awayStatus?
|
if user.awayStatus?
|
||||||
element.addClass 'away'
|
element.addClass 'away'
|
||||||
element.attr 'title', user.awayStatus
|
element.attr 'title', user.awayStatus
|
||||||
else
|
else
|
||||||
element.removeClass 'away'
|
element.removeClass 'away'
|
||||||
element.removeAttr 'title'
|
element.removeAttr 'title'
|
||||||
element.data 'tooltip', ''
|
element.data 'tooltip', ''
|
||||||
|
|
||||||
if user.suspended
|
if user.suspended
|
||||||
element.addClass 'suspended'
|
element.addClass 'suspended'
|
||||||
else
|
else
|
||||||
element.removeClass 'suspended'
|
element.removeClass 'suspended'
|
||||||
|
|
||||||
$('#timsChatUserList > ul').append element
|
$('#timsChatUserList > ul').append element
|
||||||
|
|
||||||
Build HTML of the user and insert it into the list, if the users was not found in the chat before.
|
Build HTML of the user and insert it into the list, if the users was not found in the chat before.
|
||||||
|
|
||||||
else
|
else
|
||||||
console.log "Inserting User: '#{user.username}'"
|
console.log "Inserting User: '#{user.username}'"
|
||||||
li = $ '<li></li>'
|
li = $ '<li></li>'
|
||||||
li.attr 'id', id
|
li.attr 'id', id
|
||||||
li.addClass 'timsChatUser'
|
li.addClass 'timsChatUser'
|
||||||
li.addClass 'jsTooltip'
|
li.addClass 'jsTooltip'
|
||||||
li.addClass 'dropdown'
|
li.addClass 'dropdown'
|
||||||
li.addClass 'you' if user.userID is WCF.User.userID
|
li.addClass 'you' if user.userID is WCF.User.userID
|
||||||
li.addClass 'suspended' if user.suspended
|
li.addClass 'suspended' if user.suspended
|
||||||
if user.awayStatus?
|
if user.awayStatus?
|
||||||
li.addClass 'away'
|
li.addClass 'away'
|
||||||
li.attr 'title', user.awayStatus
|
li.attr 'title', user.awayStatus
|
||||||
li.data 'username', user.username
|
li.data 'username', user.username
|
||||||
|
|
||||||
li.append v.userTemplate.fetch user
|
li.append v.userTemplate.fetch user
|
||||||
|
|
||||||
menu = $ '<ul></ul>'
|
menu = $ '<ul></ul>'
|
||||||
menu.addClass 'dropdownMenu'
|
unless user.userID is WCF.User.userID
|
||||||
menu.append $ "<li><a>#{WCF.Language.get('chat.general.query')}</a></li>"
|
menu.append $("<li><a>#{WCF.Language.get('chat.general.query')}</a></li>").click -> openPrivateChannel user.userID
|
||||||
menu.append $ "<li><a>#{WCF.Language.get('chat.general.kick')}</a></li>"
|
menu.append $ "<li><a>#{WCF.Language.get('chat.general.kick')}</a></li>"
|
||||||
menu.append $ "<li><a>#{WCF.Language.get('chat.general.ban')}</a></li>"
|
menu.append $ "<li><a>#{WCF.Language.get('chat.general.ban')}</a></li>"
|
||||||
menu.append $ """<li><a href="#{user.link}">#{WCF.Language.get('chat.general.profile')}</a></li>"""
|
menu.append $ """<li><a href="#{user.link}">#{WCF.Language.get('chat.general.profile')}</a></li>"""
|
||||||
|
|
||||||
events.userMenu.fire user, menu
|
events.userMenu.fire user, menu
|
||||||
|
|
||||||
li.append menu
|
if menu.find('li').length
|
||||||
li.appendTo $ '#timsChatUserList > ul'
|
li.append menu
|
||||||
|
menu.addClass 'dropdownMenu'
|
||||||
|
|
||||||
foundUsers[id] = true
|
li.appendTo $ '#timsChatUserList > ul'
|
||||||
|
|
||||||
|
foundUsers[id] = true
|
||||||
|
|
||||||
Remove all users that left the chat.
|
Remove all users that left the chat.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user