mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
Fix JS error on undefined creator during inspector update
Since torrents' info is fetched asynchronously, it may not yet be available when inspector updates. Account for possibly undefined creator. Refine logic used to construct torrent origin phrase to prevent results such as "Created by on <date>" or "Created by <creator> on ".
This commit is contained in:
parent
dc1eb80dca
commit
ea368388ed
1 changed files with 5 additions and 3 deletions
|
@ -422,13 +422,15 @@ function Inspector(controller) {
|
|||
if(date != t.getDateCreated())
|
||||
mixed_date = true;
|
||||
}
|
||||
var empty_creator = !creator || !creator.length,
|
||||
empty_date = !date;
|
||||
if(mixed_creator && mixed_date)
|
||||
str = mixed;
|
||||
else if(!creator.length && !date)
|
||||
else if(empty_creator && empty_date)
|
||||
str = unknown;
|
||||
else if(mixed_date && creator.length)
|
||||
else if((mixed_date || empty_date) && !empty_creator)
|
||||
str = 'Created by ' + creator;
|
||||
else if(mixed_creator && date)
|
||||
else if((mixed_creator || empty_creator) && !empty_date)
|
||||
str = 'Created on ' + (new Date(date*1000)).toDateString();
|
||||
else
|
||||
str = 'Created by ' + creator + ' on ' + (new Date(date*1000)).toDateString();
|
||||
|
|
Loading…
Reference in a new issue