fix: channel role permissions fail with InvalidOperation for owners/admins
Fix: explicitly populate the server reference via
set_server_from_channel() before relying on server_ref().
Signed-off-by: bluecords <133072610+bluecords@users.noreply.github.com>
fix: allow true server owner to bypass rank check on channel role-permission overrides
The set_role_permissions route blocks editing a role's channel permission
overrides whenever role.rank <= the acting member's rank
(NotElevated), to prevent privilege-escalation loops.
However this check has no exemption for the server's true owner
(server.owner == user.id). If an owner has assigned themselves their
own top-level role (e.g. "Admin"/"Server Admin" - extremely common
since most server setups have the owner hold their highest role for
visible status/cosmetics), that role's rank is necessarily equal to
their own computed member rank, so the check incorrectly throws
NotElevated for the owner too - even though server owners by definition
outrank every role and every member, owner-held roles included.
This produces a confusing experience: the owner cannot edit channel-level
overrides for their own top role via the UI, with no clear explanation,
and may reasonably believe something is broken or their permissions are
miscconfigured (they aren't).
This adds a short-circuit: if the acting user is the server's owner,
skip the rank comparison entirely, matching how Stoat already treats
true ownership as an absolute bypass elsewhere in the permission system
(e.g. channel-visibility lockout cascades).
Signed-off-by: bluecords <133072610+bluecords@users.noreply.github.com>
fix: don't declare queues which seem to cause the backend to crash in prod
for now, these exchanges/queues/bindings will need to be declared manually. Hopefully the lapin rewrite will fix this.
Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com>
* fix: /bots/{bot}
Paths "/bots/{bot}" and "/bots/{target}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /channels/{group_id}/recipients/{member_id}
Paths "/channels/{group_id}/recipients/{member_id}" and "/channels/{target}/recipients/{member}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /channels/{channel_id}/webhook
Paths "/channels/{target}/webhooks" and "/channels/{channel_id}/webhooks" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /servers/{server_id}/members/{member_id}
Paths "/servers/{target}/members/{member}" and "/servers/{server}/members/{member}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
* fix: /custom/emoji/{emoji_id}
Paths "/custom/emoji/{id}" and "/custom/emoji/{emoji_id}" must not be equivalent.
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
---------
Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
Signed-off-by: Damocles <106018783+Damocles078@users.noreply.github.com>
* feat: implement time based message sweep on user ban
- Adds `delete_message_seconds` (0 to 7 days in seconds) to the ban request payload.
Signed-off-by: arsabutispik <ispik@ispik.dev>
* refactor: pass ulid conversion to database
Signed-off-by: arsabutispik <ispik@ispik.dev>
* fix: use COL constant instead of hardcoded string in error mapper
Signed-off-by: arsabutispik <ispik@ispik.dev>
* refactor: broadcast bulk delete events during ban sweep
Updates the `delete_messages_by_author_since` trait to return a
HashMap of deleted message IDs grouped by channel.
The MongoDB implementation now uses a two-step process: it first
runs a projected `find` query to gather the target `_id` and
`channel` fields, then executes the `delete_many` operation.
This allows the ban route to loop through the affected channels and
dispatch `EventV1::BulkMessageDelete` WebSocket events, ensuring
that the swept messages are instantly removed from the UI for
all connected clients.
Signed-off-by: arsabutispik <ispik@ispik.dev>
* refactor: optimize message deletion by using $group and aggregate
Signed-off-by: arsabutispik <ispik@ispik.dev>
* refactor: use with_type in query
Signed-off-by: arsabutispik <ispik@ispik.dev>
* refactor: abstract function to Message model and mark attachments as deleted
Signed-off-by: arsabutispik <ispik@ispik.dev>
---------
Signed-off-by: arsabutispik <ispik@ispik.dev>
Updates user-facing links to point to the new organization. Does not
update references in source code (user-agent, dependency references),
as they should be handled separately.
Signed-off-by: sinus-x <14353790+sinus-x@users.noreply.github.com>