misc: rename isMod to amMod
This commit is contained in:
1 parent
e2c08d1806
commit
3047a56106
8 files changed
+14
-14
No files matched your search
@@ -22,7 +22,7 @@
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { isCommentMutable } from '$lib/components/lemmy/post/helpers.js'
|
||||
import { isMod, report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { amMod, report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
|
||||
import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte'
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<Icon src={ArrowUturnLeft} width={14} height={14} mini />
|
||||
<span class="text-xs">Reply</span>
|
||||
</Button>
|
||||
{#if $user && isMod($user, comment.community)}
|
||||
{#if $user && amMod($user, comment.community)}
|
||||
<CommentModerationMenu item={comment} />
|
||||
{/if}
|
||||
<Menu
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
CommunityView,
|
||||
PostView,
|
||||
} from 'lemmy-js-client'
|
||||
import { isMod, remove } from './moderation'
|
||||
import { amMod, remove } from './moderation'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
CommunityView,
|
||||
PostView,
|
||||
} from 'lemmy-js-client'
|
||||
import { isMod, remove } from './moderation'
|
||||
import { amMod, remove } from './moderation'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
|
||||
@@ -49,11 +49,11 @@ export function remove(item: PostView | CommentView) {
|
||||
}))
|
||||
}
|
||||
|
||||
export const isMod = (me: MyUserInfo, community: Community) =>
|
||||
export const amMod = (me: MyUserInfo, community: Community) =>
|
||||
me.moderates.map((c) => c.community.id).includes(community.id) ||
|
||||
(community.local && isAdmin(me))
|
||||
|
||||
export const isModOfAny = (me?: MyUserInfo) =>
|
||||
export const amModOfAny = (me?: MyUserInfo) =>
|
||||
me && (me.moderates.length > 0 || isAdmin(me))
|
||||
|
||||
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin
|
||||
@@ -28,7 +28,7 @@
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
||||
import { isMod, report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { amMod, report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte'
|
||||
|
||||
export let post: PostView
|
||||
@@ -100,7 +100,7 @@
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
<div class="ml-auto" />
|
||||
{#if $user && isMod($user, post.community)}
|
||||
{#if $user && amMod($user, post.community)}
|
||||
<ModerationMenu item={post} community={post.community} />
|
||||
{/if}
|
||||
<Menu alignment="bottom-right" class="overflow-auto" let:toggleOpen>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
{#if avatar}
|
||||
<Avatar url={user.avatar} alt={user.name} width={avatarSize} />
|
||||
{/if}
|
||||
<span class="flex flex-wrap gap-0">
|
||||
{#if !user.local && $userSettings.showInstance}
|
||||
<span class="flex flex-wrap gap-0" class:text-red-500={user.admin}>
|
||||
{#if $userSettings.showInstance}
|
||||
{user.name}
|
||||
<span class="text-slate-500 dark:text-zinc-400 font-normal">
|
||||
@{new URL(user.actor_id).hostname}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { isModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import Logo from '$lib/components/ui/Logo.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
@@ -51,7 +51,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex flex-row gap-2 py-2 px-2">
|
||||
{#if $user && isModOfAny($user)}
|
||||
{#if $user && amModOfAny($user)}
|
||||
<Button
|
||||
href="/moderation"
|
||||
label="Search"
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { get, writable } from 'svelte/store'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { isModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
|
||||
export const LINKED_INSTANCE_URL = env.PUBLIC_INSTANCE_URL
|
||||
export const DEFAULT_INSTANCE_URL = env.PUBLIC_INSTANCE_URL || 'lemmy.ml'
|
||||
@@ -60,7 +60,7 @@ setInterval(async () => {
|
||||
if (!u) return
|
||||
u.unreads = response.mentions + response.private_messages + response.replies
|
||||
|
||||
if (isModOfAny(u)) {
|
||||
if (amModOfAny(u)) {
|
||||
const reports = await getClient().getReportCount({
|
||||
auth: get(authData)!.token,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user