Skip to content

Conversation

@manuthecoder
Copy link
Contributor

@manuthecoder manuthecoder commented Feb 9, 2026

Introduces process_hidden_param! to remove duplicate code

  def process_hidden_param!(params_hash)
    if params_hash[:hidden] == "1" && !@event.hidden_at.present?
      params_hash[:hidden_at] = DateTime.now
    elsif params_hash[:hidden] == "0" && @event.hidden_at.present?
      params_hash[:hidden_at] = nil
    end
    params_hash.delete(:hidden)
  end

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors EventsController#update by extracting repeated “hidden” param normalization into a single helper, process_hidden_param!, to reduce duplication and keep parameter munging consistent.

Changes:

  • Replace duplicated hidden/hidden_at processing logic in update with calls to process_hidden_param!.
  • Add process_hidden_param! private helper to encapsulate the hidden/hidden_at transformation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@garyhtou garyhtou added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit fd36367 Feb 13, 2026
17 checks passed
@garyhtou garyhtou deleted the mxg-process-hidden-params-events-controller branch February 13, 2026 02:51
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.

2 participants