Fix for code review

* js object keys aren't quoted any more
* when no reason is given, it will be shown in the FE (and is localised)
* the js function I wrote
  * is now of the form `const name = (e) => {}` instead of `function name(e) {}`
  * doesn't use an extra `else` nesting any more
This commit is contained in:
Ilja 2020-11-28 11:59:40 +01:00
parent c3ddd0c832
commit 6cf98da91e
3 changed files with 41 additions and 10 deletions

View file

@ -7,12 +7,12 @@ import { get } from 'lodash'
* Because we didn't want to break backwards compatibility it was decided
* to add an extra "info" key.
*/
function toInstanceReasonObject (instances, 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: info[key][instance]['reason'] }
}
return { 'instance': instance, 'reason': '' }
return { instance: instance, reason: '' }
})
}

View file

@ -41,7 +41,12 @@
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>
@ -61,7 +66,12 @@
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>
@ -81,7 +91,12 @@
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>
@ -101,7 +116,12 @@
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>
@ -121,7 +141,12 @@
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>
@ -137,11 +162,16 @@
<th>{{ $t("about.mrf.simple.reason") }}</th>
</tr>
<tr
v-for="entry in mediaNsfwInstances"
v-for="entry in mediaRemovalInstances"
:key="entry"
>
<td>{{ entry.instance }}</td>
<td>{{ entry.reason }}</td>
<td v-if="entry.reason === ''">
{{ $t("about.mrf.simple.no_reason_available") }}
</td>
<td v-else>
{{ entry.reason }}
</td>
</tr>
</table>
</div>

View file

@ -15,6 +15,7 @@
"simple_policies": "Instance-specific Policies",
"instance": "Instance",
"reason": "Reason",
"no_reason_available": "N/A",
"accept": "Accept",
"accept_desc": "This instance only accepts messages from the following instances:",
"reject": "Reject",