-
-
Notifications
You must be signed in to change notification settings - Fork 42
fix: explain blocklist-hidden results on posts page #96
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -386,7 +386,23 @@ | |||||||||||||||||||||||
| // selectedTags.value.some((tag) => selectedBlockList.value.includes(tag.name)) && | ||||||||||||||||||||||||
| selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag)) | ||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||
| throw new Error('One of your selected tags is in the tag block list') | ||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||
| data: [], | ||||||||||||||||||||||||
| meta: { | ||||||||||||||||||||||||
| items_count: 0, | ||||||||||||||||||||||||
| total_items: 0, | ||||||||||||||||||||||||
| current_page: 0, | ||||||||||||||||||||||||
| total_pages: 0, | ||||||||||||||||||||||||
| items_per_page: 0 | ||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||
| links: { | ||||||||||||||||||||||||
| self: '', | ||||||||||||||||||||||||
| first: '', | ||||||||||||||||||||||||
| last: '', | ||||||||||||||||||||||||
| prev: '', | ||||||||||||||||||||||||
| next: '' | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } as IPostPage | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (options.pageParam) { | ||||||||||||||||||||||||
|
|
@@ -570,6 +586,18 @@ | |||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const isBlockedTagSelected = computed(() => { | ||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||
| selectedBlockList.value.length > 0 && | ||||||||||||||||||||||||
| selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag)) | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
|
Comment on lines
+589
to
+594
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normalize tag casing before blocklist comparisons. Line 592 compares raw strings. Because blocklist entries and query tags can differ by case, blocked tags can be missed. Please normalize both sides (e.g., lowercase) and reuse the same predicate in all blocklist checks to avoid behavior drift. Proposed fix+ const selectedTagNameSet = computed(() => new Set(selectedTags.value.map((tag) => tag.name.toLowerCase())))
+
const isBlockedTagSelected = computed(() => {
- return (
- selectedBlockList.value.length > 0 &&
- selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
- )
+ return selectedBlockList.value.some((blocklistTag) => selectedTagNameSet.value.has(blocklistTag.toLowerCase()))
})📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const hasHiddenPosts = computed(() => { | ||||||||||||||||||||||||
| if (!data.value) return false | ||||||||||||||||||||||||
| return data.value.pages.some((page) => page.meta.items_count > 0 && page.data.length === 0) | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const parentRef = ref<HTMLElement | null>(null) | ||||||||||||||||||||||||
| const parentOffsetRef = ref(0) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -958,7 +986,7 @@ | |||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <!-- Error (initial load only) --> | ||||||||||||||||||||||||
| <template v-else-if="isError && !allRows.length"> | ||||||||||||||||||||||||
| <template v-else-if="isError && !allRows.length && !isBlockedTagSelected && !hasHiddenPosts"> | ||||||||||||||||||||||||
| <PostPageError | ||||||||||||||||||||||||
| :error="error" | ||||||||||||||||||||||||
| :on-retry="onRetryClick" | ||||||||||||||||||||||||
|
|
@@ -976,7 +1004,17 @@ | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <h3 class="text-lg leading-10 font-semibold">No results</h3> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <span class="w-full overflow-x-auto text-pretty">Try changing the tags or filters</span> | ||||||||||||||||||||||||
| <span class="w-full overflow-x-auto text-pretty"> | ||||||||||||||||||||||||
| <template v-if="isBlockedTagSelected"> | ||||||||||||||||||||||||
| Your selected tag is in your blocklist | ||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||
| <template v-else-if="hasHiddenPosts"> | ||||||||||||||||||||||||
| Results were hidden by your tag blocklist | ||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||
| <template v-else> | ||||||||||||||||||||||||
| Try changing the tags or filters | ||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use null sentinels for
prev/nextin the synthetic empty page.Line 402-Line 403 currently return empty strings, but pagination logic treats only
null/undefinedas “no page”. This can make previous-page state incorrect for blocklisted queries.Proposed fix
links: { self: '', first: '', last: '', - prev: '', - next: '' + prev: null, + next: null }📝 Committable suggestion
🤖 Prompt for AI Agents