Saturday, September 26, 2026
2 changes · master
Code cleanup and technical improvements
The mail app now manages record-related background cleanup through a single shared lifecycle mechanism. This internal simplification reduces duplicated cleanup tracking and helps ensure records are properly cleared when the app shuts down, without changing user-facing behavior.
Original PR description
Before this commit, a record keeps the stop functions of its effects in the `disposeFns` set, while its scope already owns its computeds. There is no need for that set, as `scope.onDestroy` takes a stop function. This commit registers each stop function on the scope of the record and drops the set, so that a record has one owner for its computeds and its effects. Destroying the app destroys the scope of every record still in the store.
This change simplifies how Discuss channel members are created behind the scenes, removing a special internal shortcut and making the process more explicit. It should preserve the same user experience while reducing maintenance risk in the mail and Discuss area.
Original PR description
Before this commit, the channel create sets `_bypass_create_check` in its context, and discuss.channel.member.create sudoes itself when it finds that key. This is the only way to sudo members that the ORM creates as part of the channel create. This commit creates the members after the channel instead, with an explicit sudo, so the member create has no special case anymore. As the members do not exist yet when the channel is created, this commit also: - sets `member_indices` in the channel create, from the member values, instead of computing it from the members. - drops `is_member` from the create rule of discuss.channel (the write rule keeps it). That check never denied a create, since the current user is always added as member. - counts the members of a chat in the channel create, since `_constraint_partners_chat` only runs when `channel_member_ids` is written on the channel. task-4714913