mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe
synced 2025-04-30 11:09:30 +08:00
post_status_form: inherit language from parent
If I'm replying to a post in Klingon, chances are I'm going to write in Klingon. This reduces friction for properly marking post language in a conversation.
This commit is contained in:
parent
65dbac098e
commit
8f06566ddd
3 changed files with 17 additions and 6 deletions
|
@ -85,6 +85,7 @@ const PostStatusForm = {
|
||||||
'quoteId',
|
'quoteId',
|
||||||
'repliedUser',
|
'repliedUser',
|
||||||
'attentions',
|
'attentions',
|
||||||
|
'copyMessageLanguage',
|
||||||
'copyMessageScope',
|
'copyMessageScope',
|
||||||
'subject',
|
'subject',
|
||||||
'disableSubject',
|
'disableSubject',
|
||||||
|
@ -153,8 +154,7 @@ const PostStatusForm = {
|
||||||
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
|
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { postContentType: contentType, postLanguage: defaultPostLanguage, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
|
const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
|
||||||
const postLanguage = defaultPostLanguage || interfaceToISOLanguage(interfaceLanguage)
|
|
||||||
|
|
||||||
let statusParams = {
|
let statusParams = {
|
||||||
spoilerText: this.subject || '',
|
spoilerText: this.subject || '',
|
||||||
|
@ -165,7 +165,7 @@ const PostStatusForm = {
|
||||||
poll: {},
|
poll: {},
|
||||||
mediaDescriptions: {},
|
mediaDescriptions: {},
|
||||||
visibility: this.suggestedVisibility(),
|
visibility: this.suggestedVisibility(),
|
||||||
language: postLanguage,
|
language: this.suggestedLanguage(),
|
||||||
contentType
|
contentType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ const PostStatusForm = {
|
||||||
poll: this.statusPoll || {},
|
poll: this.statusPoll || {},
|
||||||
mediaDescriptions: this.statusMediaDescriptions || {},
|
mediaDescriptions: this.statusMediaDescriptions || {},
|
||||||
visibility: this.statusScope || this.suggestedVisibility(),
|
visibility: this.statusScope || this.suggestedVisibility(),
|
||||||
language: this.statusLanguage || postLanguage,
|
language: this.statusLanguage || this.suggestedLanguage(),
|
||||||
contentType: statusContentType
|
contentType: statusContentType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,6 @@ const PostStatusForm = {
|
||||||
},
|
},
|
||||||
clearStatus () {
|
clearStatus () {
|
||||||
const config = this.$store.getters.mergedConfig
|
const config = this.$store.getters.mergedConfig
|
||||||
const postLanguage = config.postLanguage || interfaceToISOLanguage(config.interfaceLanguage)
|
|
||||||
this.newStatus = {
|
this.newStatus = {
|
||||||
status: '',
|
status: '',
|
||||||
spoilerText: '',
|
spoilerText: '',
|
||||||
|
@ -350,7 +349,7 @@ const PostStatusForm = {
|
||||||
nsfw: !!config.sensitiveByDefault,
|
nsfw: !!config.sensitiveByDefault,
|
||||||
visibility: this.suggestedVisibility(),
|
visibility: this.suggestedVisibility(),
|
||||||
contentType: config.postContentType,
|
contentType: config.postContentType,
|
||||||
language: postLanguage,
|
language: this.suggestedLanguage(),
|
||||||
poll: {},
|
poll: {},
|
||||||
mediaDescriptions: {}
|
mediaDescriptions: {}
|
||||||
}
|
}
|
||||||
|
@ -766,6 +765,15 @@ const PostStatusForm = {
|
||||||
openProfileTab () {
|
openProfileTab () {
|
||||||
this.$store.dispatch('openSettingsModalTab', 'profile')
|
this.$store.dispatch('openSettingsModalTab', 'profile')
|
||||||
},
|
},
|
||||||
|
suggestedLanguage () {
|
||||||
|
// Make sure the inherited language is actually valid
|
||||||
|
if (this.postLanguageOptions.find(o => o.value === this.copyMessageLanguage)) {
|
||||||
|
return this.copyMessageLanguage
|
||||||
|
}
|
||||||
|
const { postLanguage: defaultPostLanguage, interfaceLanguage } = this.$store.getters.mergedConfig
|
||||||
|
const postLanguage = defaultPostLanguage || interfaceToISOLanguage(interfaceLanguage)
|
||||||
|
return postLanguage
|
||||||
|
},
|
||||||
suggestedVisibility () {
|
suggestedVisibility () {
|
||||||
if (this.copyMessageScope) {
|
if (this.copyMessageScope) {
|
||||||
if (this.copyMessageScope === 'direct') {
|
if (this.copyMessageScope === 'direct') {
|
||||||
|
|
|
@ -519,6 +519,7 @@
|
||||||
:reply-to="status.id"
|
:reply-to="status.id"
|
||||||
:attentions="status.attentions"
|
:attentions="status.attentions"
|
||||||
:replied-user="status.user"
|
:replied-user="status.user"
|
||||||
|
:copy-message-language="status.language"
|
||||||
:copy-message-scope="status.visibility"
|
:copy-message-scope="status.visibility"
|
||||||
:subject="replySubject"
|
:subject="replySubject"
|
||||||
@posted="toggleReplying"
|
@posted="toggleReplying"
|
||||||
|
@ -533,6 +534,7 @@
|
||||||
:quote-id="status.id"
|
:quote-id="status.id"
|
||||||
:attentions="[status.user]"
|
:attentions="[status.user]"
|
||||||
:replied-user="status.user"
|
:replied-user="status.user"
|
||||||
|
:copy-message-language="status.language"
|
||||||
:copy-message-scope="status.visibility"
|
:copy-message-scope="status.visibility"
|
||||||
:subject="replySubject"
|
:subject="replySubject"
|
||||||
@posted="toggleQuoting"
|
@posted="toggleQuoting"
|
||||||
|
|
|
@ -326,6 +326,7 @@ export const parseStatus = (data) => {
|
||||||
}
|
}
|
||||||
output.pinned = data.pinned
|
output.pinned = data.pinned
|
||||||
output.muted = data.muted
|
output.muted = data.muted
|
||||||
|
output.language = data.language
|
||||||
} else {
|
} else {
|
||||||
output.favorited = data.favorited
|
output.favorited = data.favorited
|
||||||
output.fave_num = data.fave_num
|
output.fave_num = data.fave_num
|
||||||
|
|
Loading…
Reference in a new issue