gui: Fix undefined lastSeenDays error in disconnected-inactive status check (ref #8530) (#8730)

The current code assumes that lastSeenDays is always set which is not
the case when device reports its lastSeen as equal to the Unix epoch.
Thus, make sure that lastSeenDays is set before proceeding with the
disconnected-inactive status check to avoid JS errors in the browser.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
tomasz1986 2022-12-26 12:59:04 +01:00 committed by GitHub
parent 473ca68dc4
commit fb4209e382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1098,7 +1098,7 @@ angular.module('syncthing.core')
}
// Disconnected
if (!unused && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays >= 7) {
if (!unused && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays >= 7) {
return status + 'disconnected-inactive';
} else {
return status + 'disconnected';