Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 fixes on new conversations and removal #476

Merged
merged 3 commits into from
Dec 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/ui/dispatcher.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ handle 'init', (init) ->
require('./version').check()

handle 'chat_message', (ev) ->
# TODO entity is not fetched in usable time for first notification
# if does not have user on cache
entity.needEntity ev.sender_id.chat_id unless entity[ev.sender_id.chat_id]?
# add chat to conversation
conv.addChatMessage ev
# these messages are to go through notifications
notify.addToNotify ev
Expand Down Expand Up @@ -361,6 +365,8 @@ handle 'deleteconv', (confirmed) ->
action 'deleteconv', true
else
ipc.send 'deleteconversation', conv_id
viewstate.selectConvIndex(0)
viewstate.setState(viewstate.STATE_NORMAL)

handle 'leaveconv', (confirmed) ->
conv_id = viewstate.selectedConv
Expand All @@ -369,6 +375,7 @@ handle 'leaveconv', (confirmed) ->
action 'leaveconv', true
else
ipc.send 'removeuser', conv_id
viewstate.selectConvIndex(0)
viewstate.setState(viewstate.STATE_NORMAL)

handle 'lastkeydown', (time) -> viewstate.setLastKeyDown time
Expand Down Expand Up @@ -402,7 +409,12 @@ handle 'handlerecentconversations', (r) ->
connection.setEventState connection.IN_SYNC

handle 'client_conversation', (c) ->
conv.add c unless conv[c?.conversation_id?.id]
# Conversation must be added, even if already exists
# why? because when a new chat message for a new conversation appears
# a skeleton is made of a conversation
# If there is a problem with this change, then we should only merge
# when essential information is missing (ex. participant_data)
conv.add c

handle 'hangout_event', (e) ->
return unless e?.hangout_event?.event_type in ['START_HANGOUT', 'END_HANGOUT']
Expand Down
1 change: 0 additions & 1 deletion src/ui/views/convadd.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ module.exports = view (models) ->

if editing
div class:'leave', ->
console.log conversation
if conversation?.type?.indexOf('ONE_TO_ONE') > 0
div class:'button', title:'Delete conversation',
onclick:onclickaction('deleteconv'), ->
Expand Down