Quick moderation fixes (#3556)

* Quick moderation fixes

* Fix Odyssey mods linking
* Add "Copy permanent link" button to orgs, users, projects
* Use permanent links for Slack webhooks

* Update apps/frontend/src/pages/organization/[id].vue

Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Signed-off-by: Emma Alexia <wafflecoffee7@gmail.com>

* Run Prettier

---------

Signed-off-by: Emma Alexia <wafflecoffee7@gmail.com>
Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Co-authored-by: Alejandro González <me@alegon.dev>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Emma Alexia 2025-04-28 21:18:43 -04:00 committed by GitHub
parent 2f68c62b3a
commit 0508f13cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 44 additions and 12 deletions

View File

@ -638,6 +638,7 @@
shown: !isMember, shown: !isMember,
}, },
{ id: 'copy-id', action: () => copyId() }, { id: 'copy-id', action: () => copyId() },
{ id: 'copy-permalink', action: () => copyPermalink() },
]" ]"
aria-label="More options" aria-label="More options"
:dropdown-id="`${baseId}-more-options`" :dropdown-id="`${baseId}-more-options`"
@ -659,6 +660,10 @@
<ClipboardCopyIcon aria-hidden="true" /> <ClipboardCopyIcon aria-hidden="true" />
Copy ID Copy ID
</template> </template>
<template #copy-permalink>
<ClipboardCopyIcon aria-hidden="true" />
Copy permanent link
</template>
</OverflowMenu> </OverflowMenu>
</ButtonStyled> </ButtonStyled>
</template> </template>
@ -888,6 +893,7 @@ import { reportProject } from "~/utils/report-helpers.ts";
const data = useNuxtApp(); const data = useNuxtApp();
const route = useNativeRoute(); const route = useNativeRoute();
const config = useRuntimeConfig();
const auth = await useAuth(); const auth = await useAuth();
const user = await useUser(); const user = await useUser();
@ -1458,6 +1464,10 @@ async function copyId() {
await navigator.clipboard.writeText(project.value.id); await navigator.clipboard.writeText(project.value.id);
} }
async function copyPermalink() {
await navigator.clipboard.writeText(`${config.public.siteUrl}/project/${project.value.id}`);
}
const collapsedChecklist = ref(false); const collapsedChecklist = ref(false);
const showModerationChecklist = ref(false); const showModerationChecklist = ref(false);

View File

@ -123,6 +123,7 @@
}, },
{ divider: true, shown: auth.user && currentMember }, { divider: true, shown: auth.user && currentMember },
{ id: 'copy-id', action: () => copyId() }, { id: 'copy-id', action: () => copyId() },
{ id: 'copy-permalink', action: () => copyPermalink() },
]" ]"
aria-label="More options" aria-label="More options"
> >
@ -135,6 +136,10 @@
<ClipboardCopyIcon aria-hidden="true" /> <ClipboardCopyIcon aria-hidden="true" />
{{ formatMessage(commonMessages.copyIdButton) }} {{ formatMessage(commonMessages.copyIdButton) }}
</template> </template>
<template #copy-permalink>
<ClipboardCopyIcon aria-hidden="true" />
{{ formatMessage(commonMessages.copyPermalinkButton) }}
</template>
</OverflowMenu> </OverflowMenu>
</ButtonStyled> </ButtonStyled>
</template> </template>
@ -287,6 +292,7 @@ const cosmetics = useCosmetics();
const route = useNativeRoute(); const route = useNativeRoute();
const tags = useTags(); const tags = useTags();
const flags = useFeatureFlags(); const flags = useFeatureFlags();
const config = useRuntimeConfig();
let orgId = useRouteId(); let orgId = useRouteId();
@ -502,6 +508,12 @@ const navLinks = computed(() => [
async function copyId() { async function copyId() {
await navigator.clipboard.writeText(organization.value.id); await navigator.clipboard.writeText(organization.value.id);
} }
async function copyPermalink() {
await navigator.clipboard.writeText(
`${config.public.siteUrl}/organization/${organization.value.id}`,
);
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -125,6 +125,7 @@
shown: auth.user?.id !== user.id, shown: auth.user?.id !== user.id,
}, },
{ id: 'copy-id', action: () => copyId() }, { id: 'copy-id', action: () => copyId() },
{ id: 'copy-permalink', action: () => copyPermalink() },
{ {
id: 'open-billing', id: 'open-billing',
action: () => navigateTo(`/admin/billing/${user.id}`), action: () => navigateTo(`/admin/billing/${user.id}`),
@ -151,6 +152,10 @@
<ClipboardCopyIcon aria-hidden="true" /> <ClipboardCopyIcon aria-hidden="true" />
{{ formatMessage(commonMessages.copyIdButton) }} {{ formatMessage(commonMessages.copyIdButton) }}
</template> </template>
<template #copy-permalink>
<ClipboardCopyIcon aria-hidden="true" />
{{ formatMessage(commonMessages.copyPermalinkButton) }}
</template>
<template #open-billing> <template #open-billing>
<CurrencyIcon aria-hidden="true" /> <CurrencyIcon aria-hidden="true" />
{{ formatMessage(messages.billingButton) }} {{ formatMessage(messages.billingButton) }}
@ -381,6 +386,7 @@ const auth = await useAuth();
const cosmetics = useCosmetics(); const cosmetics = useCosmetics();
const tags = useTags(); const tags = useTags();
const flags = useFeatureFlags(); const flags = useFeatureFlags();
const config = useRuntimeConfig();
const vintl = useVIntl(); const vintl = useVIntl();
const { formatMessage } = vintl; const { formatMessage } = vintl;
@ -616,6 +622,10 @@ async function copyId() {
await navigator.clipboard.writeText(user.value.id); await navigator.clipboard.writeText(user.value.id);
} }
async function copyPermalink() {
await navigator.clipboard.writeText(`${config.public.siteUrl}/user/${user.value.id}`);
}
const navLinks = computed(() => [ const navLinks = computed(() => [
{ {
label: formatMessage(commonMessages.allProjectType), label: formatMessage(commonMessages.allProjectType),

View File

@ -168,19 +168,19 @@ impl ModerationMessage {
for project in &projects { for project in &projects {
let additional_text = if project.contains("ftb-quests") { let additional_text = if project.contains("ftb-quests") {
Some("Heracles") Some(("Odyssey Quests", "lo90fZoB"))
} else if project.contains("ftb-ranks") || project.contains("ftb-essentials") { } else if project.contains("ftb-ranks") || project.contains("ftb-essentials") {
Some("Prometheus") Some(("Odyssey Roles", "iYcNKH7W"))
} else if project.contains("ftb-teams") { } else if project.contains("ftb-teams") {
Some("Argonauts") Some(("Odyssey Guilds", "bb2EpKpx"))
} else if project.contains("ftb-chunks") { } else if project.contains("ftb-chunks") {
Some("Cadmus") Some(("Odyssey Claims", "fEWKxVzh"))
} else { } else {
None None
}; };
val.push_str(&if let Some(additional_text) = additional_text { val.push_str(&if let Some(additional_text) = additional_text {
format!("- {project}(consider using [{additional_text}](https://modrinth.com/mod/{}) instead)\n", additional_text.to_lowercase()) format!("- {project} (consider using [{}](https://modrinth.com/project/{}) instead)\n", additional_text.0, additional_text.1)
} else { } else {
format!("- {project}\n") format!("- {project}\n")
}) })

View File

@ -71,7 +71,7 @@ async fn get_webhook_metadata(
url: format!( url: format!(
"{}/organization/{}", "{}/organization/{}",
dotenvy::var("SITE_URL").unwrap_or_default(), dotenvy::var("SITE_URL").unwrap_or_default(),
organization.slug to_base62(organization.id.0 as u64)
), ),
icon_url: organization.icon_url, icon_url: organization.icon_url,
}); });
@ -97,7 +97,7 @@ async fn get_webhook_metadata(
url: format!( url: format!(
"{}/user/{}", "{}/user/{}",
dotenvy::var("SITE_URL").unwrap_or_default(), dotenvy::var("SITE_URL").unwrap_or_default(),
user.username to_base62(user.id.0 as u64)
), ),
name: user.username, name: user.username,
icon_url: user.avatar_url, icon_url: user.avatar_url,
@ -145,11 +145,7 @@ async fn get_webhook_metadata(
"{}/{}/{}", "{}/{}/{}",
dotenvy::var("SITE_URL").unwrap_or_default(), dotenvy::var("SITE_URL").unwrap_or_default(),
project_type, project_type,
project to_base62(project.inner.id.0 as u64)
.inner
.slug
.clone()
.unwrap_or_else(|| to_base62(project.inner.id.0 as u64))
), ),
project_title: project.inner.name, project_title: project.inner.name,
project_summary: project.inner.summary, project_summary: project.inner.summary,

View File

@ -21,6 +21,10 @@ export const commonMessages = defineMessages({
id: 'button.copy-id', id: 'button.copy-id',
defaultMessage: 'Copy ID', defaultMessage: 'Copy ID',
}, },
copyPermalinkButton: {
id: 'button.copy-permalink',
defaultMessage: 'Copy permanent link',
},
changesSavedLabel: { changesSavedLabel: {
id: 'label.changes-saved', id: 'label.changes-saved',
defaultMessage: 'Changes saved', defaultMessage: 'Changes saved',