mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-06 20:21:01 +01:00
feat(home): refresh new torrents and opened tickets status when torrent was reviewed or tickets was replied.
This commit is contained in:
@@ -154,6 +154,20 @@
|
||||
vm.getCountUnread();
|
||||
});
|
||||
|
||||
/**
|
||||
* new-torrents-changed
|
||||
*/
|
||||
$scope.$on('new-torrents-changed', function (event, args) {
|
||||
vm.getNewTorrentsCount();
|
||||
});
|
||||
|
||||
/**
|
||||
* opened-tickets-changed
|
||||
*/
|
||||
$scope.$on('opened-tickets-changed', function (event, args) {
|
||||
vm.getTicketsOpenedCount();
|
||||
});
|
||||
|
||||
/**
|
||||
* user-invitations-changed
|
||||
*/
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
.directive('torrentListItem', torrentListItem);
|
||||
|
||||
function torrentListItem() {
|
||||
var TorrentsItemController = ['$scope', '$state', 'TorrentGetInfoServices', 'ResourcesTagsServices', '$timeout', 'DownloadService', 'MeanTorrentConfig',
|
||||
var TorrentsItemController = ['$scope', '$rootScope', '$state', 'TorrentGetInfoServices', 'ResourcesTagsServices', '$timeout', 'DownloadService', 'MeanTorrentConfig',
|
||||
'TorrentsService', 'Authentication', 'NotifycationService', 'ModalConfirmService', '$translate', 'moment',
|
||||
function ($scope, $state, TorrentGetInfoServices, ResourcesTagsServices, $timeout, DownloadService, MeanTorrentConfig, TorrentsService, Authentication,
|
||||
function ($scope, $rootScope, $state, TorrentGetInfoServices, ResourcesTagsServices, $timeout, DownloadService, MeanTorrentConfig, TorrentsService, Authentication,
|
||||
NotifycationService, ModalConfirmService, $translate, moment) {
|
||||
var vm = this;
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
_torrentId: item._id
|
||||
}, function (res) {
|
||||
$scope.list[$scope.list.indexOf(item)] = res;
|
||||
$rootScope.$broadcast('new-torrents-changed');
|
||||
NotifycationService.showSuccessNotify('TORRENT_SETREVIEWED_SUCCESSFULLY');
|
||||
}, function (res) {
|
||||
NotifycationService.showErrorNotify(res.data.message, 'TORRENT_SETREVIEWED_ERROR');
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
.module('tickets')
|
||||
.controller('ViewMessageTicketController', ViewMessageTicketController);
|
||||
|
||||
ViewMessageTicketController.$inject = ['$scope', '$state', '$timeout', '$translate', 'Authentication', 'MessageTicketsService', 'ModalConfirmService', 'NotifycationService', 'marked',
|
||||
'DebugConsoleService', 'MeanTorrentConfig', '$filter', '$stateParams', 'Upload', 'localStorageService', '$compile'];
|
||||
ViewMessageTicketController.$inject = ['$scope', '$rootScope', '$state', '$timeout', '$translate', 'Authentication', 'MessageTicketsService', 'ModalConfirmService',
|
||||
'NotifycationService', 'marked', 'DebugConsoleService', 'MeanTorrentConfig', '$filter', '$stateParams', 'Upload', 'localStorageService', '$compile'];
|
||||
|
||||
function ViewMessageTicketController($scope, $state, $timeout, $translate, Authentication, MessageTicketsService, ModalConfirmService, NotifycationService, marked,
|
||||
mtDebug, MeanTorrentConfig, $filter, $stateParams, Upload, localStorageService, $compile) {
|
||||
function ViewMessageTicketController($scope, $rootScope, $state, $timeout, $translate, Authentication, MessageTicketsService, ModalConfirmService,
|
||||
NotifycationService, marked, mtDebug, MeanTorrentConfig, $filter, $stateParams, Upload, localStorageService, $compile) {
|
||||
var vm = this;
|
||||
vm.user = Authentication.user;
|
||||
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
|
||||
@@ -154,6 +154,7 @@
|
||||
vm.postReplyFields = {};
|
||||
vm.currentPage = Math.ceil(res._replies.length / vm.itemsPerPage);
|
||||
vm.ticket = res;
|
||||
$rootScope.$broadcast('opened-tickets-changed');
|
||||
vm.pageChanged();
|
||||
|
||||
$scope.$broadcast('show-errors-reset', 'vm.replyForm');
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
.module('torrents')
|
||||
.controller('TorrentsInfoController', TorrentsInfoController);
|
||||
|
||||
TorrentsInfoController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'Notification', 'TorrentsService',
|
||||
TorrentsInfoController.$inject = ['$scope', '$rootScope', '$state', '$stateParams', '$translate', 'Authentication', 'Notification', 'TorrentsService',
|
||||
'MeanTorrentConfig', 'DownloadService', '$sce', '$filter', 'CommentsService', 'ModalConfirmService', 'marked', 'Upload', '$timeout',
|
||||
'SubtitlesService', 'getStorageLangService', 'NotifycationService', 'DebugConsoleService', 'TorrentGetInfoServices', 'AlbumsService',
|
||||
'localStorageService', '$compile', 'SideOverlay', 'ResourcesTagsServices', 'CollectionsService', 'moment'];
|
||||
|
||||
function TorrentsInfoController($scope, $state, $stateParams, $translate, Authentication, Notification, TorrentsService, MeanTorrentConfig,
|
||||
function TorrentsInfoController($scope, $rootScope, $state, $stateParams, $translate, Authentication, Notification, TorrentsService, MeanTorrentConfig,
|
||||
DownloadService, $sce, $filter, CommentsService, ModalConfirmService, marked, Upload, $timeout, SubtitlesService,
|
||||
getStorageLangService, NotifycationService, mtDebug, TorrentGetInfoServices, AlbumsService,
|
||||
localStorageService, $compile, SideOverlay, ResourcesTagsServices, CollectionsService, moment) {
|
||||
@@ -191,6 +191,7 @@
|
||||
_torrentId: vm.torrentLocalInfo._id
|
||||
}, function (res) {
|
||||
vm.torrentLocalInfo = res;
|
||||
$rootScope.$broadcast('new-torrents-changed');
|
||||
NotifycationService.showSuccessNotify('TORRENT_SETREVIEWED_SUCCESSFULLY');
|
||||
}, function (res) {
|
||||
NotifycationService.showErrorNotify(res.data.message, 'TORRENT_SETREVIEWED_ERROR');
|
||||
|
||||
Reference in New Issue
Block a user