Take into account creators when checking power levels #44

Merged
Henry-Hiles merged 2 commits from istalri/nexus:creator-power-level-infinite into main 2026-06-17 23:16:52 -04:00
Member

Fixes #40

@Henry-Hiles I hope this works could not really test to full extent since I am not a user with a big power level. I created my own room to test if I get power level null(infinite) and it worked.

Fixes #40 @Henry-Hiles I hope this works could not really test to full extent since I am not a user with a big power level. I created my own room to test if I get power level null(infinite) and it worked.
Henry-Hiles requested changes 2026-06-15 15:38:52 -04:00
Dismissed
@ -38,3 +43,3 @@
content.users[userId] ?? content.usersDefault;
final userLevel = powerLevelOf(user);
//Creators get power level infinite, here marked with null
Owner

Also when you leave comments please put a space between // and the first word :)

Also when you leave comments please put a space between `//` and the first word :)
istalri marked this conversation as resolved
@ -40,1 +45,3 @@
final userLevel = powerLevelOf(user);
//Creators get power level infinite, here marked with null
final userLevel = roomCreators?.contains(user) == true
? null
Owner

Better to set this to double.infinity. Then you shouldn't need to touch the logic below.

Better to set this to `double.infinity`. Then you shouldn't need to touch the logic below.
istalri marked this conversation as resolved
@ -0,0 +22,4 @@
return switch (createEventContent?.additionalCreatorIds) {
IList<String> creators => creators.add(createEvent.sender),
_ => [createEvent.sender].toIList(),
Owner

A little cleaner:

- [createEvent.sender].toIList()
+ .new([createEvent.sender])
A little cleaner: ```diff - [createEvent.sender].toIList() + .new([createEvent.sender]) ```
istalri marked this conversation as resolved
@ -97,3 +97,3 @@
);
}
}
}
Owner

Not sure what this change is about...

Not sure what this change is about...
Author
Member

Yeah no idea what that is. This looks like a bug in the diff tool to me. Or maybe some white space is different?

Yeah no idea what that is. This looks like a bug in the diff tool to me. Or maybe some white space is different?
Henry-Hiles changed title from WIP: Creator power level gets taken into account to Creator power level gets taken into account 2026-06-15 15:39:07 -04:00
Henry-Hiles requested changes 2026-06-15 15:42:27 -04:00
Dismissed
@ -0,0 +13,4 @@
final createRowId = room.state[EventType.create.type]?[""];
final createEvent = createRowId == null ? null : room.events[createRowId];
if (createEvent == null) return null;
Owner

I think it's best to make this function/controller/provider return IList<String>, and return a .new() instead of null.

I think it's best to make this function/controller/provider return `IList<String>`, and return a `.new()` instead of null.
istalri marked this conversation as resolved
istalri self-assigned this 2026-06-17 19:42:12 -04:00
double.infinity instead of null is clearer in it's intend
non nullable IList is also clearer
fix comment to reflect changes
Henry-Hiles changed title from Creator power level gets taken into account to Take into account creators when checking power levels 2026-06-17 23:08:33 -04:00
Henry-Hiles left a comment

LGTM

LGTM
Owner

Thanks for the contribution :)

Thanks for the contribution :)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Nexus/nexus!44
No description provided.