mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Improve join function
- Prevent multiple join requests - Disable input during joining a room - Prevent joining the same room again (TODO: also prevent this on the server side)
This commit is contained in:
parent
8e0a07ab30
commit
ec937c15b5
@ -43,6 +43,7 @@ exposed by a function if necessary.
|
|||||||
available: {}
|
available: {}
|
||||||
|
|
||||||
hiddenTopics = {}
|
hiddenTopics = {}
|
||||||
|
isJoining = no
|
||||||
fileUploaded = no
|
fileUploaded = no
|
||||||
errorVisible = false
|
errorVisible = false
|
||||||
inputErrorHidingTimer = null
|
inputErrorHidingTimer = null
|
||||||
@ -840,7 +841,9 @@ Fetch the roomlist from the server and update it in the GUI.
|
|||||||
if window.history?.replaceState?
|
if window.history?.replaceState?
|
||||||
$('.timsChatRoom').click (event) ->
|
$('.timsChatRoom').click (event) ->
|
||||||
do event.preventDefault
|
do event.preventDefault
|
||||||
|
|
||||||
target = $ @
|
target = $ @
|
||||||
|
return if target.data('roomID') is roomList.active.roomID
|
||||||
|
|
||||||
window.history.replaceState {}, '', target.attr 'href'
|
window.history.replaceState {}, '', target.attr 'href'
|
||||||
|
|
||||||
@ -879,6 +882,11 @@ Shows an unrecoverable error with the given text.
|
|||||||
Joins a room.
|
Joins a room.
|
||||||
|
|
||||||
join = (roomID) ->
|
join = (roomID) ->
|
||||||
|
return if isJoining or roomID is roomList.active.roomID
|
||||||
|
isJoining = yes
|
||||||
|
|
||||||
|
do $('#timsChatInput').disable
|
||||||
|
|
||||||
loading = true
|
loading = true
|
||||||
new WCF.Action.Proxy
|
new WCF.Action.Proxy
|
||||||
autoSend: true
|
autoSend: true
|
||||||
@ -903,8 +911,12 @@ Joins a room.
|
|||||||
handleMessages roomList.active.messages
|
handleMessages roomList.active.messages
|
||||||
do getMessages
|
do getMessages
|
||||||
do refreshRoomList
|
do refreshRoomList
|
||||||
|
|
||||||
|
do $('#timsChatInput').enable().focus
|
||||||
failure: (data) ->
|
failure: (data) ->
|
||||||
showError WCF.Language.get 'chat.error.join', data
|
showError WCF.Language.get 'chat.error.join', data
|
||||||
|
after: ->
|
||||||
|
isJoining = no
|
||||||
|
|
||||||
Open private channel
|
Open private channel
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user