Skip to content

Only add names to draft registers - #293

Merged
lmrodriguezr merged 4 commits into
mainfrom
only-add-names-to-draft-registers
Jun 30, 2026
Merged

lmrodriguezr merged 4 commits into
mainfrom
only-add-names-to-draft-registers

Conversation

@vangberg

@vangberg vangberg commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #216

Bug

The existing code in RegistersController#new has this guard:

@registers = current_user.registers.where(submitted: false, validated: false)

This almost works, but includes registers that follow the path of going straight from draft to notified. They have both submitted=false and validated=false because they never went through that path.

Change

This pull request does two things:

  1. Adds a guard to Name#add_to_register to ensure that registers are in draft.
  2. Adds a drafts scope to Register, which checks where(validated: false, notified: false, submitted: false), and use that to select registers to show to the user in the dropdown.

No changes to the UI in this pull request, except that non-draft register lists are not in the dropdown.

Alternative UI

I have a local change with a quick attempt at the table based interface we discussed. Not sure if we want to continue with that, I think the dropdown probably works well as long as you don't show the wrong registers. Thoughts?

CleanShot-2026-06-29-12-58-08

@vangberg
vangberg requested a review from lmrodriguezr June 29, 2026 10:59
@vangberg vangberg self-assigned this Jun 29, 2026
Comment thread app/models/register.rb
has_rich_text(:abstract)
has_rich_text(:submitter_authorship_explanation)

scope :drafts, -> { where(validated: false, notified: false, submitted: false) }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question is, if we want to go down the route of having these scopes, should we straight away implement the other state scopes (#notified etc) and use them?

@lmrodriguezr
lmrodriguezr merged commit 3b579bd into main Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue with linking new entries to submitted list

2 participants