mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
check permission in frontend before display trending polls
This commit is contained in:
parent
31e00a0906
commit
460442f75d
3 changed files with 33 additions and 13 deletions
8
locales/index.d.ts
vendored
8
locales/index.d.ts
vendored
|
@ -13081,6 +13081,14 @@ export interface Locale extends ILocale {
|
||||||
* Polls that have ended recently
|
* Polls that have ended recently
|
||||||
*/
|
*/
|
||||||
"pollsExpired": string;
|
"pollsExpired": string;
|
||||||
|
/**
|
||||||
|
* Trending polls are disabled on this instance.
|
||||||
|
*/
|
||||||
|
"trendingPollsDisabled": string;
|
||||||
|
/**
|
||||||
|
* Please log in to view trending polls.
|
||||||
|
*/
|
||||||
|
"trendingPollsDisabledLogIn": string;
|
||||||
/**
|
/**
|
||||||
* Silenced
|
* Silenced
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,32 +11,42 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkTab>
|
</MkTab>
|
||||||
<MkNotes v-if="tab === 'notes'" :pagination="paginationForNotes"/>
|
<MkNotes v-if="tab === 'notes'" :pagination="paginationForNotes"/>
|
||||||
<div v-else-if="tab === 'polls'">
|
<div v-else-if="tab === 'polls'">
|
||||||
<MkFoldableSection class="_margin">
|
<template v-if="ltlAvailable || gtlAvailable">
|
||||||
<template #header><i class="ph-house ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.tsx.pollsOnLocal({ name: instance.name ?? host }) }}</template>
|
<MkFoldableSection v-if="ltlAvailable" class="_margin">
|
||||||
<MkNotes :pagination="paginationForPollsLocal" :disableAutoLoad="true"/>
|
<template #header><i class="ph-house ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.tsx.pollsOnLocal({ name: instance.name ?? host }) }}</template>
|
||||||
</MkFoldableSection>
|
<MkNotes :pagination="paginationForPollsLocal" :disableAutoLoad="true"/>
|
||||||
|
</MkFoldableSection>
|
||||||
|
|
||||||
<MkFoldableSection class="_margin">
|
<MkFoldableSection v-if="gtlAvailable" class="_margin">
|
||||||
<template #header><i class="ph-globe ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.ts.pollsOnRemote }}</template>
|
<template #header><i class="ph-globe ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.ts.pollsOnRemote }}</template>
|
||||||
<MkNotes :pagination="paginationForPollsRemote" :disableAutoLoad="true"/>
|
<MkNotes :pagination="paginationForPollsRemote" :disableAutoLoad="true"/>
|
||||||
</MkFoldableSection>
|
</MkFoldableSection>
|
||||||
|
|
||||||
<MkFoldableSection class="_margin">
|
<MkFoldableSection v-if="gtlAvailable" class="_margin">
|
||||||
<template #header><i class="ph-timer ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.ts.pollsExpired }}</template>
|
<template #header><i class="ph-timer ph-bold ph-lg" style="margin-right: 0.5em;"></i>{{ i18n.ts.pollsExpired }}</template>
|
||||||
<MkNotes :pagination="paginationForPollsExpired" :disableAutoLoad="true"/>
|
<MkNotes :pagination="paginationForPollsExpired" :disableAutoLoad="true"/>
|
||||||
</MkFoldableSection>
|
</MkFoldableSection>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="$i"><i class="ti ti-alert-triangle"></i>{{ i18n.ts.trendingPollsDisabled }}</div>
|
||||||
|
<div v-else><i class="ti ti-alert-triangle"></i>{{ i18n.ts.trendingPollsDisabledLogIn }}</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { host } from '@@/js/config.js';
|
import { host } from '@@/js/config.js';
|
||||||
import MkNotes from '@/components/MkNotes.vue';
|
import MkNotes from '@/components/MkNotes.vue';
|
||||||
import MkTab from '@/components/MkTab.vue';
|
import MkTab from '@/components/MkTab.vue';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||||
import { instance } from '@/instance.js';
|
import { instance } from '@/instance.js';
|
||||||
|
import { $i } from '@/i';
|
||||||
|
|
||||||
|
const ltlAvailable = computed(() => $i?.policies.ltlAvailable ?? instance.policies.ltlAvailable);
|
||||||
|
const gtlAvailable = computed(() => $i?.policies.gtlAvailable ?? instance.policies.gtlAvailable);
|
||||||
|
|
||||||
const paginationForNotes = {
|
const paginationForNotes = {
|
||||||
endpoint: 'notes/featured' as const,
|
endpoint: 'notes/featured' as const,
|
||||||
|
|
|
@ -575,6 +575,8 @@ popularUsersLocal: "Users popular on {name}"
|
||||||
pollsOnLocal: "Polls trending on {name}"
|
pollsOnLocal: "Polls trending on {name}"
|
||||||
pollsOnRemote: "Polls trending on the global network"
|
pollsOnRemote: "Polls trending on the global network"
|
||||||
pollsExpired: "Polls that have ended recently"
|
pollsExpired: "Polls that have ended recently"
|
||||||
|
trendingPollsDisabled: "Trending polls are disabled on this instance."
|
||||||
|
trendingPollsDisabledLogIn: "Please log in to view trending polls."
|
||||||
|
|
||||||
silenced: "Silenced"
|
silenced: "Silenced"
|
||||||
totalFollowers: "Total followers"
|
totalFollowers: "Total followers"
|
||||||
|
|
Loading…
Add table
Reference in a new issue