Repository navigation
fix(huddl): copy only huddlz the actor can organize - #723
Merged
Merged
Conversation
<
8000
div data-view-component="true" class="TimelineItem-badge">
Copying a huddl fills the new one from its source, online link included. The source was read for anyone who could see it, and whether the actor organizes its group was left to the create policy. That policy runs after the copied values are already in the changeset, which a form renders back before anything is authorized. The copy now checks the role itself, before it takes anything from the source. A huddl the actor cannot organize is refused exactly like one that does not exist, through the form, JSON:API and GraphQL alike.
The new huddl form passed whatever the browser sent for the copied huddl and its cover straight to the create action, so a form opened empty could be turned into a copy afterwards. The huddl being copied is the one chosen when the form opened. The form now sets it itself on every change and on save, and drops what the browser sends for it.
- the new huddl form decides whether it is a copy, and of what, as it opens; a form opened empty stays empty when its address later names a huddl - the copy asks what the create policy asks: a confirmed email address as well as owning or organizing the source's group
The form read its copy source on its own terms (the huddl's group and whether the person can see it) while the copy asks for a confirmed organizer. It now asks the copy's own question before filling anything.
CopyFromHuddl read the source huddl with authorization disabled and checked email confirmation and the group role in separate queries. A role or link change landing between those queries could pair one moment's details with another moment's permission. Add an authorized :copy_source read on Huddl that asks for the huddl, its active group, the actor's confirmed address and their owner or organizer role in one statement, field policies included, so what is copied is what the actor could read when the copy was allowed.
…dl-links * origin/main: fix(api): accept only sign-in tokens on the GraphQL socket (#730) fix(huddl): tie organizer-only huddl details to the current role (#726) fix(groups): keep a group's address book with its organizers (#725) fix(discover): noindex empty filtered public discovery responses (#734)
The new huddl form read the huddl to copy and then validated the form as two separate answers. When the organizer lost the role between them the copy was refused, yet the form still opened with the huddl's details and online link, and an open form kept them after a later refusal. The form now reads the source through the copy's own :copy_source read and keeps it only while the form's latest validation names that huddl as its accepted source. A refused copy never reaches the socket as the form opens; on an open form, a refusal on validation, save or a location change starts the form over empty and says the huddl can no longer be copied. CopyFromHuddl.may_copy_from?/2 is gone: the read is the one rule.
A new huddl form stayed open with no message when its save was forbidden, which happens when the organizer loses the role while the form is open. For a copy whose role went between the save's check of the copy and the create's own authorization, the form went on showing the copied huddl. A forbidden save now leaves the form the way a forbidden visit does: back to the group with the "You don't have permission to create huddlz for this group" message.
The single copy-source statement is asserted to carry the online link's field policy, and a changeset is asserted to name its source only when the copy was accepted, which is what the new huddl form relies on.
A copy duplicated whatever cover its source had when the new huddl was saved, read without authorization after the create had been authorized and had locked the group. An organizer demoted in between, with the cover replaced in the same gap, still got the replacement on their copy. The :copy_source read now names the source's current cover in the same statement that allows the copy, and only that image is duplicated, even if the source has a newer cover by the time the copy is saved. A cover that no longer exists by then is left behind. Covered on separate database connections: the role and the cover change after the create is authorized and before it locks the group.
A new huddl form whose copy was refused started over empty on the server, but a browser keeps the value of the field that has keyboard focus through a re-render, so the title being typed in still held the copied title. The form that starts over now gives its fields ids of their own, so the browser replaces every field instead of patching it. Replacing the focused field drops keyboard focus, so the server names the field the change came from and the browser puts focus back in its replacement. Covered in Chromium: focus stays in the title through the validation that refuses the copy, and the title is then empty and still focused.
…dl-links * origin/main: fix(groups): authorize membership changes against their roster (#739)
When an open copy was refused, the new huddl form emptied itself in place. Changes and saves already on their way from the browser then landed on that emptied form and filled it back in with the copied huddl's details; a save sent in that moment stored them as a draft. Putting keyboard focus back in the field also undid a Tab the person had pressed meanwhile. A refusal on validation, save or a location change now leaves for the group's ordinary new huddl page, replacing the copy in history and carrying "That huddl can no longer be copied." That page has a form of its own that never held the copy. From deciding to leave until it is gone, the old page drops every event and message it receives. A save the group forbids sets the same flag before returning to the group. The focus-field event and the per-refusal field ids are removed; nothing is emptied in place any more.
After a reconnect the browser puts back what a form held when the page offers a form with the same id. A copy whose huddl had been deleted came back as the ordinary empty form under that same id, so the copied title and description were put back into it. A copy's form and its fields are now named for the huddl it copies. The form left after a refusal has other ids, so the browser neither replays the copy into it nor keeps the field that had keyboard focus. Recovery has its own event, which a form accepts only when the replayed form says it is the same copy, so the server holds the same line whatever a browser sends. A copy that is still allowed keeps what was typed into it. The phone layout rule for the new huddl form no longer depends on the form's id.
Opening the new address sheet from a copy, cancelling it or saving an address moved the page to addresses without the copied huddl. The copy stayed on screen, but a page mounted again from such an address, as after a reconnect, opened the ordinary form, and what had been typed into the copy was not put back. The sheet's open, cancel and saved addresses now name the huddl the page already copies, so a remount asks for the same copy through the same read and gets it only if it is still allowed. The address written is always the page's own copy: an address naming another huddl while a copy is open still switches nothing. A refused copy still leaves for the address without one.
The address chosen for a new huddl is the page's own state and has no field in the form, so a page mounted again after a reconnect forgot it: a copy went back to its source's address and an address just added in the sheet was no longer selected. The form now carries the chosen address along, and a recovery takes it back when it is one of the group's address book locations the person may read. Anything else leaves the choice as the page mounted it.
mwoods79
added a commit
that referenced
this pull request
Dec 1, 2026
…n-escaping * origin/main: fix(groups): hold a group's slug to one rule whenever it is set (#742) fix(huddl): copy only huddlz the actor can organize (#723) fix(auth): have open pages follow a change of access (#735) fix(groups): authorize membership changes against their roster (#739) fix(auth): bind administrator viewing credentials to the browser session (#736)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Owners and organizers can copy a huddl from their active group. The form, JSON:API and GraphQL use the same authorized source read. It identifies the source cover along with the details the actor can copy. Drafts, members-only, ended and cancelled huddlz remain copyable by eligible organizers.
A reconnect restores edits only to the same authorized copy. The address sheet keeps the source in its URL through open, cancel and save. Both new-huddl forms check the chosen venue against the organizer’s current address book when selecting, validating, recovering and submitting, including after saving a new address.
Evidence
Before: a removed venue could remain selected, and reconnecting could restore a removed source cover. Earlier checks also found that a copy could lose its edited title after visiting the address sheet.
After: Chromium verifies direct and post-sheet reconnects, the cover actually stored on the draft, and recovery when a venue disappears. The recurrence frequency and end date survive. An unfinished address sheet retains its written name and directions and requires a fresh place selection for coordinates. The existing form and API tests cover source authorization and the cover identified by that read.
Merge Danger
Door: two-way
Blast Radius: scheduling