mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Add handling of maxUsers in be.bastelstu.Chat.litcoffee
This commit is contained in:
parent
45aa96376d
commit
d78df587f1
@ -970,13 +970,19 @@ Fetch the roomlist from the server and update it in the GUI.
|
||||
roomList.available[room.roomID] = room
|
||||
roomList.active = room if room.active
|
||||
|
||||
li = $ '<li></li>'
|
||||
li = $ '<li />'
|
||||
li.addClass 'timsChatRoom'
|
||||
li.addClass 'active' if room.active
|
||||
a = $("""<a href="#{room.link}">#{WCF.String.escapeHTML(room.title)}</a>""")
|
||||
a.data 'roomID', room.roomID
|
||||
a.appendTo li
|
||||
$("""<span class="badge">#{WCF.String.formatNumeric room.userCount}</span>""").appendTo li
|
||||
|
||||
span = $ '<span />'
|
||||
span.addClass 'badge'
|
||||
span.text WCF.String.formatNumeric room.userCount
|
||||
span.append " / #{WCF.String.formatNumeric room.maxUsers}" if room.maxUsers > 0
|
||||
|
||||
span.appendTo li
|
||||
$('#timsChatRoomList ul').append li
|
||||
|
||||
if window.history?.replaceState?
|
||||
@ -1036,6 +1042,7 @@ Joins a room.
|
||||
className: 'chat\\data\\room\\RoomAction'
|
||||
parameters:
|
||||
roomID: roomID
|
||||
suppressErrors: true
|
||||
success: (data) ->
|
||||
loading = false
|
||||
roomList.active = data.returnValues
|
||||
@ -1056,6 +1063,18 @@ Joins a room.
|
||||
|
||||
do $('#timsChatInput').enable().focus
|
||||
failure: (data) ->
|
||||
if data?.returnValues?.fieldName is 'room'
|
||||
isJoining = no
|
||||
loading = false
|
||||
|
||||
window.history.replaceState {}, '', roomList.active.link if window.history?.replaceState?
|
||||
|
||||
$('<div>').attr('id', 'timsChatJoinErrorDialog').append("<p>#{data.returnValues.errorType}</p>").wcfDialog
|
||||
title: WCF.Language.get 'wcf.global.error.title'
|
||||
|
||||
do $('#timsChatInput').enable().focus
|
||||
do refreshRoomList
|
||||
else
|
||||
showError WCF.Language.get 'chat.error.join', data
|
||||
after: ->
|
||||
isJoining = no
|
||||
|
Loading…
Reference in New Issue
Block a user