From faaffc9b6e2c0a2e1b80df7175adda9469d0c079 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Sun, 29 Nov 2015 20:49:54 +0300 Subject: [PATCH] Added grey muted badges --- app/js/directives.js | 27 +++++++++++++++++++++++++++ app/less/app.less | 3 +++ app/partials/desktop/dialog.html | 1 + app/partials/mobile/dialog.html | 1 + 4 files changed, 32 insertions(+) diff --git a/app/js/directives.js b/app/js/directives.js index e0a6656c..c5c0844a 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -2666,6 +2666,33 @@ angular.module('myApp.directives', ['myApp.filters']) } }) + .directive('myPeerMuted', function ($rootScope, NotificationsManager) { + + return { + link: link + }; + + function link ($scope, element, attrs) { + var peerID = $scope.$eval(attrs.myPeerMuted); + var className = attrs.mutedClass || 'muted'; + var unsubscribe = $rootScope.$on('notify_settings', function (e, data) { + if (data.peerID == peerID) { + updateClass(peerID, element, className); + } + }); + updateClass(peerID, element, className); + + $scope.$on('$destroy', unsubscribe); + } + + function updateClass (peerID, element, className) { + NotificationsManager.getPeerMuted(peerID).then(function (muted) { + element.toggleClass(className, muted); + }); + } + }) + + .directive('myPeerLink', function (AppChatsManager, AppUsersManager) { return { diff --git a/app/less/app.less b/app/less/app.less index 4757e77e..254b32b3 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -1243,6 +1243,9 @@ a.im_dialog_selected { .im_dialogs_modal_col & { display: none; } + &_muted { + background: #ccc; + } } .im_dialog_unread { diff --git a/app/partials/desktop/dialog.html b/app/partials/desktop/dialog.html index 0625b939..f0db91e4 100644 --- a/app/partials/desktop/dialog.html +++ b/app/partials/desktop/dialog.html @@ -6,6 +6,7 @@ class="im_dialog_badge badge" ng-show="dialogMessage.unreadCount > 0 && !dialogMessage.pFlags.out" ng-bind="dialogMessage.unreadCount" + my-peer-muted="dialogMessage.peerID" muted-class="im_dialog_badge_muted" >