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,
|
selectActions: false,
|
||||||
botActions: false,
|
botActions: false,
|
||||||
channelActions: false,
|
channelActions: false,
|
||||||
|
canReply: false,
|
||||||
|
canDelete: false,
|
||||||
actions: function () {
|
actions: function () {
|
||||||
return $scope.historyState.selectActions ? 'selected' : ($scope.historyState.botActions ? 'bot' : ($scope.historyState.channelActions ? 'channel' : false));
|
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.selectActions = false;
|
||||||
$scope.historyState.botActions = false;
|
$scope.historyState.botActions = false;
|
||||||
$scope.historyState.channelActions = false;
|
$scope.historyState.channelActions = false;
|
||||||
|
$scope.historyState.canDelete = false;
|
||||||
|
$scope.historyState.canReply = false;
|
||||||
$scope.historyState.missedCount = 0;
|
$scope.historyState.missedCount = 0;
|
||||||
$scope.historyState.skipped = false;
|
$scope.historyState.skipped = false;
|
||||||
$scope.state = {};
|
$scope.state = {};
|
||||||
@ -1203,23 +1207,30 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
var channel;
|
var channel;
|
||||||
if (peerID &&
|
if (peerID &&
|
||||||
AppPeersManager.isChannel(peerID) &&
|
AppPeersManager.isChannel(peerID) &&
|
||||||
(channel = AppChatsManager.getChat(-peerID)) &&
|
(channel = AppChatsManager.getChat(-peerID))) {
|
||||||
!channel.pFlags.creator &&
|
|
||||||
!channel.pFlags.editor) {
|
|
||||||
|
|
||||||
if (channel.pFlags.left) {
|
var canSend = channel.pFlags.creator || channel.pFlags.editor;
|
||||||
$scope.historyState.channelActions = 'join';
|
if (!canSend) {
|
||||||
} else {
|
if (channel.pFlags.left) {
|
||||||
if (!$scope.historyState.channelActions) {
|
$scope.historyState.channelActions = 'join';
|
||||||
$scope.historyState.channelActions = 'mute';
|
} 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) {
|
} else {
|
||||||
$scope.historyState.channelActions = muted ? 'unmute' : 'mute';
|
$scope.historyState.channelActions = false;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
$scope.historyState.canReply = canSend;
|
||||||
|
$scope.historyState.canDelete = canSend || channel.pFlags.moderator;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.historyState.channelActions = false;
|
$scope.historyState.channelActions = false;
|
||||||
|
$scope.historyState.canReply = true;
|
||||||
|
$scope.historyState.canDelete = true;
|
||||||
}
|
}
|
||||||
if (wasChannelActions != $scope.historyState.channelActions) {
|
if (wasChannelActions != $scope.historyState.channelActions) {
|
||||||
$scope.$broadcast('ui_panel_update');
|
$scope.$broadcast('ui_panel_update');
|
||||||
|
@ -158,8 +158,8 @@
|
|||||||
<div ng-switch-when="selected" class="im_edit_selected_actions" my-i18n>
|
<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-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_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_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" my-i18n="im_reply"></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>
|
<my-i18n-param name="count"><strong class="im_selected_count" ng-show="selectedCount > 0" ng-bind="selectedCount"></strong></my-i18n-param>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -127,8 +127,8 @@
|
|||||||
<div ng-switch-when="selected" class="im_edit_selected_actions" my-i18n>
|
<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-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_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_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" my-i18n="im_reply"></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>
|
<my-i18n-param name="count"><strong class="im_selected_count" ng-show="selectedCount > 0" ng-bind="selectedCount"></strong></my-i18n-param>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user