Implement sending quote posts
This commit is contained in:
parent
1c20487494
commit
d72486f3e4
@ -156,7 +156,8 @@ const PostStatusForm = {
|
|||||||
poll: this.statusPoll || {},
|
poll: this.statusPoll || {},
|
||||||
mediaDescriptions: this.statusMediaDescriptions || {},
|
mediaDescriptions: this.statusMediaDescriptions || {},
|
||||||
visibility: this.statusScope || scope,
|
visibility: this.statusScope || scope,
|
||||||
contentType: statusContentType
|
contentType: statusContentType,
|
||||||
|
quoting: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +266,24 @@ const PostStatusForm = {
|
|||||||
isEdit () {
|
isEdit () {
|
||||||
return typeof this.statusId !== 'undefined' && this.statusId.trim() !== ''
|
return typeof this.statusId !== 'undefined' && this.statusId.trim() !== ''
|
||||||
},
|
},
|
||||||
|
quotable () {
|
||||||
|
if (!this.replyTo) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const repliedStatus = this.$store.state.statuses.allStatusesObject[this.replyTo]
|
||||||
|
if (!repliedStatus) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (repliedStatus.visibility === 'public' ||
|
||||||
|
repliedStatus.visibility === 'unlisted' ||
|
||||||
|
repliedStatus.visibility === 'local') {
|
||||||
|
return true
|
||||||
|
} else if (repliedStatus.visibility === 'private') {
|
||||||
|
return repliedStatus.account.id === this.$store.state.users.currentUser.id
|
||||||
|
}
|
||||||
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
...mapState({
|
...mapState({
|
||||||
mobileLayout: state => state.interface.mobileLayout
|
mobileLayout: state => state.interface.mobileLayout
|
||||||
@ -292,7 +311,8 @@ const PostStatusForm = {
|
|||||||
visibility: newStatus.visibility,
|
visibility: newStatus.visibility,
|
||||||
contentType: newStatus.contentType,
|
contentType: newStatus.contentType,
|
||||||
poll: {},
|
poll: {},
|
||||||
mediaDescriptions: {}
|
mediaDescriptions: {},
|
||||||
|
quoting: false
|
||||||
}
|
}
|
||||||
this.pollFormVisible = false
|
this.pollFormVisible = false
|
||||||
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
|
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
|
||||||
@ -340,6 +360,8 @@ const PostStatusForm = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const replyOrQuoteAttr = newStatus.quoting ? 'quoteId' : 'inReplyToStatusId'
|
||||||
|
|
||||||
const postingOptions = {
|
const postingOptions = {
|
||||||
status: newStatus.status,
|
status: newStatus.status,
|
||||||
spoilerText: newStatus.spoilerText || null,
|
spoilerText: newStatus.spoilerText || null,
|
||||||
@ -347,7 +369,7 @@ const PostStatusForm = {
|
|||||||
sensitive: newStatus.nsfw,
|
sensitive: newStatus.nsfw,
|
||||||
media: newStatus.files,
|
media: newStatus.files,
|
||||||
store: this.$store,
|
store: this.$store,
|
||||||
inReplyToStatusId: this.replyTo,
|
[replyOrQuoteAttr]: this.replyTo,
|
||||||
contentType: newStatus.contentType,
|
contentType: newStatus.contentType,
|
||||||
poll,
|
poll,
|
||||||
idempotencyKey: this.idempotencyKey
|
idempotencyKey: this.idempotencyKey
|
||||||
@ -373,6 +395,7 @@ const PostStatusForm = {
|
|||||||
}
|
}
|
||||||
const newStatus = this.newStatus
|
const newStatus = this.newStatus
|
||||||
this.previewLoading = true
|
this.previewLoading = true
|
||||||
|
const replyOrQuoteAttr = newStatus.quoting ? 'quoteId' : 'inReplyToStatusId'
|
||||||
statusPoster.postStatus({
|
statusPoster.postStatus({
|
||||||
status: newStatus.status,
|
status: newStatus.status,
|
||||||
spoilerText: newStatus.spoilerText || null,
|
spoilerText: newStatus.spoilerText || null,
|
||||||
@ -380,7 +403,7 @@ const PostStatusForm = {
|
|||||||
sensitive: newStatus.nsfw,
|
sensitive: newStatus.nsfw,
|
||||||
media: [],
|
media: [],
|
||||||
store: this.$store,
|
store: this.$store,
|
||||||
inReplyToStatusId: this.replyTo,
|
[replyOrQuoteAttr]: this.replyTo,
|
||||||
contentType: newStatus.contentType,
|
contentType: newStatus.contentType,
|
||||||
poll: {},
|
poll: {},
|
||||||
preview: true
|
preview: true
|
||||||
|
@ -126,6 +126,42 @@
|
|||||||
class="preview-status"
|
class="preview-status"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="quotable"
|
||||||
|
role="radiogroup"
|
||||||
|
class="reply-or-quote-selector"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="reply-or-quote-option"
|
||||||
|
tabindex="0"
|
||||||
|
role="radio"
|
||||||
|
:aria-checked="!newStatus.quoting"
|
||||||
|
@click="newStatus.quoting = false"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
:checked="!newStatus.quoting"
|
||||||
|
>
|
||||||
|
<label class="reply-or-quote-option-text">
|
||||||
|
{{ $t('post_status.reply_option') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="reply-or-quote-option"
|
||||||
|
tabindex="0"
|
||||||
|
role="radio"
|
||||||
|
:aria-checked="newStatus.quoting"
|
||||||
|
@click="newStatus.quoting = true"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
:checked="newStatus.quoting"
|
||||||
|
>
|
||||||
|
<label class="reply-or-quote-option-text">
|
||||||
|
{{ $t('post_status.quote_option') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<EmojiInput
|
<EmojiInput
|
||||||
v-if="!disableSubject && (newStatus.spoilerText || alwaysShowSubject)"
|
v-if="!disableSubject && (newStatus.spoilerText || alwaysShowSubject)"
|
||||||
v-model="newStatus.spoilerText"
|
v-model="newStatus.spoilerText"
|
||||||
@ -420,6 +456,20 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reply-or-quote-selector {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.reply-or-quote-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.reply-or-quote-option-text::before {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.text-format {
|
.text-format {
|
||||||
.only-format {
|
.only-format {
|
||||||
color: $fallback--faint;
|
color: $fallback--faint;
|
||||||
|
@ -261,6 +261,8 @@
|
|||||||
"post_status": {
|
"post_status": {
|
||||||
"edit_status": "Edit status",
|
"edit_status": "Edit status",
|
||||||
"new_status": "Post new status",
|
"new_status": "Post new status",
|
||||||
|
"reply_option": "Reply to this status",
|
||||||
|
"quote_option": "Quote this status",
|
||||||
"account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
|
"account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
|
||||||
"account_not_locked_warning_link": "locked",
|
"account_not_locked_warning_link": "locked",
|
||||||
"attachments_sensitive": "Mark attachments as sensitive",
|
"attachments_sensitive": "Mark attachments as sensitive",
|
||||||
|
@ -827,6 +827,7 @@ const postStatus = ({
|
|||||||
poll,
|
poll,
|
||||||
mediaIds = [],
|
mediaIds = [],
|
||||||
inReplyToStatusId,
|
inReplyToStatusId,
|
||||||
|
quoteId,
|
||||||
contentType,
|
contentType,
|
||||||
preview,
|
preview,
|
||||||
idempotencyKey
|
idempotencyKey
|
||||||
@ -859,6 +860,9 @@ const postStatus = ({
|
|||||||
if (inReplyToStatusId) {
|
if (inReplyToStatusId) {
|
||||||
form.append('in_reply_to_id', inReplyToStatusId)
|
form.append('in_reply_to_id', inReplyToStatusId)
|
||||||
}
|
}
|
||||||
|
if (quoteId) {
|
||||||
|
form.append('quote_id', quoteId)
|
||||||
|
}
|
||||||
if (preview) {
|
if (preview) {
|
||||||
form.append('preview', 'true')
|
form.append('preview', 'true')
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ const postStatus = ({
|
|||||||
poll,
|
poll,
|
||||||
media = [],
|
media = [],
|
||||||
inReplyToStatusId = undefined,
|
inReplyToStatusId = undefined,
|
||||||
|
quoteId = undefined,
|
||||||
contentType = 'text/plain',
|
contentType = 'text/plain',
|
||||||
preview = false,
|
preview = false,
|
||||||
idempotencyKey = ''
|
idempotencyKey = ''
|
||||||
@ -24,6 +25,7 @@ const postStatus = ({
|
|||||||
sensitive,
|
sensitive,
|
||||||
mediaIds,
|
mediaIds,
|
||||||
inReplyToStatusId,
|
inReplyToStatusId,
|
||||||
|
quoteId,
|
||||||
contentType,
|
contentType,
|
||||||
poll,
|
poll,
|
||||||
preview,
|
preview,
|
||||||
|
Loading…
Reference in New Issue
Block a user