Skip to content

Show regex-tagged watches under their group tab#4267

Open
willyjfarrell wants to merge 1 commit into
dgtlmoon:masterfrom
willyjfarrell:fix/group-regex-tag-tab-filter
Open

Show regex-tagged watches under their group tab#4267
willyjfarrell wants to merge 1 commit into
dgtlmoon:masterfrom
willyjfarrell:fix/group-regex-tag-tab-filter

Conversation

@willyjfarrell

Copy link
Copy Markdown

Resolves #4193

Watches can get a group (tag) two ways: manually via the watch edit form, or automatically when a group's url_match_pattern regex matches the watch URL. Clicking a group's tab in the main UI filters the watch list by tag, but only manually-assigned watches showed up. Regex-matched watches would display the tag badge on their row but vanish when you clicked that tag's tab.

Root cause: watch_matches_tag() in changedetectionio/blueprint/watchlist/filters.py checked membership against the raw, persisted watch['tags'] list. Manual assignment writes into that list. Regex auto-matching does not, it's computed on the fly by datastore.get_all_tags_for_watch() and was only ever consumed by the tag badge template, never by the tab filter.

Fix threads datastore through the filter chain (watch_matches_tag, watch_in_context, watch_matches_filters, and their call sites in the watchlist and ui blueprints) so the tab filter and bulk actions check the same effective tag set the badge already uses, instead of the raw list.

Added a regression test in changedetectionio/tests/test_tag_url_match.py covering a watch tagged only via regex showing up under that tag's filtered view.

Test plan

  • pytest changedetectionio/tests/test_tag_url_match.py, all pass including the new test
  • pytest changedetectionio/tests/test_api.py, no regressions from this change

…m group tab filter

watch_matches_tag() checked only the persisted watch['tags'] list, which
manual tag assignment writes to but regex auto-matching never does (it's
computed live by datastore.get_all_tags_for_watch() and only consumed by
the badge renderer). Thread datastore through the filter chain so the tab
filter and bulk actions check the same effective tag set as the badge.
@dgtlmoon

Copy link
Copy Markdown
Owner

Thanks for this!

@willyjfarrell

Copy link
Copy Markdown
Author

Thanks for this!

No problem! Do you handle merging? Any other action needed on my part to help push this through?

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.

[ui] bug - wildcard config tag/groups dont list in the watch overview correctly

2 participants