Hide "Browse files" without the permission to list files

The channel menu (desktop) and channel sheet (Android) leave the entry out
when i_ft_file_browse_power is 0. Unlike move/kick/ban powers it is among the
needed permissions the server reports, and with it at 0 ftgetfilelist is
refused even where the channel needs no power (verified on a local 3.13.7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 21:02:45 +00:00
co-authored by Claude Opus 5.5
parent 801dfa39ab
commit d3731e297b
7 changed files with 26 additions and 7 deletions
@@ -637,6 +637,14 @@ public final class ServerSession {
return permits("b_virtualserver_token_list");
}
/**
* Whether the server lets us list channel files ({@code i_ft_file_browse_power}); offered while
* unknown. A channel may still need more power than we have, which only the server knows.
*/
public boolean canBrowseFiles() {
return permits("i_ft_file_browse_power");
}
/** Whether the server lets us upload an avatar ({@code i_client_max_avatar_filesize}); offered while unknown. */
public boolean canSetAvatar() {
return permits("i_client_max_avatar_filesize");
@@ -37,9 +37,11 @@ final class ChannelMenu {
menu.add(delete);
menu.addSeparator();
addSubscriptionItems(menu, channel, actions);
JMenuItem files = new JMenuItem("Browse files", Icons.of("FILETRANSFER"));
files.addActionListener(a -> actions.browseFiles(channel));
menu.add(files);
if (actions.canBrowseFiles()) {
JMenuItem files = new JMenuItem("Browse files", Icons.of("FILETRANSFER"));
files.addActionListener(a -> actions.browseFiles(channel));
menu.add(files);
}
return menu;
}
@@ -340,6 +340,11 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
return conn.isConnected();
}
@Override
public boolean canBrowseFiles() {
return tab.session().canBrowseFiles();
}
@Override
public void browseFiles(ChannelNode channel) {
if (!conn.canTransferFiles()) return;
@@ -81,6 +81,9 @@ public final class ServerTreePanel extends JPanel {
/** Whether the server is there to act on at all. */
boolean isConnected();
/** Whether we may list channel files at all. */
boolean canBrowseFiles();
/** Open the file repository browser for a channel. */
void browseFiles(ChannelNode channel);