fix: missing date-added field in web torrent inspector (#5386)

This commit is contained in:
Charles Kerr 2023-04-13 12:01:34 -05:00 committed by GitHub
parent 8dbf40613a
commit ce316309e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -115,6 +115,7 @@ export class Inspector extends EventTarget {
['hash', 'Hash:'],
['privacy', 'Privacy:'],
['origin', 'Origin:'],
['dateAdded', 'Date added:'],
['magnetLink', 'Magnet:'],
['comment', 'Comment:'],
['labels', 'Labels:'],
@ -541,6 +542,18 @@ export class Inspector extends EventTarget {
}
setTextContent(e.info.location, string);
// dateAdded
if (torrents.length === 0) {
string = none;
} else {
const get = (t) => t.getDateAdded();
const first = get(torrents[0]);
string = torrents.every((t) => get(t) === first)
? new Date(first * 1000).toDateString()
: mixed;
}
setTextContent(e.info.dateAdded, string);
// magnetLink
if (torrents.length === 0) {
setTextContent(e.info.magnetLink, none);