Don't send a rename that changes nothing
Closing the inline editor without touching the name asked the server to rename us to the name we already hold, which it refuses with "nickname is already in use". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -119,6 +119,10 @@ public final class ServerTreePanel extends JScrollPane {
|
|||||||
@Override
|
@Override
|
||||||
public void valueForPathChanged(TreePath path, Object newValue) {
|
public void valueForPathChanged(TreePath path, Object newValue) {
|
||||||
String nickname = String.valueOf(newValue).trim();
|
String nickname = String.valueOf(newValue).trim();
|
||||||
|
Object edited = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
|
||||||
|
// The server answers a rename to the name already held with "nickname is
|
||||||
|
// already in use", so a field closed unchanged is simply left alone.
|
||||||
|
if (edited instanceof ClientEntry && nickname.equals(((ClientEntry) edited).nickname)) return;
|
||||||
if (!nickname.isEmpty()) actions.renameSelf(nickname);
|
if (!nickname.isEmpty()) actions.renameSelf(nickname);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user