Changeset 36c279f


Ignore:
Timestamp:
May 26, 2018 9:47:30 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5feeffa
Parents:
f320746
Message:

i2psnark: Hide peers button if no peers on that page (ticket #2152)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    rf320746 r36c279f  
    496496        out.write("</th>\n<th class=\"snarkTorrentStatus\">");
    497497        if (_manager.util().connected() && !snarks.isEmpty()) {
    498             out.write(" <a href=\"" + _contextPath + '/');
    499             if (peerParam != null) {
    500                 // disable peer view
    501                 out.write(getQueryString(req, "", null, null));
    502                 out.write("\">");
    503                 tx = _t("Hide Peers");
    504                 out.write(toThemeImg("hidepeers", tx, tx));
    505             } else {
    506                 // enable peer view
    507                 out.write(getQueryString(req, "1", null, null));
    508                 out.write("\">");
    509                 tx = _t("Show Peers");
    510                 out.write(toThemeImg("showpeers", tx, tx));
    511             }
    512             out.write("</a>\n");
     498            boolean hasPeers = false;
     499            int end = Math.min(start + pageSize, snarks.size());
     500            for (int i = start; i < end; i++) {
     501                if (snarks.get(i).getPeerCount() > 0) {
     502                    hasPeers = true;
     503                    break;
     504                }
     505            }
     506            if (hasPeers) {
     507                out.write(" <a href=\"" + _contextPath + '/');
     508                if (peerParam != null) {
     509                    // disable peer view
     510                    out.write(getQueryString(req, "", null, null));
     511                    out.write("\">");
     512                    tx = _t("Hide Peers");
     513                    out.write(toThemeImg("hidepeers", tx, tx));
     514                } else {
     515                    // enable peer view
     516                    out.write(getQueryString(req, "1", null, null));
     517                    out.write("\">");
     518                    tx = _t("Show Peers");
     519                    out.write(toThemeImg("showpeers", tx, tx));
     520                }
     521                out.write("</a>\n");
     522            }
    513523        }
    514524        out.write("</th>\n<th colspan=\"2\" align=\"left\">");
  • history.txt

    rf320746 r36c279f  
    22 * /confignet: Reorganize (ticket #2217)
    33 * /configsidebar: Tag sections for translation; sort unselected sections by translated name
     4 * i2psnark:
     5   - Hide "0 Bps" if no peers (ticket #2152)
     6   - Hide peers button if no peers (ticket #2152)
     7   - Hide column 1 icon for peers (ticket #1996)
     8 * i2ptunnel: Retry accept after server socket closed (ticket #2003)
     9 * Jetty: Skip files with [] in default servlet listing
    410 * Router: Fix wrapper.config path in OOM message when installed as
    511   Debian package, but not running as a service (ticket #2223)
  • router/java/src/net/i2p/router/RouterVersion.java

    rf320746 r36c279f  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 13;
     21    public final static long BUILD = 14;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.