Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma-fe into develop
This commit is contained in:
commit
f150d0a105
5 changed files with 182 additions and 51 deletions
|
@ -1,17 +1,56 @@
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { get } from 'lodash'
|
import { get } from 'lodash'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is for backwards compatibility. We originally didn't recieve
|
||||||
|
* extra info like a reason why an instance was rejected/quarantined/etc.
|
||||||
|
* Because we didn't want to break backwards compatibility it was decided
|
||||||
|
* to add an extra "info" key.
|
||||||
|
*/
|
||||||
|
const toInstanceReasonObject = (instances, info, key) => {
|
||||||
|
return instances.map(instance => {
|
||||||
|
if (info[key] && info[key][instance] && info[key][instance]['reason']) {
|
||||||
|
return { instance: instance, reason: info[key][instance]['reason'] }
|
||||||
|
}
|
||||||
|
return { instance: instance, reason: '' }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const MRFTransparencyPanel = {
|
const MRFTransparencyPanel = {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
federationPolicy: state => get(state, 'instance.federationPolicy'),
|
federationPolicy: state => get(state, 'instance.federationPolicy'),
|
||||||
mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []),
|
mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []),
|
||||||
quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []),
|
quarantineInstances: state => toInstanceReasonObject(
|
||||||
acceptInstances: state => get(state, 'instance.federationPolicy.mrf_simple.accept', []),
|
get(state, 'instance.federationPolicy.quarantined_instances', []),
|
||||||
rejectInstances: state => get(state, 'instance.federationPolicy.mrf_simple.reject', []),
|
get(state, 'instance.federationPolicy.quarantined_instances_info', []),
|
||||||
ftlRemovalInstances: state => get(state, 'instance.federationPolicy.mrf_simple.federated_timeline_removal', []),
|
'quarantined_instances'
|
||||||
mediaNsfwInstances: state => get(state, 'instance.federationPolicy.mrf_simple.media_nsfw', []),
|
),
|
||||||
mediaRemovalInstances: state => get(state, 'instance.federationPolicy.mrf_simple.media_removal', []),
|
acceptInstances: state => toInstanceReasonObject(
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple.accept', []),
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple_info', []),
|
||||||
|
'accept'
|
||||||
|
),
|
||||||
|
rejectInstances: state => toInstanceReasonObject(
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple.reject', []),
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple_info', []),
|
||||||
|
'reject'
|
||||||
|
),
|
||||||
|
ftlRemovalInstances: state => toInstanceReasonObject(
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple.federated_timeline_removal', []),
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple_info', []),
|
||||||
|
'federated_timeline_removal'
|
||||||
|
),
|
||||||
|
mediaNsfwInstances: state => toInstanceReasonObject(
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple.media_nsfw', []),
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple_info', []),
|
||||||
|
'media_nsfw'
|
||||||
|
),
|
||||||
|
mediaRemovalInstances: state => toInstanceReasonObject(
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple.media_removal', []),
|
||||||
|
get(state, 'instance.federationPolicy.mrf_simple_info', []),
|
||||||
|
'media_removal'
|
||||||
|
),
|
||||||
keywordsFtlRemoval: state => get(state, 'instance.federationPolicy.mrf_keyword.federated_timeline_removal', []),
|
keywordsFtlRemoval: state => get(state, 'instance.federationPolicy.mrf_keyword.federated_timeline_removal', []),
|
||||||
keywordsReject: state => get(state, 'instance.federationPolicy.mrf_keyword.reject', []),
|
keywordsReject: state => get(state, 'instance.federationPolicy.mrf_keyword.reject', []),
|
||||||
keywordsReplace: state => get(state, 'instance.federationPolicy.mrf_keyword.replace', [])
|
keywordsReplace: state => get(state, 'instance.federationPolicy.mrf_keyword.replace', [])
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
.mrf-section {
|
||||||
|
margin: 1em;
|
||||||
|
|
||||||
|
table {
|
||||||
|
width:100%;
|
||||||
|
text-align: left;
|
||||||
|
padding-left:10px;
|
||||||
|
padding-bottom:20px;
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
width: 180px;
|
||||||
|
max-width: 360px;
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: text-top;
|
||||||
|
}
|
||||||
|
|
||||||
|
th+th, td+td {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,13 +31,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.accept_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.accept_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in acceptInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in acceptInstances"
|
||||||
|
:key="entry.instance + '_accept'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="rejectInstances.length">
|
<div v-if="rejectInstances.length">
|
||||||
|
@ -45,13 +56,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.reject_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.reject_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in rejectInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in rejectInstances"
|
||||||
|
:key="entry.instance + '_reject'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="quarantineInstances.length">
|
<div v-if="quarantineInstances.length">
|
||||||
|
@ -59,13 +81,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.quarantine_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.quarantine_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in quarantineInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in quarantineInstances"
|
||||||
|
:key="entry.instance + '_quarantine'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="ftlRemovalInstances.length">
|
<div v-if="ftlRemovalInstances.length">
|
||||||
|
@ -73,13 +106,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.ftl_removal_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.ftl_removal_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in ftlRemovalInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in ftlRemovalInstances"
|
||||||
|
:key="entry.instance + '_ftl_removal'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="mediaNsfwInstances.length">
|
<div v-if="mediaNsfwInstances.length">
|
||||||
|
@ -87,13 +131,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.media_nsfw_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.media_nsfw_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in mediaNsfwInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in mediaNsfwInstances"
|
||||||
|
:key="entry.instance + '_media_nsfw'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="mediaRemovalInstances.length">
|
<div v-if="mediaRemovalInstances.length">
|
||||||
|
@ -101,13 +156,24 @@
|
||||||
|
|
||||||
<p>{{ $t("about.mrf.simple.media_removal_desc") }}</p>
|
<p>{{ $t("about.mrf.simple.media_removal_desc") }}</p>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
<li
|
<tr>
|
||||||
v-for="instance in mediaRemovalInstances"
|
<th>{{ $t("about.mrf.simple.instance") }}</th>
|
||||||
:key="instance"
|
<th>{{ $t("about.mrf.simple.reason") }}</th>
|
||||||
v-text="instance"
|
</tr>
|
||||||
/>
|
<tr
|
||||||
</ul>
|
v-for="entry in mediaRemovalInstances"
|
||||||
|
:key="entry.instance + '_media_removal'"
|
||||||
|
>
|
||||||
|
<td>{{ entry.instance }}</td>
|
||||||
|
<td v-if="entry.reason === ''">
|
||||||
|
{{ $t("about.mrf.simple.not_applicable") }}
|
||||||
|
</td>
|
||||||
|
<td v-else>
|
||||||
|
{{ entry.reason }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 v-if="hasKeywordPolicies">
|
<h2 v-if="hasKeywordPolicies">
|
||||||
|
@ -161,7 +227,6 @@
|
||||||
<script src="./mrf_transparency_panel.js"></script>
|
<script src="./mrf_transparency_panel.js"></script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.mrf-section {
|
@import '../../_variables.scss';
|
||||||
margin: 1em;
|
@import './mrf_transparency_panel.scss';
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
"mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance. The following policies are enabled:",
|
"mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance. The following policies are enabled:",
|
||||||
"simple": {
|
"simple": {
|
||||||
"simple_policies": "Instance-specific policies",
|
"simple_policies": "Instance-specific policies",
|
||||||
|
"instance": "Instance",
|
||||||
|
"reason": "Reason",
|
||||||
|
"not_applicable": "N/A",
|
||||||
"accept": "Accept",
|
"accept": "Accept",
|
||||||
"accept_desc": "This instance only accepts messages from the following instances:",
|
"accept_desc": "This instance only accepts messages from the following instances:",
|
||||||
"reject": "Reject",
|
"reject": "Reject",
|
||||||
|
|
|
@ -670,6 +670,9 @@
|
||||||
"mrf_policies": "Ingeschakelde MRF-regels",
|
"mrf_policies": "Ingeschakelde MRF-regels",
|
||||||
"simple": {
|
"simple": {
|
||||||
"simple_policies": "Instantiespecifieke regels",
|
"simple_policies": "Instantiespecifieke regels",
|
||||||
|
"instance": "Instantie",
|
||||||
|
"reason": "Reden",
|
||||||
|
"not_applicable": "n.v.t.",
|
||||||
"accept": "Accepteren",
|
"accept": "Accepteren",
|
||||||
"accept_desc": "Deze instantie accepteert alleen berichten van de volgende instanties:",
|
"accept_desc": "Deze instantie accepteert alleen berichten van de volgende instanties:",
|
||||||
"reject": "Afwijzen",
|
"reject": "Afwijzen",
|
||||||
|
|
Loading…
Reference in a new issue