Merge branch 'chat-refactor' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-07-30 20:50:43 +03:00
commit d736f1d18d
5 changed files with 36 additions and 47 deletions

View file

@ -85,13 +85,9 @@
</div> </div>
<PostStatusForm <PostStatusForm
ref="postStatusForm" ref="postStatusForm"
:reply-to="replyStatus?.id" :replied-status="replyStatus"
:mentions-line="isConversation" :mentions-line="isConversation"
mentions-line-read-only mentions-line-read-only
:attentions="replyStatus?.attentions"
:replied-user="replyStatus?.user"
:replied-subject="replyStatus?.summary"
:replied-scope="replyStatus?.visibility"
disable-quotes disable-quotes
disable-notice disable-notice

View file

@ -85,12 +85,8 @@ const PostStatusForm = {
statusContentType: String, statusContentType: String,
// Replies/mentions // Replies/mentions
replyTo: String, // id of the post replying to repliedStatus: Object, // Object of a status replying to
repliedUser: Object, // user object replying to profileMention: Object, // Mentioned user (used in profile page -> mention)
attentions: Array, // list of users mentioned
repliedScope: String, // scope of the post replying to
repliedSubject: String, // subject of post replying to
profileMention: Boolean, // is mentioning a user (used in profile page -> mention)
// Draft stuff // Draft stuff
hideDraft: Boolean, // Disable drafts functionality hideDraft: Boolean, // Disable drafts functionality
@ -219,12 +215,12 @@ const PostStatusForm = {
mounted() { mounted() {
this.resize(this.$refs.textarea) this.resize(this.$refs.textarea)
if (this.replyTo) { if (this.repliedStatus) {
const textLength = this.$refs.textarea.value.length const textLength = this.$refs.textarea.value.length
this.$refs.textarea.setSelectionRange(textLength, textLength) this.$refs.textarea.setSelectionRange(textLength, textLength)
} }
if (this.replyTo || this.autoFocus) { if (this.repliedStatus || this.autoFocus) {
this.$refs.textarea.focus() this.$refs.textarea.focus()
} }
}, },
@ -242,9 +238,9 @@ const PostStatusForm = {
// Composing stuff // Composing stuff
statusType() { statusType() {
if (this.replyTo) { if (this.repliedStatus) {
return 'reply' return 'reply'
} else if (this.profileMention && this.repliedUser?.id) { } else if (this.profileMention) {
return 'mention' return 'mention'
} else if (this.statusId) { } else if (this.statusId) {
return 'edit' return 'edit'
@ -253,10 +249,10 @@ const PostStatusForm = {
} }
}, },
refId() { refId() {
if (this.replyTo) { if (this.repliedStatus) {
return this.replyTo return this.repliedStatus.id
} else if (this.profileMention && this.repliedUser?.id) { } else if (this.profileMention) {
return this.profileMention && this.repliedUser?.id return this.profileMention.id
} else if (this.statusId) { } else if (this.statusId) {
return this.statusId return this.statusId
} else { } else {
@ -266,9 +262,10 @@ const PostStatusForm = {
mentionsString() { mentionsString() {
if (this.statusType !== 'reply' && this.statusType !== 'mention') if (this.statusType !== 'reply' && this.statusType !== 'mention')
return '' return ''
let allAttentions = [...(this.newStatus.mentions || [])] let allAttentions = [...(this.repliedStatus?.attentions || [])]
const repliedUser = this.repliedStatus?.user || this.profileMention
if (this.repliedUser) allAttentions.unshift(this.repliedUser) if (repliedUser) allAttentions.unshift(repliedUser)
allAttentions = uniqBy(allAttentions, 'id') allAttentions = uniqBy(allAttentions, 'id')
allAttentions = reject(allAttentions, { id: this.currentUser.id }) allAttentions = reject(allAttentions, { id: this.currentUser.id })
@ -292,11 +289,13 @@ const PostStatusForm = {
mediaDescriptions: {}, mediaDescriptions: {},
} }
const scope = const scope = (() => {
(this.repliedScope && this.userDefaultScopeCopy) || if (this.repliedStatus) {
this.repliedScope === 'direct' if (this.repliedStatus.visibility === 'direct') return 'direct'
? this.repliedScope if (this.userDefaultScopeCopy) return this.repliedStatus.visibility
: this.userDefaultScope }
return this.userDefaultScope
})()
const preset = this.$route.query.message const preset = this.$route.query.message
const statusText = preset ?? '' const statusText = preset ?? ''
@ -307,7 +306,7 @@ const PostStatusForm = {
defaultNewStatus.status = this.mentionsString + statusText defaultNewStatus.status = this.mentionsString + statusText
} }
defaultNewStatus.mentions = this.attentions defaultNewStatus.mentions = this.mentionsString
defaultNewStatus.spoilerText = this.repliedSubjectString ?? '' defaultNewStatus.spoilerText = this.repliedSubjectString ?? ''
defaultNewStatus.nsfw = this.userDefaultSensitive defaultNewStatus.nsfw = this.userDefaultSensitive
defaultNewStatus.visibility = scope defaultNewStatus.visibility = scope
@ -327,12 +326,12 @@ const PostStatusForm = {
return !this.hasQuote || return !this.hasQuote ||
!this.newStatus.quote.thread || !this.newStatus.quote.thread ||
!this.newStatus.quote.id !this.newStatus.quote.id
? this.replyTo ? this.repliedStatus?.id
: undefined : undefined
}, },
repliedSubjectString() { repliedSubjectString() {
if (!this.repliedSubject) return null if (!this.repliedStatus?.summary) return null
const decodedSummary = ldUnescape(this.repliedSubject) const decodedSummary = ldUnescape(this.repliedStatus.summary)
const behavior = this.mergedConfig.subjectLineBehavior const behavior = this.mergedConfig.subjectLineBehavior
const startsWithRe = decodedSummary.match(/^re[: ]/i) const startsWithRe = decodedSummary.match(/^re[: ]/i)
if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') { if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') {
@ -352,7 +351,7 @@ const PostStatusForm = {
return this.newStatus.quote !== null return this.newStatus.quote !== null
}, },
quotable() { quotable() {
return this.quotingAvailable && this.replyTo return this.quotingAvailable && this.repliedStatus?.id
}, },
defaultQuotable() { defaultQuotable() {
if ( if (
@ -363,20 +362,18 @@ const PostStatusForm = {
return false return false
} }
const repliedStatus = if (!this.repliedStatus) {
this.$store.state.statuses.allStatusesObject[this.replyTo]
if (!repliedStatus) {
return false return false
} }
if ( if (
repliedStatus.visibility === 'public' || this.repliedStatus.visibility === 'public' ||
repliedStatus.visibility === 'unlisted' || this.repliedStatus.visibility === 'unlisted' ||
repliedStatus.visibility === 'local' this.repliedStatus.visibility === 'local'
) { ) {
return true return true
} else if (repliedStatus.visibility === 'private') { } else if (this.repliedStatus.visibility === 'private') {
return repliedStatus.user.id === this.currentUser.id return this.repliedStatus.user.id === this.currentUser.id
} }
return false return false
@ -392,7 +389,7 @@ const PostStatusForm = {
if (value) { if (value) {
this.newStatus.quote = {} this.newStatus.quote = {}
this.newStatus.quote.thread = value this.newStatus.quote.thread = value
this.newStatus.quote.id = value ? this.replyTo : '' this.newStatus.quote.id = value ? this.repliedStatus.id : ''
} else { } else {
this.newStatus.quote = null this.newStatus.quote = null
} }

View file

@ -200,6 +200,7 @@ const Status = {
) )
}, },
status() { status() {
console.log('s', this.statusoid)
if (this.retweet) { if (this.retweet) {
return this.statusoid.retweeted_status return this.statusoid.retweeted_status
} else { } else {

View file

@ -546,11 +546,7 @@
ref="postStatusForm" ref="postStatusForm"
class="reply-body" class="reply-body"
:closeable="true" :closeable="true"
:reply-to="status.id" :replied-status="status"
:attentions="status.attentions"
:replied-user="status.user"
:replied-scope="status.visibility"
:replied-subject="status.summary"
@posted="closeReplyForm" @posted="closeReplyForm"
@draft-done="closeReplyForm" @draft-done="closeReplyForm"
@close-accepted="closeReplyForm" @close-accepted="closeReplyForm"

View file

@ -491,8 +491,7 @@ export default {
}, },
mentionUser() { mentionUser() {
usePostStatusStore().openPostStatusModal({ usePostStatusStore().openPostStatusModal({
profileMention: true, profileMention: this.user,
repliedUser: this.user,
}) })
}, },
onAvatarClickHandler(e) { onAvatarClickHandler(e) {