From 955310b759dbcd8b423d4d9290d74ba8e6917f56 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 15 Mar 2024 15:52:20 +1300 Subject: [PATCH] Set sim power a little bit better I should probably change this to use kstate. --- d2m/actions/register-user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/d2m/actions/register-user.js b/d2m/actions/register-user.js index 68b1a887..6b688d46 100644 --- a/d2m/actions/register-user.js +++ b/d2m/actions/register-user.js @@ -198,7 +198,8 @@ async function syncUser(user, member, channel, guild, roomID) { // Update power levels const powerLevelsStateContent = await api.getStateEvent(roomID, "m.room.power_levels", "") mixin(powerLevelsStateContent, {users: {[mxid]: powerLevel}}) - api.sendState(roomID, "m.room.power_levels", "", powerLevelsStateContent) + if (powerLevel === 0) delete powerLevelsStateContent.users[mxid] // keep the event compact + await api.sendState(roomID, "m.room.power_levels", "", powerLevelsStateContent) // Update cached hash db.prepare("UPDATE sim_member SET hashed_profile_content = ? WHERE room_id = ? AND mxid = ?").run(currentHash, roomID, mxid) }