killemov / Shift

A minimalistic approach to maximum control of your Transmission. (Web UI)

Home Page:https://forum.transmissionbt.com/viewtopic.php?f=8&t=12555

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Names not displayed for torrents that have labels

Shados opened this issue · comments

This change in the most-recent commit broke the display of names for any torrents labels:

Shift/shift.js

Lines 1600 to 1608 in 2e72390

function renderName( name, torrent, ignore, cell ) {
var s = ( torrent.isMagnet() ? "magnet#" + torrent.hashString + ": " : "" ) + name;
if( cell && torrent.labels && torrent.labels.length ) {
cell.insert( renderLabels( torrent.labels ) );
cell.insert( s );
return "";
}
return s;
}

Specifically, the return = ""; on line 1605 results in blanking out the name column for any torrents that have one or more labels set, due to updateElement() seeing that the "" returned from this doesn't match the cell.innerHTML, wherein it replaces the cell contents with "". Mixing imperative and functional behaviour in a single function has a tendency to lead to this kind of problem.

Without re-structuring the code, the simplest fix is to just replace line 1605 with return cell.innerHTML;, but this is a bit cursed.