Skip to content

Add a simple way to open Cards by number#2665

Open
janrenz wants to merge 2 commits intobasecamp:mainfrom
janrenz:main
Open

Add a simple way to open Cards by number#2665
janrenz wants to merge 2 commits intobasecamp:mainfrom
janrenz:main

Conversation

@janrenz
Copy link

@janrenz janrenz commented Mar 5, 2026

Following up on the discussion in #2190 i added a possibility to easy open a ticket by entering the number.

Summary

  • Extend the global search behavior so that numeric queries (e.g. #123) are interpreted as card numbers.
  • Reuse the existing redirect behavior used for card.id lookups so that searching by ticket number jumps straight to the card page.
  • Add controller tests to cover searching by card id, card number, and card number with a # prefix.

Details

The SearchesController previously only tried to treat the query (q) as a card.id via:

  • Current.user.accessible_cards.find_by_id(@query)

This meant that users could not quickly jump to a card by the visible ticket number they see in the UI.

This change introduces a small find_card helper in SearchesController:

  • If q matches \A#?\d+\z, we treat it as a card number (with an optional # prefix) and look it up via Current.user.accessible_cards.find_by(number: number).
  • Otherwise, we fall back to the existing behavior of looking up by id.

If a card is found, the search page behaves as before and auto-submits a form that redirects to the card show page.

Testing

  • mise exec -- bin/rails test test/controllers/searches_controller_test.rb

The controller test now verifies:

  • Searching by card id still redirects correctly.
  • Searching by q: "#{@card.number}" redirects to the card.
  • Nonexistent ids still show the “No matches” blank slate.
Prototype.number.search.mov

Copilot AI review requested due to automatic review settings March 5, 2026 13:14
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 updates global search so users can jump directly to a Card page by entering a card “ticket number” query, reusing the existing auto-submit redirect behavior when a card is found.

Changes:

  • Add a find_card helper in SearchesController to resolve certain queries directly to a Card.
  • Extend controller tests to cover redirect behavior for card id / number queries and “no matches” behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/controllers/searches_controller.rb Introduces find_card helper to resolve queries to a card (via id/number) before running full search.
test/controllers/searches_controller_test.rb Adds assertions around auto-submit redirect behavior for card id/number queries.

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

@rtharston
Copy link

Hello reviewers, my team and I at Koble Systems would very much like this to get reviewed and merged. We use Fizzy in our daily standup and if this gets added we'd use it nearly every day.

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.

3 participants