Merge branch 'more-fixes' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-06-30 06:21:02 +03:00
commit c97ccd4de5
28 changed files with 245 additions and 392 deletions

View file

@ -52,6 +52,7 @@ const Attachment = {
'shiftDn',
'edit',
],
emits: ['play', 'pause', 'naturalSizeLoad'],
data() {
return {
localDescription: this.description || this.attachment.description,

View file

@ -55,16 +55,6 @@ const sortAndFilterConversation = (conversation, statusoid) => {
}
const conversation = {
data() {
return {
highlight: null,
expanded: false,
threadDisplayStatusObject: {}, // id => 'showing' | 'hidden'
statusContentPropertiesObject: {},
inlineDivePosition: null,
loadStatusError: null,
}
},
props: [
'statusId',
'collapsable',
@ -74,6 +64,16 @@ const conversation = {
'profileUserId',
'virtualHidden',
],
data() {
return {
highlight: null,
expanded: false,
threadDisplayStatusObject: {}, // id => 'showing' | 'hidden'
inlineDivePosition: null,
loadStatusError: null,
unsuspendibleIds: new Set(),
}
},
created() {
if (this.isPage) {
this.fetchConversation()
@ -118,16 +118,7 @@ const conversation = {
return this.otherRepliesButtonPosition === 'inside'
},
suspendable() {
if (this.isTreeView) {
return Object.entries(this.statusContentProperties).every(
([, prop]) => !prop.replying && prop.mediaPlaying.length === 0,
)
}
if (this.$refs.statusComponent && this.$refs.statusComponent[0]) {
return this.$refs.statusComponent.every((s) => s.suspendable)
} else {
return true
}
return this.unsuspendibleIds.size > 0
},
hideStatus() {
return this.virtualHidden && this.suspendable
@ -364,31 +355,6 @@ const conversation = {
return a
}, {})
},
statusContentProperties() {
return this.conversation.reduce((a, k) => {
const id = k.id
const props = (() => {
const def = {
showingTall: false,
expandingSubject: false,
showingLongSubject: false,
isReplying: false,
mediaPlaying: [],
}
if (this.statusContentPropertiesObject[id]) {
return {
...def,
...this.statusContentPropertiesObject[id],
}
}
return def
})()
a[id] = props
return a
}, {})
},
canDive() {
return this.isTreeView && this.isExpanded
},
@ -514,22 +480,6 @@ const conversation = {
showThreadRecursively(id) {
this.setThreadDisplayRecursively(id, 'showing')
},
setStatusContentProperty(id, name, value) {
this.statusContentPropertiesObject = {
...this.statusContentPropertiesObject,
[id]: {
...this.statusContentPropertiesObject[id],
[name]: value,
},
}
},
toggleStatusContentProperty(id, name) {
this.setStatusContentProperty(
id,
name,
!this.statusContentProperties[id][name],
)
},
leastVisibleAncestor(id) {
let cur = id
let parent = this.parentOf(cur)
@ -629,6 +579,13 @@ const conversation = {
this.undive()
this.threadDisplayStatusObject = {}
},
onStatusSuspendStateChange({ id, suspend }) {
if (!suspend) {
this.unsuspendibleIds.add(id)
} else {
this.unsuspendibleIds.delete(id)
}
},
},
}

View file

@ -97,7 +97,7 @@
:expandable="!isExpanded"
:focused="isFocused(status.id)"
:highlight="getHighlight()"
:highlight="maybeHighlight"
:inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-profile="inProfile"
@ -105,21 +105,11 @@
:profile-user-id="profileUserId"
:simple-tree="treeViewIsSimple"
:show-other-replies-as-button="showOtherRepliesButtonInsideStatus"
:dive="() => diveIntoStatus(status.id)"
:controlled-showing-tall="statusContentProperties[status.id].showingTall"
:controlled-toggle-showing-tall="() => toggleStatusContentProperty(status.id, 'showingTall')"
:controlled-expanding-subject="statusContentProperties[status.id].expandingSubject"
:controlled-toggle-expanding-subject="() => toggleStatusContentProperty(status.id, 'expandingSubject')"
:controlled-showing-long-subject="statusContentProperties[status.id].showingLongSubject"
:controlled-toggle-showing-long-subject="() => toggleStatusContentProperty(status.id, 'showingLongSubject')"
:controlled-replying="statusContentProperties[status.id].replying"
:controlled-toggle-replying="() => toggleStatusContentProperty(status.id, 'replying')"
:controlled-media-playing="statusContentProperties[status.id].mediaPlaying"
:controlled-set-media-playing="(newVal) => toggleStatusContentProperty(status.id, 'mediaPlaying', newVal)"
can-dive
@goto="setHighlight"
@toggle-expanded="toggleExpanded"
@dive="() => diveIntoStatus(status.id)"
@suspendable-state-change="onStatusSuspendStateChange"
/>
<div
v-if="showOtherRepliesButtonBelowStatus && getReplies(status.id).length > 1"
@ -150,7 +140,7 @@
</div>
</article>
</div>
<thread-tree
<ThreadTree
v-for="status in showingTopLevel"
:key="status.id"
ref="statusComponent"
@ -166,20 +156,19 @@
:is-focused-function="isFocused"
:get-replies="getReplies"
:highlight="maybeHighlight"
:set-highlight="setHighlight"
:highlight="maybeHighlight === status.id"
:toggle-expanded="toggleExpanded"
:simple="treeViewIsSimple"
:toggle-thread-display="toggleThreadDisplay"
:thread-display-status="threadDisplayStatus"
:show-thread-recursively="showThreadRecursively"
:total-reply-count="totalReplyCount"
:total-reply-depth="totalReplyDepth"
:status-content-properties="statusContentProperties"
:set-status-content-property="setStatusContentProperty"
:toggle-status-content-property="toggleStatusContentProperty"
:dive="canDive ? diveIntoStatus : undefined"
:can-dive="canDive"
@goto="setHighlight"
@dive="diveIntoStatus"
@suspendable-state-change="onStatusSuspendStateChange"
/>
</div>
<div
@ -187,7 +176,7 @@
class="thread-body"
>
<article>
<status
<Status
v-for="status in conversation"
:key="status.id"
ref="statusComponent"
@ -197,7 +186,7 @@
:expandable="!isExpanded"
:focused="isFocused(status.id)"
:highlight="getHighlight()"
:highlight="maybeHighlight === status.id"
:inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-profile="inProfile"
@ -206,6 +195,7 @@
@goto="setHighlight"
@toggle-expanded="toggleExpanded"
@suspendable-state-change="onStatusSuspendStateChange"
/>
</article>
</div>

View file

@ -30,7 +30,7 @@ const ErrorModal = {
type: Error,
},
},
emits: ['clear', 'recover']
emits: ['clear', 'recover'],
}
export default ErrorModal

View file

@ -27,8 +27,10 @@ const Gallery = {
return {
sizes: {},
hidingLong: true,
playingMedia: new Set(),
}
},
emits: ['play', 'pause'],
components: { Attachment },
computed: {
rows() {
@ -115,11 +117,21 @@ const Gallery = {
return this.attachmentsDimensionalScore > 1
}
},
hasPlayingMedia() {
return this.playingMedia.size > 0
},
},
methods: {
onNaturalSizeLoad({ id, width, height }) {
set(this.sizes, id, { width, height })
},
onMediaStateChange(playing, id) {
if (playing) {
this.playingMedia.add(id)
} else {
this.playingMedia.delete(id)
}
},
rowStyle(row) {
if (row.audio) {
return { 'padding-bottom': '25%' } // fixed reduced height for audio
@ -146,6 +158,15 @@ const Gallery = {
useMediaViewerStore().setMedia(this.attachments)
},
},
watch: {
hasPlayingMedia(newValue) {
if (newValue) {
this.$emit('play')
} else {
this.$emit('pause')
}
},
},
}
export default Gallery

View file

@ -34,6 +34,8 @@
:style="itemStyle(attachment.id, row.items)"
@set-media="onMedia"
@natural-size-load="onNaturalSizeLoad"
@play="() => onMediaStateChange(true, attachment.id)"
@pause="() => onMediaStateChange(false, attachment.id)"
/>
</div>
</div>

View file

@ -1,9 +1,9 @@
import { mapActions, mapState } from 'pinia'
import ErrorModal from 'src/components/error_modal/error_modal.vue'
import { useInterfaceStore } from 'src/stores/interface.js'
import { mapState, mapActions } from 'pinia'
const GlobalError = {
components: {
ErrorModal,
@ -24,7 +24,11 @@ const GlobalError = {
details() {
if (this.globalError == null) return null
if (this.globalError.error != null) {
return this.globalError.error.toString() + '\n\n' + this.globalError.error.stack
return (
this.globalError.error.toString() +
'\n\n' +
this.globalError.error.stack
)
} else {
return this.globalError.details
}

View file

@ -50,7 +50,7 @@
</div>
<tab-switcher
class="list-member-management"
:scrollable-tabs
scrollable-tabs
>
<div
v-if="id || addedUserIds.size > 0"

View file

@ -133,7 +133,7 @@ const PostStatusForm = {
'resize',
'mediaplay',
'mediapause',
'can-close',
'close-accepted',
'update',
],
components: {
@ -963,19 +963,19 @@ const PostStatusForm = {
},
requestClose() {
if (!this.saveable) {
this.$emit('can-close')
this.$emit('close-accepted')
} else {
this.$refs.draftCloser.requestClose()
}
},
saveAndCloseDraft() {
this.saveDraft().then(() => {
this.$emit('can-close')
this.$emit('close-accepted')
})
},
discardAndCloseDraft() {
this.abandonDraft().then(() => {
this.$emit('can-close')
this.$emit('close-accepted')
})
},
addBeforeUnloadListener() {

View file

@ -63,7 +63,6 @@
:compact="false"
class="search-result"
:statusoid="status"
:no-heading="false"
/>
<button
v-if="!loading && loaded && lastStatusFetchCount > 0"

View file

@ -22,7 +22,7 @@
</transition>
<button
class="btn button-default"
:title="$t('general.minimize')"
:title="$t('general.peek')"
@click="toggleMinimizeModal"
>
<FAIcon

View file

@ -4,7 +4,7 @@
ref="tabSwitcher"
class="settings-admin-content settings_tab-switcher"
:side-tab-bar="true"
:scrollable-tabs
scrollable-tabs
:render-only-focused="true"
:body-scroll-lock="bodyLock"
>

View file

@ -2,7 +2,7 @@
<vertical-tab-switcher
ref="tabSwitcher"
class="settings_tab-switcher"
:scrollable-tabs
scrollable-tabs
:body-scroll-lock="bodyLock"
:hide-header="navHideHeader"
>

View file

@ -1,7 +1,7 @@
<template>
<tab-switcher
class="mutes-and-blocks-tab"
:scrollable-tabs
scrollable-tabs
>
<div
class="blocks"

View file

@ -75,44 +75,6 @@ library.add(
const camelCase = (name) => name.charAt(0).toUpperCase() + name.slice(1)
const controlledOrUncontrolledGetters = (list) =>
list.reduce((res, name) => {
const camelized = camelCase(name)
const toggle = `controlledToggle${camelized}`
const controlledName = `controlled${camelized}`
const uncontrolledName = `uncontrolled${camelized}`
res[name] = function () {
return (this.$data[toggle] !== undefined ||
this.$props[toggle] !== undefined) &&
this[toggle]
? this[controlledName]
: this[uncontrolledName]
}
return res
}, {})
const controlledOrUncontrolledToggle = (obj, name) => {
const camelized = camelCase(name)
const toggle = `controlledToggle${camelized}`
const uncontrolledName = `uncontrolled${camelized}`
if (obj[toggle]) {
obj[toggle]()
} else {
obj[uncontrolledName] = !obj[uncontrolledName]
}
}
const controlledOrUncontrolledSet = (obj, name, val) => {
const camelized = camelCase(name)
const set = `controlledSet${camelized}`
const uncontrolledName = `uncontrolled${camelized}`
if (obj[set]) {
obj[set](val)
} else {
obj[uncontrolledName] = val
}
}
const Status = {
name: 'Status',
components: {
@ -146,40 +108,33 @@ const Status = {
inProfile: Boolean,
inConversation: Boolean,
inQuote: Boolean,
canDive: Boolean,
profileUserId: String,
simpleTree: Boolean,
showOtherRepliesAsButton: Boolean,
dive: Function,
canDive: Boolean,
ignoreMute: Boolean,
controlledThreadDisplayStatus: String,
controlledToggleThreadDisplay: Function,
controlledShowingTall: Boolean,
controlledToggleShowingTall: Function,
controlledExpandingSubject: Boolean,
controlledToggleExpandingSubject: Function,
controlledShowingLongSubject: Boolean,
controlledToggleShowingLongSubject: Function,
controlledReplying: Boolean,
controlledToggleReplying: Function,
controlledMediaPlaying: Boolean,
controlledSetMediaPlaying: Function,
threadDisplayStatus: String,
},
emits: ['goto', 'toggleExpanded'],
emits: [
'goto',
'dive',
'toggleExpanded',
'suspendableStateChange'
],
data() {
return {
uncontrolledReplying: false,
replying: false,
unmuted: false,
userExpanded: false,
uncontrolledMediaPlaying: [],
suspendable: true,
mediaPlaying: new Set(),
error: null,
headTailLinks: null,
}
},
computed: {
...controlledOrUncontrolledGetters(['replying', 'mediaPlaying']),
showReasonMutedThread() {
return (
(this.status.thread_muted ||
@ -489,13 +444,13 @@ const Status = {
return useMergedConfigStore().mergedConfig
},
isSuspendable() {
return !this.replying && this.mediaPlaying.length === 0
return !this.replying && this.mediaPlaying.size === 0
},
inThreadForest() {
return !!this.controlledThreadDisplayStatus
return !!this.threadDisplayStatus
},
threadShowing() {
return this.controlledThreadDisplayStatus === 'showing'
return this.threadDisplayStatus === 'showing'
},
visibilityLocalized() {
return this.$i18n.t('general.scope_in_timeline.' + this.status.visibility)
@ -566,15 +521,17 @@ const Status = {
clearError() {
this.error = undefined
},
toggleReplying() {
toggleReplyForm() {
if (this.replying) {
// This emits 'close-accepted' if successful
// which in turn callse closeReply()
this.$refs.postStatusForm.requestClose()
} else {
this.doToggleReplying()
this.replying = true
}
},
doToggleReplying() {
controlledOrUncontrolledToggle(this, 'replying')
closeReplyForm() {
this.replying = false
},
gotoOriginal(id) {
if (this.inConversation) {
@ -598,18 +555,10 @@ const Status = {
)
},
addMediaPlaying(id) {
controlledOrUncontrolledSet(
this,
'mediaPlaying',
this.mediaPlaying.concat(id),
)
this.mediaPlaying.add(id)
},
removeMediaPlaying(id) {
controlledOrUncontrolledSet(
this,
'mediaPlaying',
this.mediaPlaying.filter((mediaId) => mediaId !== id),
)
this.mediaPlaying.delete(id)
},
setHeadTailLinks(headTailLinks) {
this.headTailLinks = headTailLinks
@ -659,8 +608,8 @@ const Status = {
this.$store.dispatch('fetchFavs', this.status.id)
}
},
isSuspendable: function (val) {
this.suspendable = val
isSuspendable: function (suspend) {
this.$emit('suspendableStateChange', { id: this.statusoid.id, suspend })
},
},
}

View file

@ -236,10 +236,10 @@
/>
</button>
<button
v-if="dive && !simpleTree"
v-if="canDive && !simpleTree"
class="button-unstyled"
:title="$t('status.show_only_conversation_under_this')"
@click.prevent="dive"
@click.prevent="$emit('dive')"
>
<FAIcon
fixed-width
@ -409,15 +409,9 @@
<StatusContent
ref="content"
:status="status"
:no-heading="noHeading"
:highlight="highlight"
:focused="isFocused"
:controlled-showing-tall="controlledShowingTall"
:controlled-expanding-subject="controlledExpandingSubject"
:controlled-showing-long-subject="controlledShowingLongSubject"
:controlled-toggle-showing-tall="controlledToggleShowingTall"
:controlled-toggle-expanding-subject="controlledToggleExpandingSubject"
:controlled-toggle-showing-long-subject="controlledToggleShowingLongSubject"
:in-conversation="inConversation"
@mediaplay="addMediaPlaying($event)"
@mediapause="removeMediaPlaying($event)"
@parse-ready="setHeadTailLinks"
@ -438,7 +432,7 @@
v-if="showOtherRepliesAsButton && replies.length > 1"
class="button-unstyled -link"
:title="$t('status.ancestor_follow', { numReplies: replies.length - 1 }, replies.length - 1)"
@click.prevent="dive"
@click.prevent="$emit('dive')"
>
{{ $t('status.replies_list_with_others', { numReplies: replies.length - 1 }, replies.length - 1) }}
</button>
@ -521,7 +515,7 @@
v-if="!noHeading && !isPreview"
:status="status"
:replying="replying"
@toggle-replying="toggleReplying"
@toggle-replying="toggleReplyForm"
/>
</div>
</div>
@ -555,9 +549,9 @@
:replied-user="status.user"
:copy-message-scope="status.visibility"
:subject="replySubject"
@posted="doToggleReplying"
@draft-done="doToggleReplying"
@can-close="doToggleReplying"
@posted="closeReplyForm"
@draft-done="closeReplyForm"
@close-accepted="closeReplyForm"
/>
</div>
</template>

View file

@ -15,32 +15,47 @@ library.add(faFile, faMusic, faImage, faLink, faPollH)
const StatusBody = {
name: 'StatusBody',
props: [
'compact',
'collapse', // replaces newlines with spaces
'status',
'focused',
'noHeading',
'fullContent',
'singleLine',
'showingTall',
'expandingSubject',
'showingLongSubject',
'toggleShowingTall',
'toggleExpandingSubject',
'toggleShowingLongSubject',
],
props: {
status: {
// Main thing
type: Object,
required: true,
},
compact: {
// Resizes emoji and minimizes vertical space used
// Primarily used for showing status in react notifications
type: Boolean,
default: false,
},
collapse: {
// replaces newlines with spaces
type: Boolean,
default: false,
},
singleLine: {
// Show entire thing (subject and content) in a single line
// Primarily used in chats
type: Boolean,
default: false,
},
inConversation: {
// Is status rendered within open conversation?
// Used to automatically expand subjects (if collapsed)
type: Boolean,
default: false,
}
},
data() {
return {
postLength: this.status.text.length,
parseReadyDone: false,
showingTall: false,
showingLongSubject: false,
expandingSubject: null,
}
},
emits: ['parseReady'],
computed: {
localCollapseSubjectDefault() {
return this.mergedConfig.collapseMessageWithSubject
},
allowNonSquareEmoji() {
return this.mergedConfig.nonSquareEmoji
},
@ -51,32 +66,31 @@ const StatusBody = {
//
// Using max-height + overflow: auto for status components resulted in false positives
// very often with japanese characters, and it was very annoying.
tallStatus() {
hasLongSubject() {
return this.status.summary.length > 240
},
hasSubject() {
return !!this.status.summary
},
// When a status has a subject and is also tall, we should only have one show more/less
// button. If the default is to collapse statuses with subjects, we just treat it like
// a status with a subject; otherwise, we just treat it like a tall status.
mightHideBecauseSubject() {
return !this.inConversation && this.hasSubject && this.mergedConfig.collapseMessageWithSubject
},
mightHideBecauseTall() {
if (this.singleLine || this.compact) return false
const lengthScore =
this.status.raw_html.split(/<p|<br/).length + this.postLength / 80
return lengthScore > 20
},
longSubject() {
return this.status.summary.length > 240
},
// When a status has a subject and is also tall, we should only have one show more/less button. If the default is to collapse statuses with subjects, we just treat it like a status with a subject; otherwise, we just treat it like a tall status.
mightHideBecauseSubject() {
return !!this.status.summary && this.localCollapseSubjectDefault
},
mightHideBecauseTall() {
return (
this.tallStatus &&
!(this.status.summary && this.localCollapseSubjectDefault)
)
},
hideSubjectStatus() {
return this.mightHideBecauseSubject && !this.expandingSubject
},
hideTallStatus() {
return this.mightHideBecauseTall && !this.showingTall
},
shouldShowToggle() {
shouldShowExpandToggle() {
return this.mightHideBecauseSubject || this.mightHideBecauseTall
},
toggleButtonClasses() {
@ -97,6 +111,11 @@ const StatusBody = {
: this.$t('general.show_more')
}
},
shouldHide() {
return (
!this.showingMore && this.mightHideBecauseSubject && this.hasSubject
)
},
showingMore() {
return (
(this.mightHideBecauseTall && this.showingTall) ||
@ -147,9 +166,9 @@ const StatusBody = {
},
toggleShowMore() {
if (this.mightHideBecauseTall) {
this.toggleShowingTall()
this.showingTall = !this.showingTall
} else if (this.mightHideBecauseSubject) {
this.toggleExpandingSubject()
this.expandingSubject = !this.expandingSubject
}
},
generateTagLink(tag) {

View file

@ -53,6 +53,7 @@
}
.text-wrapper {
position: relative;
text-overflow: ellipsis;
overflow-wrap: break-word;
overflow: hidden;
@ -60,10 +61,12 @@
flex-flow: column nowrap;
&.-tall-status {
position: relative;
height: 16em;
z-index: 1;
&:not(.-hidden) {
height: 16em;
}
.media-body {
min-height: 0;
mask:
@ -98,6 +101,7 @@
text-wrap: pretty;
width: 100%;
text-align: center;
margin: 0.1em 0;
}
.status-unhider {
@ -107,17 +111,17 @@
padding-bottom: 1em;
}
.tall-status-hider {
position: absolute;
height: 5em;
margin-top: 10em;
line-height: 8em;
z-index: 2;
}
.tall-subject-hider {
// position: absolute;
padding-bottom: 0.5em;
&:not(.cw-status-hider) {
position: absolute;
margin-top: 10em;
height: 5em;
line-height: 8em;
z-index: 2;
}
}
& .status-unhider,

View file

@ -5,9 +5,9 @@
>
<div class="body">
<div
v-if="status.summary_raw_html"
v-if="hasSubject"
class="summary-wrapper"
:class="{ '-tall': (longSubject && !showingLongSubject) }"
:class="{ '-tall': (hasLongSubject && !showingLongSubject) }"
>
<RichContent
class="media-body summary"
@ -18,14 +18,14 @@
:allow-non-square-emoji="allowNonSquareEmoji"
/>
<button
v-show="longSubject && showingLongSubject"
v-show="hasLongSubject && showingLongSubject"
class="button-unstyled -link tall-subject-hider"
@click.prevent="toggleShowingLongSubject"
>
{{ $t("status.hide_full_subject") }}
</button>
<button
v-show="longSubject && !showingLongSubject"
v-show="hasLongSubject && !showingLongSubject"
class="button-unstyled -link tall-subject-hider"
@click.prevent="toggleShowingLongSubject"
>
@ -34,10 +34,10 @@
</div>
<div
class="text-wrapper"
:class="{'-tall-status': hideTallStatus, '-expanded': showingMore}"
:class="{'-tall-status': hideTallStatus, '-hidden': shouldHide, '-expanded': showingMore}"
>
<RichContent
v-if="!hideSubjectStatus && !(singleLine && status.summary_raw_html)"
v-if="!(singleLine && hasSubject) && !shouldHide"
:class="{ '-single-line': singleLine }"
class="text media-body"
:html="status.raw_html"
@ -52,12 +52,11 @@
@parse-ready="onParseReady"
/>
<div
v-show="shouldShowToggle"
v-show="shouldShowExpandToggle"
:class="toggleButtonClasses"
>
<button
class="btn button-default toggle-button"
:class="{ '-focused': focused }"
:aria-expanded="showingMore"
@click.prevent="toggleShowMore"
>

View file

@ -22,69 +22,40 @@ import {
library.add(faCircleNotch, faFile, faMusic, faImage, faLink, faPollH)
const camelCase = (name) => name.charAt(0).toUpperCase() + name.slice(1)
const controlledOrUncontrolledGetters = (list) =>
list.reduce((res, name) => {
const camelized = camelCase(name)
const toggle = `controlledToggle${camelized}`
const controlledName = `controlled${camelized}`
const uncontrolledName = `uncontrolled${camelized}`
res[name] = function () {
return (this.$data[toggle] !== undefined ||
this.$props[toggle] !== undefined) &&
this[toggle]
? this[controlledName]
: this[uncontrolledName]
}
return res
}, {})
const controlledOrUncontrolledToggle = (obj, name) => {
const camelized = camelCase(name)
const toggle = `controlledToggle${camelized}`
const uncontrolledName = `uncontrolled${camelized}`
if (obj[toggle]) {
obj[toggle]()
} else {
obj[uncontrolledName] = !obj[uncontrolledName]
}
}
const StatusContent = {
name: 'StatusContent',
props: [
'status',
'compact',
'collapse',
'focused',
'noHeading',
'fullContent',
'singleLine',
'controlledShowingTall',
'controlledExpandingSubject',
'controlledToggleShowingTall',
'controlledToggleExpandingSubject',
'controlledShowingLongSubject',
'controlledToggleShowingLongSubject',
],
emits: ['parseReady', 'mediaplay', 'mediapause'],
data() {
return {
uncontrolledShowingTall:
this.fullContent || (this.inConversation && this.focused),
uncontrolledShowingLongSubject: false,
// not as computed because it sets the initial state which will be changed later
uncontrolledExpandingSubject:
!useMergedConfigStore().mergedConfig.collapseMessageWithSubject,
}
props: {
status: {
// Main thing
type: Object,
required: true,
},
compact: {
// Resizes emoji and minimizes vertical space used
// Primarily used for showing status in react notifications
type: Boolean,
default: false,
},
collapse: {
// replaces newlines with spaces
type: Boolean,
default: false,
},
singleLine: {
// Show entire thing (subject and content) in a single line
// Primarily used in chats
type: Boolean,
default: false,
},
inConversation: {
// Whether status content is being shown in an (open) conversation
// Used to control whether to display attachments or not
type: Boolean,
default: false,
},
},
emits: ['parseReady', 'mediaplay', 'mediapause'],
computed: {
...controlledOrUncontrolledGetters([
'showingTall',
'expandingSubject',
'showingLongSubject',
]),
statusCard() {
if (!this.status.card) return null
return this.status.card.url === this.status.quote_url
@ -93,22 +64,20 @@ const StatusContent = {
},
hideAttachments() {
return (
(this.mergedConfig.hideAttachments && !this.inConversation) ||
(this.mergedConfig.hideAttachmentsInConv && this.inConversation)
!this.fullContent &&
((this.mergedConfig.hideAttachments && !this.inConversation) ||
(this.mergedConfig.hideAttachmentsInConv && this.inConversation))
)
},
nsfwClickthrough() {
if (!this.status.nsfw) {
return false
}
if (this.status.summary && this.localCollapseSubjectDefault) {
if (this.status.summary && this.mergedConfig.collapseMessageWithSubject) {
return false
}
return true
},
localCollapseSubjectDefault() {
return this.mergedConfig.collapseMessageWithSubject
},
attachmentSize() {
if (this.compact) {
return 'small'
@ -137,15 +106,6 @@ const StatusContent = {
StatusBody,
},
methods: {
toggleShowingTall() {
controlledOrUncontrolledToggle(this, 'showingTall')
},
toggleExpandingSubject() {
controlledOrUncontrolledToggle(this, 'expandingSubject')
},
toggleShowingLongSubject() {
controlledOrUncontrolledToggle(this, 'showingLongSubject')
},
setMedia() {
const attachments =
this.attachmentSize === 'hide'

View file

@ -8,13 +8,8 @@
:status="status"
:compact="compact"
:single-line="singleLine"
:showing-tall="showingTall"
:expanding-subject="expandingSubject"
:showing-long-subject="showingLongSubject"
:toggle-showing-tall="toggleShowingTall"
:toggle-expanding-subject="toggleExpandingSubject"
:toggle-showing-long-subject="toggleShowingLongSubject"
:collapse="collapse"
:in-conversation="inConversation"
@parse-ready="$emit('parseReady', $event)"
>
<div v-if="status.poll && status.poll.options && !compact">
@ -42,12 +37,12 @@
:attachments="status.attachments"
:limit="compact ? 1 : 0"
:size="attachmentSize"
@play="$emit('mediaplay', attachment.id)"
@pause="$emit('mediapause', attachment.id)"
@play="$emit('mediaplay')"
@pause="$emit('mediapause')"
/>
<div
v-if="statusCard && !noHeading && !compact"
v-if="statusCard && !compact"
class="link-preview media-body"
>
<link-preview

View file

@ -26,30 +26,14 @@ const ThreadTree = {
toggleExpanded: Function,
simple: Boolean,
// to control display of the whole thread forest
toggleThreadDisplay: Function,
canDive: Boolean,
threadDisplayStatus: Object,
showThreadRecursively: Function,
totalReplyCount: Object,
totalReplyDepth: Object,
statusContentProperties: Object,
setStatusContentProperty: Function,
toggleStatusContentProperty: Function,
dive: Function,
},
emits: ['suspendableStateChange', 'goto', 'dive'],
computed: {
suspendable() {
const selfSuspendable = this.$refs.statusComponent
? this.$refs.statusComponent.suspendable
: true
if (this.$refs.childComponent) {
return (
selfSuspendable &&
this.$refs.childComponent.every((s) => s.suspendable)
)
}
return selfSuspendable
},
reverseLookupTable() {
return this.conversation.reduce(
(table, status, index) => {
@ -69,29 +53,11 @@ const ThreadTree = {
threadShowing() {
return this.threadDisplayStatus[this.status.id] === 'showing'
},
currentProp() {
return this.statusContentProperties[this.status.id]
},
},
methods: {
statusById(id) {
return this.conversation[this.reverseLookupTable[id]]
},
collapseThread() {
/* no-op */
},
showThread() {
/* no-op */
},
showAllSubthreads() {
/* no-op */
},
toggleCurrentProp(name) {
this.toggleStatusContentProperty(this.status.id, name)
},
setCurrentProp(name) {
this.setStatusContentProperty(this.status.id, name)
},
},
}

View file

@ -1,44 +1,34 @@
<template>
<article class="thread-tree">
<status
<Status
:key="status.id"
ref="statusComponent"
:inline-expanded="collapsable && isExpanded"
:statusoid="status"
:replies="getReplies(status.id)"
:inline-expanded="collapsable && isExpanded"
:expandable="!isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:focused="isFocusedFunction(status.id)"
:in-conversation="isExpanded"
:highlight="highlight"
:replies="getReplies(status.id)"
:highlight="highlight === status.id"
:in-profile="inProfile"
:profile-user-id="profileUserId"
class="conversation-status conversation-status-treeview status-fadein panel-body"
:simple-tree="simple"
:controlled-thread-display-status="threadDisplayStatus[status.id]"
:controlled-toggle-thread-display="() => toggleThreadDisplay(status.id)"
:thread-display-status="threadDisplayStatus[status.id]"
:can-dive="canDive"
:controlled-showing-tall="currentProp.showingTall"
:controlled-expanding-subject="currentProp.expandingSubject"
:controlled-showing-long-subject="currentProp.showingLongSubject"
:controlled-replying="currentProp.replying"
:controlled-media-playing="currentProp.mediaPlaying"
:controlled-toggle-showing-tall="() => toggleCurrentProp('showingTall')"
:controlled-toggle-expanding-subject="() => toggleCurrentProp('expandingSubject')"
:controlled-toggle-showing-long-subject="() => toggleCurrentProp('showingLongSubject')"
:controlled-toggle-replying="() => toggleCurrentProp('replying')"
:controlled-set-media-playing="(newVal) => setCurrentProp('mediaPlaying', newVal)"
:dive="dive ? () => dive(status.id) : undefined"
@goto="setHighlight"
@dive="$emit('dive', status.id)"
@goto="$emit('goto', status.id)"
@toggle-expanded="toggleExpanded"
@suspendable-state-change="e => $emit('suspendableStateChange', e)"
/>
<div
v-if="currentReplies.length && threadShowing"
v-if="currentReplies.length > 0 && threadShowing"
class="thread-tree-replies"
>
<thread-tree
<ThreadTree
v-for="replyStatus in currentReplies"
:key="replyStatus.id"
ref="childComponent"
@ -59,15 +49,15 @@
:toggle-expanded="toggleExpanded"
:simple="simple"
:toggle-thread-display="toggleThreadDisplay"
:thread-display-status="threadDisplayStatus"
:show-thread-recursively="showThreadRecursively"
:total-reply-count="totalReplyCount"
:total-reply-depth="totalReplyDepth"
:status-content-properties="statusContentProperties"
:set-status-content-property="setStatusContentProperty"
:toggle-status-content-property="toggleStatusContentProperty"
:dive="dive"
:can-dive="canDive"
@goto="(e) => $emit('goto', e)"
@dive="(e) => $emit('dive', e)"
@suspendable-state-change="e => $emit('suspendableStateChange', e)"
/>
</div>
<div
@ -80,7 +70,7 @@
tag="button"
keypath="status.thread_follow_with_icon"
class="button-unstyled -link thread-tree-show-replies-button"
@click.prevent="dive(status.id)"
@click.prevent="$emit('dive', status.id)"
>
<template #icon>
<FAIcon

View file

@ -11,11 +11,11 @@ import Checkbox from 'src/components/checkbox/checkbox.vue'
import ColorInput from 'src/components/color_input/color_input.vue'
import EmojiInput from 'src/components/emoji_input/emoji_input.vue'
import suggestor from 'src/components/emoji_input/suggestor.js'
import FollowButton from 'src/components/follow_button/follow_button.vue'
import ProgressButton from 'src/components/progress_button/progress_button.vue'
import Select from 'src/components/select/select.vue'
import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
import UserLink from 'src/components/user_link/user_link.vue'
import FollowButton from 'src/components/follow_button/follow_button.vue'
import { useEmojiStore } from 'src/stores/emoji.js'
import { useInstanceStore } from 'src/stores/instance.js'

View file

@ -1,9 +1,8 @@
import { defineAsyncComponent } from 'vue'
import { mapState } from 'vuex'
import AuthForm from 'src/components/auth_form/auth_form.js'
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
import UserCard from 'src/components/user_card/user_card.vue'
import AuthForm from 'src/components/auth_form/auth_form.js'
const UserPanel = {
computed: {
@ -15,6 +14,7 @@ const UserPanel = {
components: {
PostStatusForm,
UserCard,
AuthForm,
},
}

View file

@ -11,7 +11,7 @@
/>
<PostStatusForm />
</div>
<auth-form
<AuthForm
v-else
key="user-panel"
/>

View file

@ -199,7 +199,7 @@ export const useInterfaceStore = defineStore('interface', {
console.log(this.globalError)
},
clearGlobalError() {
this.globalError = null;
this.globalError = null
},
pushGlobalNotice({
messageKey,

View file

@ -1,5 +1,8 @@
/* eslint-env serviceworker */
// biome-ignore: side effect import of assets list
import 'virtual:pleroma-fe/service_worker_env'
import { createI18n } from 'vue-i18n'
import { storage } from 'src/lib/storage.js'