Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix room map widget search not doing anything #3272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Feb 6, 2025

Fixes #3207

Seemed like the form sent a request to home (/) directly, when it probably should have been sent to /search/ instead. This at least makes it so if you search for a room and it finds a match it opens the page for the room,
and if there is no match then it still shows the search page but with the message that nothing was found.

If this is how the map widget is supposed to function is uncertain to me, I don't actually know how it originally worked before it broke (if it ever worked)

@stveit stveit added the bug label Feb 6, 2025
@stveit stveit self-assigned this Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 1 0 0.47s
✅ PYTHON ruff 1 0 0.01s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Feb 6, 2025

Test results

    9 files      9 suites   8m 20s ⏱️
2 162 tests 2 162 ✅ 0 💤 0 ❌
4 063 runs  4 063 ✅ 0 💤 0 ❌

Results for commit 8d622f1.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.58%. Comparing base (12f00d5) to head (8d622f1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3272   +/-   ##
=======================================
  Coverage   60.58%   60.58%           
=======================================
  Files         606      606           
  Lines       43733    43733           
  Branches       48       48           
=======================================
  Hits        26494    26494           
  Misses      17227    17227           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

Good start, but I think it would be clearer to not do the general search, but the actual room search

changelog.d/3207.fixed.md Outdated Show resolved Hide resolved
@@ -32,7 +32,7 @@ def get(self, request, *args, **kwargs):
context['can_edit_rooms'] = request.account.has_perm(
'web_access', reverse('seeddb-room-edit')
)
context['searchform'] = SearchForm()
context['searchform'] = SearchForm(form_action='info-search')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
context['searchform'] = SearchForm(form_action='info-search')
context['searchform'] = RoomSearchForm()

This makes it use the form_action room_search, not the general search and also changes the placeholder to Room

(The import also needs to be changed accordingly)

Copy link
Contributor Author

@stveit stveit Feb 6, 2025

Choose a reason for hiding this comment

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

Potential downside is that using RoomSearchForm() never opens the page for the room itself even if there is only one match, it always sends you to the list of search results.

I'll change it to RoomSearchForm, but this thing still has room for improvement in the future

@lunkwill42 lunkwill42 self-requested a review February 6, 2025 11:43
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

I did some light digging and found that this was likely broken by 6af1135 back in 2016 :P

It seems the default action of the search form was the info-search URL before this commit: The commit seems to remove the default action, but doesn't update the room widget.

So, I'd say you have returned it to the original intention - but @johannaengland's suggestion makes sense: Why do a generic search from a room focused widget?

@stveit
Copy link
Contributor Author

stveit commented Feb 6, 2025

Will squash before merge

@johannaengland
Copy link
Contributor

johannaengland commented Feb 6, 2025

We could add a new issue for room search (and potential all the other specified searches): If there is only one result, then just as in the general search directly open the page to that result

Seemed like the form sent a request to home (/) directly,
when it probably should have been sent to /search/ instead.
This at least makes it so if you search for a room and it finds
a match it opens the page for the room,
and if there is no match then it still shows the search page but
with the message that nothing was found.

If this is how the map widget is supposed to function is
uncertain to me, I dont actually know how it originally worked
before it broke (if it ever worked)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Search in Room map widget does nothing
3 participants