Repository navigation
feat: surfacing flags in modview #8240
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
Draft
+7,366
−32
Draft
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
393aca3
flag rules backend model
aecsocket 4bed0f5
project flag routes
aecsocket 6873520
add rule editor frontend and rhai eval
aecsocket 2f29c7e
wip: project flags can scan files for patterns
aecsocket 799d773
persist scan patterns for rules
aecsocket 600a114
more flag context
aecsocket 8b68be6
listing and starting runs
aecsocket 8907718
wip: consumer task for reading scan reqs
aecsocket 660fc91
persist flag run results in db
aecsocket 6b81dc1
run rule result persistence
aecsocket 2676af9
route to fetch project flags
aecsocket 35a2845
Merge branch 'main' into boris/dev-1493-flag-rules-backend
aecsocket 05ef0eb
list runs/delete runs but keep active flags
aecsocket 5d4347d
Merge branch 'main' into boris/dev-1493-flag-rules-backend
aecsocket c97cefb
allow kafka scans to not have a run_id
aecsocket 7961dc1
sqlx prepare
aecsocket 13efdcd
feat: surface project flags in modview
tdgao d28b4db
pnpm prepr
tdgao 6d34d54
track how many scan jobs we have + how many kafka consumers
aecsocket 62ee613
sqlx prepare
aecsocket 927d974
default auto_resolve on add_gallery_images issue targets
clrxbl f1e1c63
Merge branch 'main' into boris/dev-1493-flag-rules-backend
aecsocket 6411b67
scan size limits with env var
aecsocket cff217f
strip out run application
aecsocket 6048e29
use a pending jobs ledger
aecsocket 0b873b4
prepr
aecsocket 811116b
disable source map uploads
aecsocket 77b3634
address comments
aecsocket d82d20e
Merge branch 'boris/dev-1493-flag-rules-backend' into truman/surfacin…
tdgao 524537f
remove mock data
tdgao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
apps/frontend/src/components/project-review/flag-list/flag-card.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <template> | ||
| <article | ||
| class="flex min-w-0 flex-col gap-2 rounded-xl border border-solid border-surface-3 bg-surface-2 p-2.5 text-sm" | ||
| > | ||
| <div class="flex items-center gap-2"> | ||
| <h3 class="m-0 flex min-w-0 flex-1 items-center gap-1.5 text-sm font-medium text-contrast"> | ||
| <TagCategoryFlagIcon class="size-4 shrink-0 text-purple" aria-hidden="true" /> | ||
| <span class="min-w-0 break-words">{{ flag.name || flag.key }}</span> | ||
| </h3> | ||
| <ButtonLink | ||
| v-tooltip="'View flag rule'" | ||
| type="quiet" | ||
| size="xs" | ||
| class="-my-1 -mr-1 !size-7 shrink-0 !rounded-full !p-0" | ||
| href="/moderation/project-flag" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| aria-label="View flag rule" | ||
| > | ||
| <ExternalIcon class="!size-3.5 !min-h-0 !min-w-0" aria-hidden="true" /> | ||
| </ButtonLink> | ||
| </div> | ||
| <p v-if="flag.reason" class="m-0 whitespace-pre-wrap break-words text-primary"> | ||
| {{ flag.reason }} | ||
| </p> | ||
| <div v-if="flag.location" class="flex"> | ||
| <Button | ||
| size="xs" | ||
| type="quiet" | ||
| class="!h-auto !min-h-0 !rounded-full !bg-surface-3 !px-2.5 !py-1 !text-xs !font-medium hover:!bg-surface-4" | ||
| @click="emit('reveal', flag.location.review_panel_key)" | ||
| > | ||
| <PanelTopIcon class="!size-3.5 shrink-0" aria-hidden="true" /> | ||
| {{ locationTitle || flag.location.review_panel_key }} | ||
| </Button> | ||
| </div> | ||
| </article> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import type { ProjectFlag } from '@modrinth/api-client' | ||
| import { ExternalIcon, PanelTopIcon, TagCategoryFlagIcon } from '@modrinth/assets' | ||
| import { Button, ButtonLink } from '@modrinth/ui' | ||
|
|
||
| defineProps<{ flag: ProjectFlag; locationTitle?: string }>() | ||
| const emit = defineEmits<{ reveal: [key: string] }>() | ||
| </script> | ||
31 changes: 31 additions & 0 deletions
31
apps/frontend/src/components/project-review/flag-list/index.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <template> | ||
| <div class="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto"> | ||
| <FlagCard | ||
| v-for="flag in flags" | ||
| :key="flag.key" | ||
| :flag="flag" | ||
| :location-title="locationTitle(flag.location?.review_panel_key)" | ||
| @reveal="revealPanel" | ||
| /> | ||
| <p v-if="isPending" class="m-0 text-sm text-secondary">Loading flags...</p> | ||
| <p v-else-if="isError" class="m-0 text-sm text-red">Failed to load project flags.</p> | ||
| <p v-else-if="!flags.length" class="m-0 text-sm text-secondary"> | ||
| No flags on this project. | ||
| </p> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { injectReviewFlags } from '~/providers/project-review/review-flags' | ||
| import { injectReviewPanels } from '~/providers/project-review/review-panels' | ||
|
|
||
| import { injectReviewContext } from '../review-panel/context' | ||
| import FlagCard from './flag-card.vue' | ||
|
|
||
| const { flags, isPending, isError } = injectReviewFlags() | ||
| const panels = injectReviewPanels() | ||
| const { revealPanel } = injectReviewContext() | ||
| function locationTitle(key: string | undefined) { | ||
| return key ? panels.resolve({ kind: 'panel', key })?.panel.title : undefined | ||
| } | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hovering “View flag rule” inside a flag preview removes the card before the user can click the link. The card is already inside an interactive
Tooltip, but this nestedv-tooltipreplaces the sharedactiveTooltipwith plain text. Remove the nested tooltip here and keep the existingaria-label.Prompt To Fix With AI