diff --git a/CHANGELOG.md b/CHANGELOG.md index 2719edcf0b..0d6ef1a5ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Emoji picker - Started changelog anew - Ability to change user's email +- About page ### Changed - changed the way fading effects for user profile/long statuses works, now uses css-mask instead of gradient background hacks which weren't exactly compatible with semi-transparent themes ### Fixed diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 80a558497c..226b67d8ac 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -184,6 +184,15 @@ const getAppSecret = async ({ store }) => { }) } +const resolveStaffAccounts = async ({ store, accounts }) => { + const backendInteractor = store.state.api.backendInteractor + let nicknames = accounts.map(uri => uri.split('/').pop()) + .map(id => backendInteractor.fetchUser({ id })) + nicknames = await Promise.all(nicknames) + + store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames }) +} + const getNodeInfo = async ({ store }) => { try { const res = await window.fetch('/nodeinfo/2.0.json') @@ -212,6 +221,12 @@ const getNodeInfo = async ({ store }) => { const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) + + const federation = metadata.federation + store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation }) + + const accounts = metadata.staffAccounts + await resolveStaffAccounts({ store, accounts }) } else { throw (res) } diff --git a/src/components/about/about.js b/src/components/about/about.js index ae1cb1821a..1df2584505 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -1,15 +1,24 @@ import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_panel.vue' import FeaturesPanel from '../features_panel/features_panel.vue' import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue' +import StaffPanel from '../staff_panel/staff_panel.vue' +import MRFTransparencyPanel from '../mrf_transparency_panel/mrf_transparency_panel.vue' const About = { components: { InstanceSpecificPanel, FeaturesPanel, - TermsOfServicePanel + TermsOfServicePanel, + StaffPanel, + MRFTransparencyPanel }, computed: { - showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel } + showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, + showInstanceSpecificPanel () { + return this.$store.state.instance.showInstanceSpecificPanel && + !this.$store.getters.mergedConfig.hideISP && + this.$store.state.instance.instanceSpecificPanelContent + } } } diff --git a/src/components/about/about.vue b/src/components/about/about.vue index 62ae16ea38..518f6184da 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -1,8 +1,10 @@ diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js new file mode 100644 index 0000000000..20f8a08a29 --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -0,0 +1,16 @@ +import { mapState } from 'vuex' + +const MRFTransparencyPanel = { + computed: mapState({ + federationPolicy: state => state.instance.federationPolicy, + mrfPolicies: state => state.instance.federationPolicy.mrf_policies, + acceptInstances: state => state.instance.federationPolicy.mrf_simple.accept, + rejectInstances: state => state.instance.federationPolicy.mrf_simple.reject, + quarantineInstances: state => state.instance.federationPolicy.quarantined_instances, + ftlRemovalInstances: state => state.instance.federationPolicy.mrf_simple.federated_timeline_removal, + mediaNsfwInstances: state => state.instance.federationPolicy.mrf_simple.media_nsfw, + mediaRemovalInstances: state => state.instance.federationPolicy.mrf_simple.media_removal + }) +} + +export default MRFTransparencyPanel diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue new file mode 100644 index 0000000000..2640d68c7d --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 614fadf4b8..28589bb14a 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -38,6 +38,11 @@ {{ $t("nav.twkn") }} +
  • + + {{ $t("nav.about") }} + +
  • diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js new file mode 100644 index 0000000000..93e950adfd --- /dev/null +++ b/src/components/staff_panel/staff_panel.js @@ -0,0 +1,14 @@ +import BasicUserCard from '../basic_user_card/basic_user_card.vue' + +const StaffPanel = { + components: { + BasicUserCard + }, + computed: { + staffAccounts () { + return this.$store.state.instance.staffAccounts + } + } +} + +export default StaffPanel diff --git a/src/components/staff_panel/staff_panel.vue b/src/components/staff_panel/staff_panel.vue new file mode 100644 index 0000000000..1d13003df1 --- /dev/null +++ b/src/components/staff_panel/staff_panel.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index 483432ffc2..ead333c136 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1,4 +1,23 @@ { + "about": { + "staff": "Staff", + "federation": "Federation", + "mrf_policies": "Enabled MRF Policies", + "mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance. The following policies are enabled:", + "mrf_policy_simple": "Instance-specific Policies", + "mrf_policy_simple_accept": "Accept", + "mrf_policy_simple_accept_desc": "This instance only accepts messages from the following instances:", + "mrf_policy_simple_reject": "Reject", + "mrf_policy_simple_reject_desc": "This instance will not accept messages from the following instances:", + "mrf_policy_simple_quarantine": "Quarantine", + "mrf_policy_simple_quarantine_desc": "This instance will send only public posts to the following instances:", + "mrf_policy_simple_ftl_removal": "Removal from \"The Whole Known Network\" Timeline", + "mrf_policy_simple_ftl_removal_desc": "This instance removes these instances from \"The Whole Known Network\" timeline:", + "mrf_policy_simple_media_removal": "Media Removal", + "mrf_policy_simple_media_removal_desc": "This instance removes media from posts on the following instances:", + "mrf_policy_simple_media_nsfw": "Media Force-set As Sensitive", + "mrf_policy_simple_media_nsfw_desc": "This instance forces media to be set sensitive in posts on the following instances:" + }, "chat": { "title": "Chat" },