From facd3bfd2d664e6db34b2312e543bc5af74346d6 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 10 May 2017 16:35:18 +0300 Subject: [PATCH] Improved support for calls service messages --- app/js/locales/en-us.json | 8 ++++---- app/js/messages_manager.js | 25 +++++++++++++++++++++++ app/partials/desktop/message_service.html | 14 ++++++------- app/partials/desktop/short_message.html | 6 ++++++ app/partials/mobile/message_service.html | 14 ++++++------- 5 files changed, 47 insertions(+), 20 deletions(-) diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 4e84237a..58b92feb 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -359,10 +359,10 @@ "message_service_joined_by_link": "joined group via invite link", "message_service_joined": "joined the group", "message_service_pinned_message": "pinned «{message}»", - "message_service_phonecall_incoming": "Incoming Call {duration}", - "message_service_phonecall_outgoing": "Outgoing Call {duration}", - "message_service_phonecall_missed": "Missed Call {duration}", - "message_service_phonecall_canceled": "Canceled Call {duration}", + "message_service_phonecall_incoming": "Incoming Call", + "message_service_phonecall_outgoing": "Outgoing Call", + "message_service_phonecall_missed": "Missed Call", + "message_service_phonecall_canceled": "Canceled Call", "message_service_phonecall": "Phone call {duration}", "message_service_scored_game": "{scored} in {message}", "message_service_unsupported_action": "unsupported action {action}", diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index b837663b..ff042dc8 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -1356,6 +1356,14 @@ angular.module('myApp.services') case 'messageActionPhoneCall': delete apiMessage.fromID + apiMessage.action.type = + (apiMessage.pFlags.out ? 'out_' : 'in_') + + ( + apiMessage.action.reason._ == 'phoneCallDiscardReasonMissed' || + apiMessage.action.reason._ == 'phoneCallDiscardReasonBusy' + ? 'missed' + : 'ok' + ) break } if (migrateFrom && @@ -2777,6 +2785,23 @@ angular.module('myApp.services') case 'messageActionGameScore': notificationMessage = gameScorePluralize(message.action.score) break + + case 'messageActionPhoneCall': + switch (message.action.type) { + case 'out_missed': + notificationMessage = _('message_service_phonecall_canceled_raw') + break + case 'in_missed': + notificationMessage = _('message_service_phonecall_missed_raw') + break + case 'out_ok': + notificationMessage = _('message_service_phonecall_outgoing_raw') + break + case 'in_ok': + notificationMessage = _('message_service_phonecall_incoming_raw') + break + } + break } } diff --git a/app/partials/desktop/message_service.html b/app/partials/desktop/message_service.html index 586f8343..c48bf687 100644 --- a/app/partials/desktop/message_service.html +++ b/app/partials/desktop/message_service.html @@ -42,14 +42,12 @@ - - - - - - - - + + + + + + diff --git a/app/partials/desktop/short_message.html b/app/partials/desktop/short_message.html index 8c9ced3a..ff8f0faf 100644 --- a/app/partials/desktop/short_message.html +++ b/app/partials/desktop/short_message.html @@ -49,5 +49,11 @@ when="conversation_scored_X"> + + + + + + \ No newline at end of file diff --git a/app/partials/mobile/message_service.html b/app/partials/mobile/message_service.html index 32740485..8fe4ed18 100644 --- a/app/partials/mobile/message_service.html +++ b/app/partials/mobile/message_service.html @@ -42,14 +42,12 @@ - - - - - - - - + + + + + +