gui: Avoid spurious comma in shared-with device list (fixes #8967) (#8970)

This commit is contained in:
Jakob Borg 2023-07-07 07:25:24 +02:00 committed by GitHub
parent 25ec2b63ab
commit 6ff5ed6d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -555,8 +555,8 @@
<tr>
<th><span class="fas fa-fw fa-share-alt"></span>&nbsp;<span translate>Shared With</span></th>
<td class="text-right no-overflow-ellipse word-break-all">
<span ng-repeat="device in folder.devices">
<span ng-if="device.deviceID != myID" ng-switch="completion[device.deviceID][folder.id].remoteState">
<span ng-repeat="device in otherDevices(folder.devices)">
<span ng-switch="completion[device.deviceID][folder.id].remoteState">
<span ng-switch-when="notSharing" data-original-title="{{'The remote device has not accepted sharing this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>1</sup><span ng-if="!$last">,</span></span>
<span ng-switch-when="paused" data-original-title="{{'The remote device has paused this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>2</sup><span ng-if="!$last">,</span></span>
<span ng-switch-default>{{deviceName(devices[device.deviceID])}}<span ng-if="!$last">,</span></span>

View File

@ -1892,8 +1892,11 @@ angular.module('syncthing.core')
}
};
$scope.otherDevices = function () {
return $scope.deviceList().filter(function (n) {
$scope.otherDevices = function (devices) {
if (devices === undefined) {
devices = $scope.deviceList();
}
return devices.filter(function (n) {
return n.deviceID !== $scope.myID;
});
};