Compare commits

..

No commits in common. "d736f1d18d271cd3e2cadd2a60e014aab0287c46" and "a50790ecffa2051b047f8c6f29aa2b7f4066cec7" have entirely different histories.

5 changed files with 47 additions and 36 deletions

View file

@ -85,9 +85,13 @@
</div> </div>
<PostStatusForm <PostStatusForm
ref="postStatusForm" ref="postStatusForm"
:replied-status="replyStatus" :reply-to="replyStatus?.id"
: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,8 +85,12 @@ const PostStatusForm = {
statusContentType: String, statusContentType: String,
// Replies/mentions // Replies/mentions
repliedStatus: Object, // Object of a status replying to replyTo: String, // id of the post replying to
profileMention: Object, // Mentioned user (used in profile page -> mention) repliedUser: Object, // user object replying to
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
@ -215,12 +219,12 @@ const PostStatusForm = {
mounted() { mounted() {
this.resize(this.$refs.textarea) this.resize(this.$refs.textarea)
if (this.repliedStatus) { if (this.replyTo) {
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.repliedStatus || this.autoFocus) { if (this.replyTo || this.autoFocus) {
this.$refs.textarea.focus() this.$refs.textarea.focus()
} }
}, },
@ -238,9 +242,9 @@ const PostStatusForm = {
// Composing stuff // Composing stuff
statusType() { statusType() {
if (this.repliedStatus) { if (this.replyTo) {
return 'reply' return 'reply'
} else if (this.profileMention) { } else if (this.profileMention && this.repliedUser?.id) {
return 'mention' return 'mention'
} else if (this.statusId) { } else if (this.statusId) {
return 'edit' return 'edit'
@ -249,10 +253,10 @@ const PostStatusForm = {
} }
}, },
refId() { refId() {
if (this.repliedStatus) { if (this.replyTo) {
return this.repliedStatus.id return this.replyTo
} else if (this.profileMention) { } else if (this.profileMention && this.repliedUser?.id) {
return this.profileMention.id return this.profileMention && this.repliedUser?.id
} else if (this.statusId) { } else if (this.statusId) {
return this.statusId return this.statusId
} else { } else {
@ -262,10 +266,9 @@ const PostStatusForm = {
mentionsString() { mentionsString() {
if (this.statusType !== 'reply' && this.statusType !== 'mention') if (this.statusType !== 'reply' && this.statusType !== 'mention')
return '' return ''
let allAttentions = [...(this.repliedStatus?.attentions || [])] let allAttentions = [...(this.newStatus.mentions || [])]
const repliedUser = this.repliedStatus?.user || this.profileMention
if (repliedUser) allAttentions.unshift(repliedUser) if (this.repliedUser) allAttentions.unshift(this.repliedUser)
allAttentions = uniqBy(allAttentions, 'id') allAttentions = uniqBy(allAttentions, 'id')
allAttentions = reject(allAttentions, { id: this.currentUser.id }) allAttentions = reject(allAttentions, { id: this.currentUser.id })
@ -289,13 +292,11 @@ const PostStatusForm = {
mediaDescriptions: {}, mediaDescriptions: {},
} }
const scope = (() => { const scope =
if (this.repliedStatus) { (this.repliedScope && this.userDefaultScopeCopy) ||
if (this.repliedStatus.visibility === 'direct') return 'direct' this.repliedScope === 'direct'
if (this.userDefaultScopeCopy) return this.repliedStatus.visibility ? this.repliedScope
} : this.userDefaultScope
return this.userDefaultScope
})()
const preset = this.$route.query.message const preset = this.$route.query.message
const statusText = preset ?? '' const statusText = preset ?? ''
@ -306,7 +307,7 @@ const PostStatusForm = {
defaultNewStatus.status = this.mentionsString + statusText defaultNewStatus.status = this.mentionsString + statusText
} }
defaultNewStatus.mentions = this.mentionsString defaultNewStatus.mentions = this.attentions
defaultNewStatus.spoilerText = this.repliedSubjectString ?? '' defaultNewStatus.spoilerText = this.repliedSubjectString ?? ''
defaultNewStatus.nsfw = this.userDefaultSensitive defaultNewStatus.nsfw = this.userDefaultSensitive
defaultNewStatus.visibility = scope defaultNewStatus.visibility = scope
@ -326,12 +327,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.repliedStatus?.id ? this.replyTo
: undefined : undefined
}, },
repliedSubjectString() { repliedSubjectString() {
if (!this.repliedStatus?.summary) return null if (!this.repliedSubject) return null
const decodedSummary = ldUnescape(this.repliedStatus.summary) const decodedSummary = ldUnescape(this.repliedSubject)
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') {
@ -351,7 +352,7 @@ const PostStatusForm = {
return this.newStatus.quote !== null return this.newStatus.quote !== null
}, },
quotable() { quotable() {
return this.quotingAvailable && this.repliedStatus?.id return this.quotingAvailable && this.replyTo
}, },
defaultQuotable() { defaultQuotable() {
if ( if (
@ -362,18 +363,20 @@ const PostStatusForm = {
return false return false
} }
if (!this.repliedStatus) { const repliedStatus =
this.$store.state.statuses.allStatusesObject[this.replyTo]
if (!repliedStatus) {
return false return false
} }
if ( if (
this.repliedStatus.visibility === 'public' || repliedStatus.visibility === 'public' ||
this.repliedStatus.visibility === 'unlisted' || repliedStatus.visibility === 'unlisted' ||
this.repliedStatus.visibility === 'local' repliedStatus.visibility === 'local'
) { ) {
return true return true
} else if (this.repliedStatus.visibility === 'private') { } else if (repliedStatus.visibility === 'private') {
return this.repliedStatus.user.id === this.currentUser.id return repliedStatus.user.id === this.currentUser.id
} }
return false return false
@ -389,7 +392,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.repliedStatus.id : '' this.newStatus.quote.id = value ? this.replyTo : ''
} else { } else {
this.newStatus.quote = null this.newStatus.quote = null
} }

View file

@ -200,7 +200,6 @@ 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,7 +546,11 @@
ref="postStatusForm" ref="postStatusForm"
class="reply-body" class="reply-body"
:closeable="true" :closeable="true"
:replied-status="status" :reply-to="status.id"
: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,7 +491,8 @@ export default {
}, },
mentionUser() { mentionUser() {
usePostStatusStore().openPostStatusModal({ usePostStatusStore().openPostStatusModal({
profileMention: this.user, profileMention: true,
repliedUser: this.user,
}) })
}, },
onAvatarClickHandler(e) { onAvatarClickHandler(e) {