diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 86c9d940..6833307a 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -283,6 +283,7 @@ const getNodeInfo = async ({ store }) => {
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') })
+ store.dispatch('setInstanceOption', { name: 'searchOptionLocalEnabled', value: features.includes('bnakkoma:search_option_local') })
store.dispatch('setInstanceOption', { name: 'opensearchProtocolSupported', value: features.includes('bnakkoma:opensearch_protocol') })
const uploadLimits = metadata.uploadLimits
diff --git a/src/components/search/search.js b/src/components/search/search.js
index db07f5e7..a5ee1daf 100644
--- a/src/components/search/search.js
+++ b/src/components/search/search.js
@@ -68,16 +68,9 @@ const Search = {
allStatusesObject[status.id] && !allStatusesObject[status.id].deleted
)
},
- isLoggedIn () {
- return !!this.$store.state.users.currentUser
- },
canSearchMediaPosts () {
return this.$store.state.instance.searchTypeMediaEnabled === true
},
- canSearchFollowing () {
- return this.isLoggedIn &&
- this.$store.state.instance.searchOptionFollowingEnabled === true
- },
hasAtLeastOneResult () {
return allSearchTypes
.some((searchType) => this.getVisibleLength(searchType) > 0)
@@ -165,7 +158,8 @@ const Search = {
offset: searchOffset,
'type': searchType,
following:
- 'followingOnly' in this.filter && this.filter.followingOnly
+ 'followingOnly' in this.filter && this.filter.followingOnly,
+ local: 'localOnly' in this.filter && this.filter.localOnly
})
// Always append to old results. If new results are empty, this doesn't change anything
diff --git a/src/components/search/search.vue b/src/components/search/search.vue
index d74224bc..76e76370 100644
--- a/src/components/search/search.vue
+++ b/src/components/search/search.vue
@@ -5,7 +5,6 @@
{{ $t('nav.search') }}
diff --git a/src/components/search/search_filters.vue b/src/components/search/search_filters.vue
index 98967fc1..3cbeacc9 100644
--- a/src/components/search/search_filters.vue
+++ b/src/components/search/search_filters.vue
@@ -1,5 +1,6 @@
@@ -46,10 +58,26 @@ export default {
data () {
return {
currentFilter: {
- followingOnly: false
+ followingOnly: false,
+ localOnly: false
}
}
},
+ computed: {
+ showFilters () {
+ return this.canSearchFollowing || this.canSearchLocal
+ },
+ isLoggedIn () {
+ return !!this.$store.state.users.currentUser
+ },
+ canSearchFollowing () {
+ return this.isLoggedIn &&
+ this.$store.state.instance.searchOptionFollowingEnabled
+ },
+ canSearchLocal () {
+ return this.$store.state.instance.searchOptionLocalEnabled
+ },
+ },
created () {
for (const filterName of Object.entries(this.currentFilter)) {
if (this.modelValue && filterName in this.modelValue) {
diff --git a/src/i18n/en.json b/src/i18n/en.json
index ed10f030..cfcf1858 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -450,7 +450,8 @@
"people_talking": "{count} people talking",
"person_talking": "{count} person talking",
"no_more_results": "No more results",
- "load_more": "Load more results"
+ "load_more": "Load more results",
+ "local_only": "Limit to Local"
},
"selectable_list": {
"select_all": "Select all"
diff --git a/src/i18n/ja_pedantic.json b/src/i18n/ja_pedantic.json
index 352da306..6a79b858 100644
--- a/src/i18n/ja_pedantic.json
+++ b/src/i18n/ja_pedantic.json
@@ -449,7 +449,8 @@
"people_talking": "{count}人が話しています",
"person_talking": "{count}人が話しています",
"no_more_results": "すべて表示しました",
- "load_more": "さらに表示"
+ "load_more": "さらに表示",
+ "local_only": "ローカルのユーザーのみ"
},
"selectable_list": {
"select_all": "すべて選択"
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 419b81c2..e8fe34ca 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -766,8 +766,8 @@ const statuses = {
rootState.api.backendInteractor.fetchRebloggedByUsers({ id })
.then(rebloggedByUsers => commit('addRepeats', { id, rebloggedByUsers, currentUser: rootState.users.currentUser }))
},
- search ({ rootState, dispatch }, { q, resolve, limit, offset, following, type }) {
- return rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following, type })
+ search ({ rootState, dispatch }, { q, resolve, limit, offset, following, local, type }) {
+ return rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following, local, type })
.then((data) => {
dispatch('addNewUsers', data.accounts)
dispatch('addNewStatuses', { statuses: data.statuses })
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index c4fb1e4f..a713b63d 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -1380,7 +1380,7 @@ const searchUsers = ({ credentials, query }) => {
.then((data) => data.map(parseUser))
}
-const search2 = ({ credentials, q, resolve, limit, offset, following, type }) => {
+const search2 = ({ credentials, q, resolve, limit, offset, following, local, type }) => {
let url = MASTODON_SEARCH_2
let params = []
@@ -1404,6 +1404,10 @@ const search2 = ({ credentials, q, resolve, limit, offset, following, type }) =>
params.push(['following', true])
}
+ if (local) {
+ params.push(['local', true])
+ }
+
if (type) {
params.push(['type', type])
}