Check the availability of media search using instance flags
This commit is contained in:
parent
c14dfc1581
commit
b3ab3be3be
3 changed files with 5 additions and 3 deletions
|
@ -281,6 +281,7 @@ const getNodeInfo = async ({ store }) => {
|
||||||
store.dispatch('setInstanceOption', { name: 'pollLimits', value: metadata.pollLimits })
|
store.dispatch('setInstanceOption', { name: 'pollLimits', value: metadata.pollLimits })
|
||||||
store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled })
|
store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled })
|
||||||
store.dispatch('setInstanceOption', { name: 'translationEnabled', value: features.includes('akkoma:machine_translation') })
|
store.dispatch('setInstanceOption', { name: 'translationEnabled', value: features.includes('akkoma:machine_translation') })
|
||||||
|
store.dispatch('setInstanceOption', { name: 'searchTypeMediaEnabled', value: features.includes('bnakkoma:search_type_media') })
|
||||||
|
|
||||||
const uploadLimits = metadata.uploadLimits
|
const uploadLimits = metadata.uploadLimits
|
||||||
store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) })
|
store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) })
|
||||||
|
|
|
@ -30,7 +30,6 @@ const Search = {
|
||||||
loadedInitially: false,
|
loadedInitially: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
searchTerm: this.query || '',
|
searchTerm: this.query || '',
|
||||||
mediaSearchSupported: false,
|
|
||||||
userIds: [],
|
userIds: [],
|
||||||
statuses: [],
|
statuses: [],
|
||||||
media: [],
|
media: [],
|
||||||
|
@ -62,6 +61,9 @@ const Search = {
|
||||||
return this.media.filter(status =>
|
return this.media.filter(status =>
|
||||||
allStatusesObject[status.id] && !allStatusesObject[status.id].deleted
|
allStatusesObject[status.id] && !allStatusesObject[status.id].deleted
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
canSearchMediaPosts () {
|
||||||
|
return this.$store.state.instance.searchTypeMediaEnabled === true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
@ -122,7 +124,6 @@ const Search = {
|
||||||
this.userIds = this.userIds.concat(map(data.accounts, 'id'))
|
this.userIds = this.userIds.concat(map(data.accounts, 'id'))
|
||||||
this.statuses = uniqBy(this.statuses.concat(data.statuses), 'id')
|
this.statuses = uniqBy(this.statuses.concat(data.statuses), 'id')
|
||||||
if ('media' in data) {
|
if ('media' in data) {
|
||||||
this.mediaSearchSupported = true
|
|
||||||
this.media = uniqBy(this.media.concat(data.media), 'id')
|
this.media = uniqBy(this.media.concat(data.media), 'id')
|
||||||
}
|
}
|
||||||
this.hashtags = this.hashtags.concat(data.hashtags)
|
this.hashtags = this.hashtags.concat(data.hashtags)
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
:label="$t('user_card.statuses') + resultCount('visibleStatuses')"
|
:label="$t('user_card.statuses') + resultCount('visibleStatuses')"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="mediaSearchSupported"
|
v-if="canSearchMediaPosts"
|
||||||
key="media"
|
key="media"
|
||||||
:label="$t('user_card.media') + resultCount('visibleMedia')"
|
:label="$t('user_card.media') + resultCount('visibleMedia')"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue