Fixed can delete and can reply in channels
This commit is contained in:
parent
0c11fc6a1f
commit
31827aed34
@ -453,6 +453,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
selectActions: false,
|
||||
botActions: false,
|
||||
channelActions: false,
|
||||
canReply: false,
|
||||
canDelete: false,
|
||||
actions: function () {
|
||||
return $scope.historyState.selectActions ? 'selected' : ($scope.historyState.botActions ? 'bot' : ($scope.historyState.channelActions ? 'channel' : false));
|
||||
},
|
||||
@ -1009,6 +1011,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
$scope.historyState.selectActions = false;
|
||||
$scope.historyState.botActions = false;
|
||||
$scope.historyState.channelActions = false;
|
||||
$scope.historyState.canDelete = false;
|
||||
$scope.historyState.canReply = false;
|
||||
$scope.historyState.missedCount = 0;
|
||||
$scope.historyState.skipped = false;
|
||||
$scope.state = {};
|
||||
@ -1203,23 +1207,30 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
var channel;
|
||||
if (peerID &&
|
||||
AppPeersManager.isChannel(peerID) &&
|
||||
(channel = AppChatsManager.getChat(-peerID)) &&
|
||||
!channel.pFlags.creator &&
|
||||
!channel.pFlags.editor) {
|
||||
(channel = AppChatsManager.getChat(-peerID))) {
|
||||
|
||||
if (channel.pFlags.left) {
|
||||
$scope.historyState.channelActions = 'join';
|
||||
} else {
|
||||
if (!$scope.historyState.channelActions) {
|
||||
$scope.historyState.channelActions = 'mute';
|
||||
var canSend = channel.pFlags.creator || channel.pFlags.editor;
|
||||
if (!canSend) {
|
||||
if (channel.pFlags.left) {
|
||||
$scope.historyState.channelActions = 'join';
|
||||
} else {
|
||||
if (!$scope.historyState.channelActions) {
|
||||
$scope.historyState.channelActions = 'mute';
|
||||
}
|
||||
NotificationsManager.getPeerMuted(peerID).then(function (muted) {
|
||||
$scope.historyState.channelActions = muted ? 'unmute' : 'mute';
|
||||
});
|
||||
}
|
||||
NotificationsManager.getPeerMuted(peerID).then(function (muted) {
|
||||
$scope.historyState.channelActions = muted ? 'unmute' : 'mute';
|
||||
});
|
||||
} else {
|
||||
$scope.historyState.channelActions = false;
|
||||
}
|
||||
$scope.historyState.canReply = canSend;
|
||||
$scope.historyState.canDelete = canSend || channel.pFlags.moderator;
|
||||
}
|
||||
else {
|
||||
$scope.historyState.channelActions = false;
|
||||
$scope.historyState.canReply = true;
|
||||
$scope.historyState.canDelete = true;
|
||||
}
|
||||
if (wasChannelActions != $scope.historyState.channelActions) {
|
||||
$scope.$broadcast('ui_panel_update');
|
||||
|
@ -158,8 +158,8 @@
|
||||
<div ng-switch-when="selected" class="im_edit_selected_actions" my-i18n>
|
||||
<a class="btn btn-md btn-md-primary im_edit_cancel_link" ng-click="selectedCancel()" my-i18n="modal_cancel"></a>
|
||||
<a class="btn btn-primary im_edit_forward_btn" ng-click="selectedForward()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_forward"></a>
|
||||
<a class="btn btn-primary im_edit_delete_btn" ng-click="selectedDelete()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_delete"></a>
|
||||
<a class="btn btn-primary im_edit_reply_btn" ng-click="selectedReply()" ng-show="selectedCount == 1" my-i18n="im_reply"></a>
|
||||
<a class="btn btn-primary im_edit_delete_btn" ng-click="selectedDelete()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_delete" ng-show="historyState.canDelete"></a>
|
||||
<a class="btn btn-primary im_edit_reply_btn" ng-click="selectedReply()" ng-show="selectedCount == 1 && historyState.canReply" my-i18n="im_reply"></a>
|
||||
<my-i18n-param name="count"><strong class="im_selected_count" ng-show="selectedCount > 0" ng-bind="selectedCount"></strong></my-i18n-param>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -127,8 +127,8 @@
|
||||
<div ng-switch-when="selected" class="im_edit_selected_actions" my-i18n>
|
||||
<a class="btn btn-md btn-md-primary im_edit_cancel_link" ng-click="selectedCancel()" my-i18n="modal_cancel"></a>
|
||||
<a class="btn btn-primary im_edit_forward_btn" ng-click="selectedForward()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_forward"></a>
|
||||
<a class="btn btn-primary im_edit_delete_btn" ng-click="selectedDelete()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_delete"></a>
|
||||
<a class="btn btn-primary im_edit_reply_btn" ng-click="selectedReply()" ng-show="selectedCount == 1" my-i18n="im_reply"></a>
|
||||
<a class="btn btn-primary im_edit_delete_btn" ng-click="selectedDelete()" ng-class="{disabled: !selectedCount}" ng-disabled="!selectedCount" my-i18n-format="im_delete" ng-show="historyState.canDelete"></a>
|
||||
<a class="btn btn-primary im_edit_reply_btn" ng-click="selectedReply()" ng-show="selectedCount == 1 && historyState.canReply" my-i18n="im_reply"></a>
|
||||
<my-i18n-param name="count"><strong class="im_selected_count" ng-show="selectedCount > 0" ng-bind="selectedCount"></strong></my-i18n-param>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user