diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9beee43..ad03c760 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Add
- Added private notifications option for push notifications
- 'Copy link' button for statuses (in the ellipsis menu)
+- Autocomplete domains from list of known instances
### Changed
- Registration page no longer requires email if the server is configured not to require it
diff --git a/src/components/domain_mute_card/domain_mute_card.js b/src/components/domain_mute_card/domain_mute_card.js
index c8e838ba..f234dcb0 100644
--- a/src/components/domain_mute_card/domain_mute_card.js
+++ b/src/components/domain_mute_card/domain_mute_card.js
@@ -5,9 +5,20 @@ const DomainMuteCard = {
components: {
ProgressButton
},
+ computed: {
+ user () {
+ return this.$store.state.users.currentUser
+ },
+ muted () {
+ return this.user.domainMutes.includes(this.domain)
+ }
+ },
methods: {
unmuteDomain () {
return this.$store.dispatch('unmuteDomain', this.domain)
+ },
+ muteDomain () {
+ return this.$store.dispatch('muteDomain', this.domain)
}
}
}
diff --git a/src/components/domain_mute_card/domain_mute_card.vue b/src/components/domain_mute_card/domain_mute_card.vue
index 567d81c5..97aee243 100644
--- a/src/components/domain_mute_card/domain_mute_card.vue
+++ b/src/components/domain_mute_card/domain_mute_card.vue
@@ -4,6 +4,7 @@
{{ domain }}
@@ -12,6 +13,16 @@
{{ $t('domain_mute_card.unmute_progress') }}
+
+ {{ $t('domain_mute_card.mute') }}
+
+ {{ $t('domain_mute_card.mute_progress') }}
+
+
@@ -34,5 +45,9 @@
button {
width: 10em;
}
+
+ .autosuggest-results & {
+ padding-left: 1em;
+ }
}
diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js
index b0043dbb..40a87b81 100644
--- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js
+++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js
@@ -32,12 +32,12 @@ const DomainMuteList = withSubscription({
const MutesAndBlocks = {
data () {
return {
- activeTab: 'profile',
- newDomainToMute: ''
+ activeTab: 'profile'
}
},
created () {
this.$store.dispatch('fetchTokens')
+ this.$store.dispatch('getKnownDomains')
},
components: {
TabSwitcher,
@@ -51,6 +51,14 @@ const MutesAndBlocks = {
Autosuggest,
Checkbox
},
+ computed: {
+ knownDomains () {
+ return this.$store.state.instance.knownDomains
+ },
+ user () {
+ return this.$store.state.users.currentUser
+ }
+ },
methods: {
importFollows (file) {
return this.$store.state.api.backendInteractor.importFollows({ file })
@@ -86,13 +94,13 @@ const MutesAndBlocks = {
filterUnblockedUsers (userIds) {
return reject(userIds, (userId) => {
const relationship = this.$store.getters.relationship(this.userId)
- return relationship.blocking || userId === this.$store.state.users.currentUser.id
+ return relationship.blocking || userId === this.user.id
})
},
filterUnMutedUsers (userIds) {
return reject(userIds, (userId) => {
const relationship = this.$store.getters.relationship(this.userId)
- return relationship.muting || userId === this.$store.state.users.currentUser.id
+ return relationship.muting || userId === this.user.id
})
},
queryUserIds (query) {
@@ -111,12 +119,16 @@ const MutesAndBlocks = {
unmuteUsers (ids) {
return this.$store.dispatch('unmuteUsers', ids)
},
+ filterUnMutedDomains (urls) {
+ return urls.filter(url => !this.user.domainMutes.includes(url))
+ },
+ queryKnownDomains (query) {
+ return new Promise((resolve, reject) => {
+ resolve(this.knownDomains.filter(url => url.toLowerCase().includes(query)))
+ })
+ },
unmuteDomains (domains) {
return this.$store.dispatch('unmuteDomains', domains)
- },
- muteDomain () {
- return this.$store.dispatch('muteDomain', this.newDomainToMute)
- .then(() => { this.newDomainToMute = '' })
}
}
}
diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue b/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue
index 6884b7be..5a1cf2c0 100644
--- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue
+++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue
@@ -119,21 +119,16 @@
-
-
- {{ $t('domain_mute_card.mute') }}
-
- {{ $t('domain_mute_card.mute_progress') }}
-
-
+
+
`/api/v1/pleroma/statuses/${id}/reactions`
const PLEROMA_EMOJI_REACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
@@ -995,6 +996,10 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
})
}
+const fetchKnownDomains = ({ credentials }) => {
+ return promisedRequest({ url: MASTODON_KNOWN_DOMAIN_LIST_URL, credentials })
+}
+
const fetchDomainMutes = ({ credentials }) => {
return promisedRequest({ url: MASTODON_DOMAIN_BLOCKS_URL, credentials })
}
@@ -1193,6 +1198,7 @@ const apiService = {
updateNotificationSettings,
search2,
searchUsers,
+ fetchKnownDomains,
fetchDomainMutes,
muteDomain,
unmuteDomain