lint
This commit is contained in:
parent
62aa0ca365
commit
d1bf0e607a
4 changed files with 45 additions and 29 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import { find } from 'lodash'
|
||||
import { mapState as mapPiniaState } from 'pinia'
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ export default {
|
|||
return pollFallback(this.modelValue, 'pollType')
|
||||
},
|
||||
set(newVal) {
|
||||
this.$emit('update:modelValue', { ...this.modelValue, pollType: newVal })
|
||||
this.$emit('update:modelValue', {
|
||||
...this.modelValue,
|
||||
pollType: newVal,
|
||||
})
|
||||
},
|
||||
},
|
||||
options: {
|
||||
|
|
@ -39,14 +42,17 @@ export default {
|
|||
},
|
||||
set(newVal) {
|
||||
this.$emit('update:modelValue', { ...this.modelValue, options: newVal })
|
||||
}
|
||||
},
|
||||
},
|
||||
expiryAmount: {
|
||||
get() {
|
||||
return pollFallback(this.modelValue, 'expiryAmount')
|
||||
},
|
||||
set(newVal) {
|
||||
this.$emit('update:modelValue', { ...this.modelValue, expiryAmount: newVal })
|
||||
this.$emit('update:modelValue', {
|
||||
...this.modelValue,
|
||||
expiryAmount: newVal,
|
||||
})
|
||||
},
|
||||
},
|
||||
expiryUnit: {
|
||||
|
|
@ -54,7 +60,10 @@ export default {
|
|||
return pollFallback(this.modelValue, 'expiryUnit')
|
||||
},
|
||||
set(newVal) {
|
||||
this.$emit('update:modelValue', { ...this.modelValue, expiryUnit: newVal })
|
||||
this.$emit('update:modelValue', {
|
||||
...this.modelValue,
|
||||
expiryUnit: newVal,
|
||||
})
|
||||
},
|
||||
},
|
||||
pollLimits() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
import { debounce, reject, uniqBy, isEqual, unescape as ldUnescape } from 'lodash'
|
||||
import {
|
||||
debounce,
|
||||
isEqual,
|
||||
unescape as ldUnescape,
|
||||
reject,
|
||||
uniqBy,
|
||||
} from 'lodash'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
|
|
@ -60,9 +66,6 @@ const pxStringToNumber = (str) => {
|
|||
return Number(str.substring(0, str.length - 2))
|
||||
}
|
||||
|
||||
const DEFAULT_NEWSTATUS = {
|
||||
}
|
||||
|
||||
const PostStatusForm = {
|
||||
props: {
|
||||
// Status editing stuff
|
||||
|
|
@ -195,7 +198,8 @@ const PostStatusForm = {
|
|||
this.updateIdempotencyKey()
|
||||
|
||||
// If we are starting a new post, do not associate it with old drafts
|
||||
const draft = !this.disableDraft && (this.draftId || this.statusType !== 'new')
|
||||
const draft =
|
||||
!this.disableDraft && (this.draftId || this.statusType !== 'new')
|
||||
? this.getDraft(this.statusType, this.refId)
|
||||
: null
|
||||
|
||||
|
|
@ -251,16 +255,17 @@ const PostStatusForm = {
|
|||
refId() {
|
||||
if (this.replyTo) {
|
||||
return this.replyTo
|
||||
} else if (profileMention) {
|
||||
} else if (this.profileMention && this.repliedUser?.id) {
|
||||
return this.profileMention && this.repliedUser?.id
|
||||
} else if (statusId) {
|
||||
} else if (this.statusId) {
|
||||
return this.statusId
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
},
|
||||
mentionsString() {
|
||||
if (this.statusType !== 'reply' && this.statusType !== 'mention') return ''
|
||||
if (this.statusType !== 'reply' && this.statusType !== 'mention')
|
||||
return ''
|
||||
let allAttentions = [...(this.attentions || [])]
|
||||
|
||||
allAttentions.unshift(this.repliedUser)
|
||||
|
|
@ -268,7 +273,9 @@ const PostStatusForm = {
|
|||
allAttentions = uniqBy(allAttentions, 'id')
|
||||
allAttentions = reject(allAttentions, { id: this.currentUser.id })
|
||||
|
||||
const mentions = allAttentions.map((attention) => `@${attention.screen_name}`)
|
||||
const mentions = allAttentions.map(
|
||||
(attention) => `@${attention.screen_name}`,
|
||||
)
|
||||
|
||||
return mentions.length > 0 ? mentions.join(' ') + ' ' : ''
|
||||
},
|
||||
|
|
@ -286,7 +293,7 @@ const PostStatusForm = {
|
|||
}
|
||||
|
||||
const scope =
|
||||
(this.repliedScope && this.userDefaultScopeCopy) ||
|
||||
(this.repliedScope && this.userDefaultScopeCopy) ||
|
||||
this.repliedScope === 'direct'
|
||||
? this.repliedScope
|
||||
: this.userDefaultScope
|
||||
|
|
@ -450,11 +457,13 @@ const PostStatusForm = {
|
|||
|
||||
// Drafts
|
||||
isDirty() {
|
||||
return Object.entries(this.defaultNewStatus).some(([key, defaultValue]) => {
|
||||
const actualValue = this.newStatus[key]
|
||||
if (actualValue === null) return false
|
||||
return !isEqual(actualValue, defaultValue)
|
||||
})
|
||||
return Object.entries(this.defaultNewStatus).some(
|
||||
([key, defaultValue]) => {
|
||||
const actualValue = this.newStatus[key]
|
||||
if (actualValue === null) return false
|
||||
return !isEqual(actualValue, defaultValue)
|
||||
},
|
||||
)
|
||||
},
|
||||
shouldAutoSaveDraft() {
|
||||
return useMergedConfigStore().mergedConfig.autoSaveDraft
|
||||
|
|
@ -590,14 +599,13 @@ const PostStatusForm = {
|
|||
clearStatus() {
|
||||
this.saveInhibited = true
|
||||
this.newStatus.status = ''
|
||||
this.newStatus.mentionsLine = '',
|
||||
this.newStatus.spoilerText = '',
|
||||
this.newStatus.files = [],
|
||||
this.newStatus.poll = null,
|
||||
this.newStatus.quote = null,
|
||||
this.newStatus.mediaDescriptions = {},
|
||||
|
||||
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
|
||||
;(this.newStatus.mentionsLine = ''),
|
||||
(this.newStatus.spoilerText = ''),
|
||||
(this.newStatus.files = []),
|
||||
(this.newStatus.poll = null),
|
||||
(this.newStatus.quote = null),
|
||||
(this.newStatus.mediaDescriptions = {}),
|
||||
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
|
||||
this.clearQuoteForm()
|
||||
if (this.preserveFocus) {
|
||||
this.$nextTick(() => {
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ import {
|
|||
} from 'src/api/public.js'
|
||||
import {
|
||||
blockUser as apiBlockUser,
|
||||
editUserNote as apiEditUserNote,
|
||||
muteUser as apiMuteUser,
|
||||
unblockUser as apiUnblockUser,
|
||||
unmuteUser as apiUnmuteUser,
|
||||
editUserNote as apiEditUserNote,
|
||||
fetchBlocks,
|
||||
fetchDomainMutes,
|
||||
fetchMutes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue