Skip to content

Commit

Permalink
Merge pull request #297 from RocketChat/clear-window
Browse files Browse the repository at this point in the history
Clear window
  • Loading branch information
marceloschmidt committed Jul 13, 2015
2 parents 02bc97f + 6ac27a4 commit 2697347
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/lib/RoomHistoryManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#$('.messages-box .wrapper').data('previous-height', $('.messages-box .wrapper').get(0)?.scrollHeight - $('.messages-box .wrapper').get(0)?.scrollTop)
# ScrollListener.setLoader true
lastMessage = ChatMessageHistory.findOne({rid: rid}, {sort: {ts: 1}})
lastMessage ?= ChatMessage.findOne({rid: rid}, {sort: {ts: 1}})
# lastMessage ?= ChatMessage.findOne({rid: rid}, {sort: {ts: 1}})

if lastMessage?
ts = lastMessage.ts
Expand All @@ -46,7 +46,14 @@

return room.isLoading.get()

clear = (rid) ->
ChatMessageHistory.remove({ rid: rid })
if histories[rid]?
histories[rid].hasMore.set true
histories[rid].isLoading.set false
histories[rid].loaded = 0

getMore: getMore
hasMore: hasMore
isLoading: isLoading
clear: clear
5 changes: 5 additions & 0 deletions client/lib/chatMessages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@
event.preventDefault()
event.stopPropagation()

# ctrl (command) + shift + k -> clear room messages
else if k is 75 and ((navigator?.platform?.indexOf('Mac') isnt -1 and event.metaKey and event.shiftKey) or (navigator?.platform?.indexOf('Mac') is -1 and event.ctrlKey and event.shiftKey))
RoomHistoryManager.clear rid


# isScrollable: isScrollable
# toBottom: toBottom
keydown: keydown
Expand Down

0 comments on commit 2697347

Please sign in to comment.