Browse Source

Fixed can delete and can reply in channels

master
Igor Zhukov 9 years ago
parent
commit
31827aed34
  1. 17
      app/js/controllers.js
  2. 4
      app/partials/desktop/im.html
  3. 4
      app/partials/mobile/im.html

17
app/js/controllers.js

@ -453,6 +453,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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']) @@ -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,10 +1207,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -1203,10 +1207,10 @@ 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))) {
var canSend = channel.pFlags.creator || channel.pFlags.editor;
if (!canSend) {
if (channel.pFlags.left) {
$scope.historyState.channelActions = 'join';
} else {
@ -1217,9 +1221,16 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -1217,9 +1221,16 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$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');

4
app/partials/desktop/im.html

@ -158,8 +158,8 @@ @@ -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 &amp;&amp; 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>

4
app/partials/mobile/im.html

@ -127,8 +127,8 @@ @@ -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 &amp;&amp; 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…
Cancel
Save