Changeset 14508


Ignore:
Timestamp:
Apr 22, 2015, 8:36:28 PM (6 years ago)
Author:
mikedld
Message:

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 ".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/javascript/inspector.js

    r14312 r14508  
    423423                    mixed_date = true;
    424424            }
     425            var empty_creator = !creator || !creator.length,
     426                empty_date = !date;
    425427            if(mixed_creator && mixed_date)
    426428                str = mixed;
    427             else if(!creator.length && !date)
     429            else if(empty_creator && empty_date)
    428430                str = unknown;
    429             else if(mixed_date && creator.length)
     431            else if((mixed_date || empty_date) && !empty_creator)
    430432                str = 'Created by ' + creator;
    431             else if(mixed_creator && date)
     433            else if((mixed_creator || empty_creator) && !empty_date)
    432434                str = 'Created on ' + (new Date(date*1000)).toDateString();
    433435            else
Note: See TracChangeset for help on using the changeset viewer.