2023-07-15 20:39:33 -07:00
|
|
|
<template>
|
2025-08-14 21:48:38 +01:00
|
|
|
<div
|
|
|
|
|
class="message"
|
|
|
|
|
:class="{
|
|
|
|
|
'has-body': message.body.type === 'text' && !forceCompact,
|
|
|
|
|
'no-actions': noLinks,
|
2025-12-20 11:43:04 +00:00
|
|
|
private: isPrivateMessage,
|
2025-08-14 21:48:38 +01:00
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<template v-if="members[message.author_id]">
|
|
|
|
|
<AutoLink
|
|
|
|
|
class="message__icon"
|
|
|
|
|
:to="noLinks ? '' : `/user/${members[message.author_id].username}`"
|
|
|
|
|
tabindex="-1"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
>
|
|
|
|
|
<Avatar
|
|
|
|
|
class="message__icon"
|
|
|
|
|
:src="members[message.author_id].avatar_url"
|
|
|
|
|
circle
|
|
|
|
|
:raised="raised"
|
|
|
|
|
/>
|
|
|
|
|
</AutoLink>
|
|
|
|
|
<span :class="`message__author role-${members[message.author_id].role}`">
|
|
|
|
|
<LockIcon
|
2025-12-20 11:43:04 +00:00
|
|
|
v-if="isPrivateMessage"
|
2025-08-14 21:48:38 +01:00
|
|
|
v-tooltip="'Only visible to moderators'"
|
|
|
|
|
class="private-icon"
|
|
|
|
|
/>
|
|
|
|
|
<AutoLink :to="noLinks ? '' : `/user/${members[message.author_id].username}`">
|
|
|
|
|
{{ members[message.author_id].username }}
|
|
|
|
|
</AutoLink>
|
|
|
|
|
<ScaleIcon v-if="members[message.author_id].role === 'moderator'" v-tooltip="'Moderator'" />
|
|
|
|
|
<ModrinthIcon
|
|
|
|
|
v-else-if="members[message.author_id].role === 'admin'"
|
|
|
|
|
v-tooltip="'Modrinth Team'"
|
|
|
|
|
/>
|
|
|
|
|
<MicrophoneIcon
|
|
|
|
|
v-if="report && message.author_id === report.reporter_user?.id"
|
|
|
|
|
v-tooltip="'Reporter'"
|
|
|
|
|
class="reporter-icon"
|
|
|
|
|
/>
|
2025-12-20 11:43:04 +00:00
|
|
|
<span
|
|
|
|
|
v-if="message.preview"
|
|
|
|
|
class="border-blue/60 rounded-full border border-solid bg-highlight-blue px-2 py-0.5 text-xs font-semibold text-blue"
|
|
|
|
|
>
|
|
|
|
|
Preview
|
|
|
|
|
</span>
|
2025-08-14 21:48:38 +01:00
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
2025-12-20 11:43:04 +00:00
|
|
|
<div
|
|
|
|
|
class="message__icon backed-svg circle moderation-color"
|
|
|
|
|
:class="{
|
|
|
|
|
raised: raised,
|
|
|
|
|
'system-message-icon': ['tech_review_entered', 'tech_review_exit_file_deleted'].includes(
|
|
|
|
|
message.body.type,
|
|
|
|
|
),
|
|
|
|
|
}"
|
|
|
|
|
>
|
2025-08-14 21:48:38 +01:00
|
|
|
<ScaleIcon />
|
|
|
|
|
</div>
|
2025-12-20 11:43:04 +00:00
|
|
|
<span
|
|
|
|
|
v-if="!['tech_review_entered', 'tech_review_exit_file_deleted'].includes(message.body.type)"
|
|
|
|
|
class="message__author moderation-color"
|
|
|
|
|
>
|
2025-08-14 21:48:38 +01:00
|
|
|
Moderator
|
|
|
|
|
<ScaleIcon v-tooltip="'Moderator'" />
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<div
|
|
|
|
|
v-if="message.body.type === 'text'"
|
|
|
|
|
class="message__body markdown-body"
|
|
|
|
|
v-html="formattedMessage"
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="message__body status-message">
|
|
|
|
|
<span v-if="message.body.type === 'deleted'"> posted a message that has been deleted. </span>
|
|
|
|
|
<template v-else-if="message.body.type === 'status_change'">
|
|
|
|
|
<span v-if="message.body.new_status === 'processing'">
|
|
|
|
|
submitted the project for review.
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else>
|
|
|
|
|
changed the project's status from <Badge :type="message.body.old_status" /> to
|
|
|
|
|
<Badge :type="message.body.new_status" />.
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<span v-else-if="message.body.type === 'thread_closure'">closed the thread.</span>
|
|
|
|
|
<span v-else-if="message.body.type === 'thread_reopen'">reopened the thread.</span>
|
2025-12-20 11:43:04 +00:00
|
|
|
<span v-else-if="message.body.type === 'tech_review'">
|
|
|
|
|
completed technical review and marked project as
|
|
|
|
|
<Badge :type="message.body.verdict" />.
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else-if="message.body.type === 'tech_review_entered'">
|
|
|
|
|
The project has entered the technical review queue.
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else-if="message.body.type === 'tech_review_exit_file_deleted'">
|
|
|
|
|
The project has left the technical review queue as all files pending review were deleted by
|
|
|
|
|
the user.
|
|
|
|
|
</span>
|
2025-08-14 21:48:38 +01:00
|
|
|
</div>
|
|
|
|
|
<span class="message__date">
|
|
|
|
|
<span v-tooltip="$dayjs(message.created).format('MMMM D, YYYY [at] h:mm A')">
|
|
|
|
|
{{ timeSincePosted }}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
<div v-if="isStaff(auth.user) && message.author_id === auth.user.id" class="message__actions">
|
|
|
|
|
<OverflowMenu
|
|
|
|
|
class="btn btn-transparent icon-only"
|
|
|
|
|
:options="[
|
|
|
|
|
{
|
|
|
|
|
id: 'delete',
|
|
|
|
|
action: () => deleteMessage(),
|
|
|
|
|
color: 'red',
|
|
|
|
|
hoverFilled: true,
|
|
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<MoreHorizontalIcon />
|
|
|
|
|
<template #delete> <TrashIcon /> Delete </template>
|
|
|
|
|
</OverflowMenu>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-07-15 20:39:33 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-01-09 13:32:38 -08:00
|
|
|
import {
|
2025-08-14 21:48:38 +01:00
|
|
|
LockIcon,
|
|
|
|
|
MicrophoneIcon,
|
|
|
|
|
ModrinthIcon,
|
|
|
|
|
MoreHorizontalIcon,
|
|
|
|
|
ScaleIcon,
|
|
|
|
|
TrashIcon,
|
|
|
|
|
} from '@modrinth/assets'
|
|
|
|
|
import { AutoLink, Avatar, Badge, OverflowMenu, useRelativeTime } from '@modrinth/ui'
|
|
|
|
|
import { renderString } from '@modrinth/utils'
|
|
|
|
|
|
|
|
|
|
import { isStaff } from '~/helpers/users.js'
|
2023-07-15 20:39:33 -07:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-08-14 21:48:38 +01:00
|
|
|
message: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
report: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
members: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {},
|
|
|
|
|
},
|
|
|
|
|
forceCompact: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
noLinks: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
raised: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
auth: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update-thread'])
|
2024-01-09 13:32:38 -08:00
|
|
|
|
2023-07-15 20:39:33 -07:00
|
|
|
const formattedMessage = computed(() => {
|
2025-08-14 21:48:38 +01:00
|
|
|
const body = renderString(props.message.body.body)
|
|
|
|
|
if (props.forceCompact) {
|
|
|
|
|
const hasImage = body.includes('<img')
|
|
|
|
|
const noHtml = body.replace(/<\/?[^>]+(>|$)/g, '')
|
|
|
|
|
if (noHtml.trim()) {
|
|
|
|
|
return noHtml
|
|
|
|
|
} else if (hasImage) {
|
|
|
|
|
return 'sent an image.'
|
|
|
|
|
} else {
|
|
|
|
|
return 'sent a message.'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return body
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const formatRelativeTime = useRelativeTime()
|
|
|
|
|
const timeSincePosted = ref(formatRelativeTime(props.message.created))
|
2024-01-09 13:32:38 -08:00
|
|
|
|
2025-12-20 11:43:04 +00:00
|
|
|
const isPrivateMessage = computed(() => {
|
|
|
|
|
return (
|
|
|
|
|
props.message.body.private ||
|
|
|
|
|
['tech_review', 'tech_review_entered', 'tech_review_exit_file_deleted'].includes(
|
|
|
|
|
props.message.body.type,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
2024-01-09 13:32:38 -08:00
|
|
|
async function deleteMessage() {
|
2025-08-14 21:48:38 +01:00
|
|
|
await useBaseFetch(`message/${props.message.id}`, {
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
})
|
|
|
|
|
emit('update-thread')
|
2024-01-09 13:32:38 -08:00
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.message {
|
2025-08-14 21:48:38 +01:00
|
|
|
--gap-size: var(--spacing-card-xs);
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
gap: var(--gap-size);
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-items: center;
|
|
|
|
|
border-radius: var(--size-rounded-card);
|
|
|
|
|
padding: var(--spacing-card-md);
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
|
|
|
|
|
.avatar,
|
|
|
|
|
.backed-svg {
|
|
|
|
|
--size: 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.has-body {
|
|
|
|
|
--gap-size: var(--spacing-card-sm);
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template:
|
|
|
|
|
'icon author actions'
|
|
|
|
|
'icon body actions'
|
|
|
|
|
'date date date';
|
|
|
|
|
grid-template-columns: min-content auto 1fr;
|
|
|
|
|
column-gap: var(--gap-size);
|
|
|
|
|
row-gap: var(--spacing-card-xs);
|
|
|
|
|
|
|
|
|
|
.message__icon {
|
|
|
|
|
margin-bottom: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar,
|
|
|
|
|
.backed-svg {
|
|
|
|
|
--size: 3rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:not(.no-actions):hover,
|
|
|
|
|
&:not(.no-actions):focus-within {
|
|
|
|
|
background-color: var(--color-table-alternate-row);
|
|
|
|
|
|
|
|
|
|
.message__actions {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.no-actions {
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
|
|
.message__actions {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message__icon {
|
2025-08-14 21:48:38 +01:00
|
|
|
grid-area: icon;
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message__author {
|
2025-08-14 21:48:38 +01:00
|
|
|
grid-area: author;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: var(--spacing-card-xs);
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
flex-shrink: 0;
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message__date {
|
2025-08-14 21:48:38 +01:00
|
|
|
grid-area: date;
|
|
|
|
|
font-size: var(--font-size-xs);
|
|
|
|
|
color: var(--color-text-secondary);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message__actions {
|
2025-08-14 21:48:38 +01:00
|
|
|
grid-area: actions;
|
|
|
|
|
margin-left: auto;
|
2024-01-09 13:32:38 -08:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
@media (hover: hover) {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message__body {
|
2025-08-14 21:48:38 +01:00
|
|
|
grid-area: body;
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-message > span {
|
2025-08-14 21:48:38 +01:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--spacing-card-xs);
|
|
|
|
|
flex-wrap: wrap;
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
a {
|
2025-08-14 21:48:38 +01:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
text-decoration: none;
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a:focus-visible + .message__author a,
|
|
|
|
|
a:hover + .message__author a,
|
|
|
|
|
.message__author a:focus-visible,
|
|
|
|
|
.message__author a:hover {
|
2025-08-14 21:48:38 +01:00
|
|
|
text-decoration: underline;
|
|
|
|
|
filter: var(--hover-filter);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a:active + .message__author a,
|
|
|
|
|
.message__author a:active {
|
2025-08-14 21:48:38 +01:00
|
|
|
filter: var(--active-filter);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.moderation-color,
|
App redesign (#2946)
* Start of app redesign
* format
* continue progress
* Content page nearly done
* Fix recursion issues with content page
* Fix update all alignment
* Discover page progress
* Settings progress
* Removed unlocked-size hack that breaks web
* Revamp project page, refactor web project page to share code with app, fixed loading bar, misc UI/UX enhancements, update ko-fi logo, update arrow icons, fix web issues caused by floating-vue migration, fix tooltip issues, update web tooltips, clean up web hydration issues
* Ads + run prettier
* Begin auth refactor, move common messages to ui lib, add i18n extraction to all apps, begin Library refactor
* fix ads not hiding when plus log in
* rev lockfile changes/conflicts
* Fix sign in page
* Add generated
* (mostly) Data driven search
* Fix search mobile issue
* profile fixes
* Project versions page, fix typescript on UI lib and misc fixes
* Remove unused gallery component
* Fix linkfunction err
* Search filter controls at top, localization for locked filters
* Fix provided filter names
* Fix navigating from instance browse to main browse
* Friends frontend (#2995)
* Friends system frontend
* (almost) finish frontend
* finish friends, fix lint
* Fix lint
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
* Refresh macOS app icon
* Update web search UI more
* Fix link opens
* Fix frontend build
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-12-11 19:54:18 -08:00
|
|
|
.role-moderator {
|
2025-08-14 21:48:38 +01:00
|
|
|
color: var(--color-orange);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.role-admin {
|
2025-08-14 21:48:38 +01:00
|
|
|
color: var(--color-green);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.reporter-icon {
|
2025-08-14 21:48:38 +01:00
|
|
|
color: var(--color-purple);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.private-icon {
|
2025-08-14 21:48:38 +01:00
|
|
|
color: var(--color-gray);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 600px) {
|
2025-08-14 21:48:38 +01:00
|
|
|
.message {
|
|
|
|
|
//grid-template:
|
|
|
|
|
// 'icon author body'
|
|
|
|
|
// 'date date date';
|
|
|
|
|
//grid-template-columns: min-content auto 1fr;
|
|
|
|
|
|
|
|
|
|
&.has-body {
|
|
|
|
|
grid-template:
|
|
|
|
|
'icon author actions'
|
|
|
|
|
'icon body actions'
|
|
|
|
|
'date date date';
|
|
|
|
|
grid-template-columns: min-content auto 1fr;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1024px) {
|
2025-08-14 21:48:38 +01:00
|
|
|
.message {
|
|
|
|
|
//grid-template: 'icon author body date';
|
|
|
|
|
//grid-template-columns: min-content auto 1fr auto;
|
|
|
|
|
|
|
|
|
|
&.has-body {
|
|
|
|
|
grid-template:
|
|
|
|
|
'icon author date actions'
|
|
|
|
|
'icon body body actions';
|
|
|
|
|
grid-template-columns: min-content auto 1fr;
|
|
|
|
|
grid-template-rows: min-content 1fr auto;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.private {
|
2025-08-14 21:48:38 +01:00
|
|
|
color: var(--color-icon);
|
2023-07-15 20:39:33 -07:00
|
|
|
}
|
2025-12-20 11:43:04 +00:00
|
|
|
|
|
|
|
|
.system-message-icon {
|
|
|
|
|
--size: 2rem !important;
|
|
|
|
|
}
|
2023-07-15 20:39:33 -07:00
|
|
|
</style>
|