mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 07:30:41 +09:00
Live update roles on the user and role view pages
The user page set the role selector once and never updated it. The role page reset its whole form on every role update, wiping unsaved edits. Both pages now follow the live data and keep local edits on top. The role page stores only the edited fields and drops them once they match the role or when the viewer loses core.role.update. The user page syncs the selector while it is not dirty and drops deleted roles from a dirty selection. A role deleted while open now says so instead of "not found". Fixes #775, fixes #776 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fa2883d74e
commit
78f1e8a993
3 files changed
+93
-45
No files matched your search
@@ -52,6 +52,20 @@ describe("messages/controller", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("RoleDeleteRequest", function() {
|
||||
it("removes the role from users and sends a user update", async function() {
|
||||
const id = await controlConnection.handleRoleCreateRequest(new lib.RoleCreateRequest("r", "", []));
|
||||
const user = controller.users.getOrCreateUser("player");
|
||||
user.addRole(id);
|
||||
const updated = [];
|
||||
controller.users.records.on("update", users => updated.push(...users));
|
||||
await controlConnection.handleRoleDeleteRequest(new lib.RoleDeleteRequest(id));
|
||||
assert.equal(controller.roles.has(id), false);
|
||||
assert.equal(user.roleIds.has(id), false);
|
||||
assert(updated.some(u => u.name === "player" && !u.roleIds.has(id)), "no user update sent");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ControllerConfigGetRequest", function() {
|
||||
it("runs", async function() {
|
||||
const config = await controlConnection.handleControllerConfigGetRequest(
|
||||
|
||||
Reference in new issue
Block a user