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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user