fix(torrents): ANONYMOUS showed in torrent users list

This commit is contained in:
OldHawk
2018-06-27 20:54:24 +08:00
parent ff4fb714f2
commit 67029706ff
2 changed files with 23 additions and 6 deletions

View File

@@ -1254,6 +1254,23 @@
}
};
/**
* isOwnerPeer
* @param t, torrent
* @returns {boolean}
*/
vm.isOwnerPeer = function (t, p) {
if (t) {
if (t.user._id === p.user._id) {
return true;
} else {
return false;
}
} else {
return false;
}
};
/**
* canEdit
* @returns {boolean}

View File

@@ -1096,9 +1096,9 @@
<tr class="torrent-list-info" ng-repeat="item in vm.seederPagedItems"
ng-if="item.peer_status == 'seeder'">
<td class="text-center">
<span ng-if="!vm.isOwner(vm.torrentLocalInfo)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwner(vm.torrentLocalInfo) && (!vm.torrentLocalInfo.isAnonymous || vm.user.isOper)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwner(vm.torrentLocalInfo) && (vm.torrentLocalInfo.isAnonymous && !vm.user.isOper)">{{ 'ANONYMOUS' | translate }}</span>
<span ng-if="!vm.isOwnerPeer(vm.torrentLocalInfo, item)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwnerPeer(vm.torrentLocalInfo, item) && (!vm.torrentLocalInfo.isAnonymous || vm.user.isOper)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwnerPeer(vm.torrentLocalInfo, item) && (vm.torrentLocalInfo.isAnonymous && !vm.user.isOper)">{{ 'ANONYMOUS' | translate }}</span>
<span ip-flag="item" class="peer-ip-flags" ip-class="ip-flags"></span>
<!--<span vip-flag="item.user"></span>-->
@@ -1148,9 +1148,9 @@
<tr class="torrent-list-info" ng-repeat="item in vm.leecherPagedItems"
ng-if="item.peer_status == 'leecher'">
<td class="text-center">
<span ng-if="!vm.isOwner(vm.torrentLocalInfo)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwner(vm.torrentLocalInfo) && (!vm.torrentLocalInfo.isAnonymous || vm.user.isOper)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwner(vm.torrentLocalInfo) && (vm.torrentLocalInfo.isAnonymous && !vm.user.isOper)">{{ 'ANONYMOUS' | translate }}</span>
<span ng-if="!vm.isOwnerPeer(vm.torrentLocalInfo, item)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwnerPeer(vm.torrentLocalInfo, item) && (!vm.torrentLocalInfo.isAnonymous || vm.user.isOper)" user-info="item.user" info-name></span>
<span ng-if="vm.isOwnerPeer(vm.torrentLocalInfo, item) && (vm.torrentLocalInfo.isAnonymous && !vm.user.isOper)">{{ 'ANONYMOUS' | translate }}</span>
<span ip-flag="item" class="peer-ip-flags" ip-class="ip-flags"></span>
<!--<span vip-flag="item.user"></span>-->