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
Draft
Changes from all commits
Commits
Show all changes
91 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 84c3aee
feat: better flag rule run view and restructure files
tdgao 888ed51
feat: better rules page
tdgao 1481a5f
Merge branch 'main' into truman/surfacing-flags-in-modview
tdgao e2b2df2
fix: merge
tdgao b121073
feat: better run is scanning badge
tdgao 09cb86b
feat: update scan badge again
tdgao de52d71
feat: flagged rules count, show schema by project id, better search p…
tdgao 5ac199f
feat: better flag card
tdgao 86014e2
feat: move errors to be error notifications, and add TODO for backend…
tdgao 73c9c8d
polish
tdgao acc3ed3
avoid querying full queue for now
tdgao ca27622
feat: better project testing UI
tdgao 0667970
improvements
tdgao a1d8549
feat: better rule card for run results
tdgao fc88702
small
tdgao 66fd08d
Merge branch 'main' into truman/surfacing-flags-in-modview
tdgao ebd61fd
polish question editor
tdgao 6396c45
feat: flag rules 2
tdgao 7b984c9
fix: runs stuff and revert editor modal to use newmodal
tdgao 8afe9cb
fixes
tdgao bffe140
improve rule context section
tdgao 12a7858
add filtering
tdgao 88d610b
small fixes
tdgao 5d13f08
better rule card
tdgao 7477ae1
better card
tdgao 7f9ab1b
feat: rule testing project test sets
tdgao d6e072b
fix: timeout
tdgao 906118d
small
tdgao 862190a
small
tdgao 680ee3b
add link
tdgao c2ce8c5
small
tdgao 69880ff
make flag filter make sense
tdgao 7cdc7dd
add copy ids
tdgao 228cb0a
flag and rules better
tdgao 629188c
small
tdgao a21e9b0
search on patterns
tdgao e00dd44
better run counts
tdgao 3f32a60
don't make move-out-of-in-review wait for approval workflow to finish
aecsocket 1d3b34f
more descriptive errors
aecsocket f578710
bump scan entries limit
aecsocket 7078cd7
add summary fields to temporal memo state
aecsocket eef7f51
allow run results to filter, change it to QUERY
aecsocket 3da405c
add flags enable/disable
aecsocket 36a05d7
add ordering to run results endpoint
aecsocket bc6561a
new users input
aecsocket 099e3d8
add regex, image changes, scan specific project IDs, approval diagnos…
aecsocket 7281399
fix typos
aecsocket ee16ef5
fix comments
aecsocket 1ca19de
fix ci
aecsocket 3aa612b
PLEASE fix ci
aecsocket 6e5aa9a
qol in modules, rule editor, flags run card
tdgao 6b12261
Merge branch 'boris/flags-fix2' into truman/surfacing-flags-in-modview
tdgao b1a70ab
feat: add percentages
tdgao dc7acc0
revert filters
tdgao f5864c9
qa stuff
tdgao e9be8e6
small change
tdgao a7a1164
polish filters
tdgao c8cb688
Merge branch 'main' into truman/surfacing-flags-in-modview
tdgao 7d3b762
card polish
tdgao bc8bd52
run by ids
tdgao 17fd76d
add copy run project ids
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
57 changes: 57 additions & 0 deletions
57
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,57 @@ | ||
| <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> | ||
| <span v-if="!flag.active" class="shrink-0 text-xs text-secondary">Resolved · Retained</span> | ||
| <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> | ||
| <p v-if="!flag.active" class="m-0 text-secondary"> | ||
| This retained violation still blocks automatic approval. | ||
| </p> | ||
| <details class="text-xs"> | ||
| <summary class="w-fit cursor-pointer text-secondary">Flag evidence</summary> | ||
| <pre class="m-0 max-h-64 overflow-auto whitespace-pre-wrap break-words">{{ | ||
| JSON.stringify(flag, null, 2) | ||
| }}</pre> | ||
| </details> | ||
| <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 { PersistedProjectFlag } from '@modrinth/api-client' | ||
| import { ExternalIcon, PanelTopIcon, TagCategoryFlagIcon } from '@modrinth/assets' | ||
| import { Button, ButtonLink } from '@modrinth/ui' | ||
|
|
||
| defineProps<{ flag: PersistedProjectFlag; 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
35 changes: 0 additions & 35 deletions
35
apps/frontend/src/components/project-review/project-flags.vue
This file was deleted.
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
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
21 changes: 21 additions & 0 deletions
21
apps/frontend/src/components/project-review/review-panel/flags-count-badge.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,21 @@ | ||
| <template> | ||
| <span | ||
| v-if="flags.length" | ||
| class="pointer-events-none flex shrink-0 items-center gap-0.5 text-xs font-medium leading-none text-purple" | ||
| :aria-label="`${flags.length} flags`" | ||
| > | ||
| <TagCategoryFlagIcon class="size-3.5 shrink-0 text-purple" aria-hidden="true" /> | ||
| <span aria-hidden="true">{{ flags.length }}</span> | ||
| </span> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { TagCategoryFlagIcon } from '@modrinth/assets' | ||
| import { computed } from 'vue' | ||
|
|
||
| import { injectReviewFlags } from '~/providers/project-review/review-flags' | ||
|
|
||
| const props = defineProps<{ panelKey?: string }>() | ||
| const reviewFlags = injectReviewFlags(null) | ||
| const flags = computed(() => (props.panelKey ? (reviewFlags?.forPanel(props.panelKey) ?? []) : [])) | ||
| </script> |
56 changes: 56 additions & 0 deletions
56
apps/frontend/src/components/project-review/review-panel/flags.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,56 @@ | ||
| <template> | ||
| <div v-if="flags.length" class="flex flex-wrap gap-1"> | ||
| <Tooltip | ||
| v-for="flag in flags" | ||
| :key="flag.key" | ||
| interactive | ||
| panel-class="w-[min(20rem,calc(100vw-1rem))] !border-0 !bg-transparent !p-0 font-normal !shadow-none [&_.tooltip-arrow]:!border-surface-3 [&_.tooltip-arrow]:!bg-surface-2" | ||
| > | ||
| <span class="inline-flex items-center gap-1.5 text-sm font-medium text-contrast"> | ||
| <TagCategoryFlagIcon class="size-4 shrink-0 text-purple" aria-hidden="true" /> | ||
| {{ flag.name || flag.key }} | ||
| </span> | ||
| <template #popper> | ||
| <FlagCard | ||
| :flag="flag" | ||
| :location-title="locationTitle(flag.location?.review_panel_key)" | ||
| @reveal="reviewContext.revealPanel" | ||
| @pointerenter="setPreviewHovered(true)" | ||
| @pointerleave="setPreviewHovered(false)" | ||
| @pointerdown.stop | ||
| /> | ||
| </template> | ||
| </Tooltip> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { TagCategoryFlagIcon } from '@modrinth/assets' | ||
| import { Tooltip } from '@modrinth/ui' | ||
| import { computed, onBeforeUnmount } from 'vue' | ||
|
|
||
| import { injectReviewFlags } from '~/providers/project-review/review-flags' | ||
| import { injectReviewPanels } from '~/providers/project-review/review-panels' | ||
|
|
||
| import FlagCard from '../flag-list/flag-card.vue' | ||
| import { injectReviewContext } from './context' | ||
|
|
||
| const props = defineProps<{ panelKey?: string; panelId: string }>() | ||
| const reviewFlags = injectReviewFlags(null) | ||
| const panels = injectReviewPanels() | ||
| const reviewContext = injectReviewContext() | ||
| const flags = computed(() => (props.panelKey ? (reviewFlags?.forPanel(props.panelKey) ?? []) : [])) | ||
| let previewHovered = false | ||
|
|
||
| function locationTitle(key: string | undefined) { | ||
| return key ? panels.resolve({ kind: 'panel', key })?.panel.title : undefined | ||
| } | ||
|
|
||
| function setPreviewHovered(hovered: boolean) { | ||
| if (previewHovered === hovered) return | ||
| previewHovered = hovered | ||
| reviewContext.setDropdownOpen(props.panelId, hovered) | ||
| } | ||
|
|
||
| onBeforeUnmount(() => setPreviewHovered(false)) | ||
| </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
4 changes: 2 additions & 2 deletions
4
apps/frontend/src/components/project-review/review-panel/re-review-findings-count-badge.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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.