diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 880de228..6a94f491 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -282,6 +282,7 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled }) store.dispatch('setInstanceOption', { name: 'translationEnabled', value: features.includes('akkoma:machine_translation') }) store.dispatch('setInstanceOption', { name: 'searchTypeMediaEnabled', value: features.includes('bnakkoma:search_type_media') }) + store.dispatch('setInstanceOption', { name: 'searchOptionFollowingEnabled', value: features.includes('bnakkoma:search_option_following') }) const uploadLimits = metadata.uploadLimits store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) }) diff --git a/src/components/search/search.js b/src/components/search/search.js index 0c8ee35e..6cae915c 100644 --- a/src/components/search/search.js +++ b/src/components/search/search.js @@ -2,6 +2,7 @@ import FollowCard from '../follow_card/follow_card.vue' import Conversation from '../conversation/conversation.vue' import Status from '../status/status.vue' import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx' +import SearchFilters from './search_filters.vue' import map from 'lodash/map' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -20,7 +21,8 @@ const Search = { FollowCard, Conversation, Status, - TabSwitcher + TabSwitcher, + SearchFilters }, props: [ 'query' @@ -41,7 +43,8 @@ const Search = { lastStatusFetchCount: 0, mediaOffset: 0, lastMediaFetchCount: 0, - lastQuery: '' + lastQuery: '', + filter: {} } }, computed: { @@ -64,6 +67,9 @@ const Search = { }, canSearchMediaPosts () { return this.$store.state.instance.searchTypeMediaEnabled === true + }, + canSearchFollowing () { + return this.$store.state.instance.searchOptionFollowingEnabled === true } }, mounted () { @@ -73,6 +79,13 @@ const Search = { query (newValue) { this.searchTerm = newValue this.search(newValue) + }, + filter: { + deep: true, + handler () { + this.lastQuery = "" // invalidate state + this.search(this.searchTerm) + } } }, methods: { @@ -113,6 +126,8 @@ const Search = { resolve: true, offset: searchOffset, 'type': searchType, + following: + 'followingOnly' in this.filter && this.filter.followingOnly }) .then(data => { this.loading = false diff --git a/src/components/search/search.vue b/src/components/search/search.vue index 0aa88eae..23f2d0fc 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -4,6 +4,10 @@
{{ $t('nav.search') }}
+
+ + + + + + + + +