Adding creator_banned_from_community to view votes modal. (#2435)

* Adding creator_banned_from_community to view votes modal.

* Adding margin.

* Updating pnpm to 9.0.5
This commit is contained in:
Dessalines 2024-04-23 21:58:52 -04:00 committed by GitHub
parent c1b8946875
commit b2a3f29fe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 14 deletions

View file

@ -141,7 +141,7 @@
"sortpack" "sortpack"
] ]
}, },
"packageManager": "pnpm@9.0.1+sha256.46d50ee2afecb42b185ebbd662dc7bdd52ef5be56bf035bb615cab81a75345df", "packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9",
"engineStrict": true, "engineStrict": true,
"importSort": { "importSort": {
".js, .jsx, .ts, .tsx": { ".js, .jsx, .ts, .tsx": {

View file

@ -10,7 +10,6 @@ import {
amMod, amMod,
canAdmin, canAdmin,
canMod, canMod,
isBanned,
} from "@utils/roles"; } from "@utils/roles";
import ActionButton from "./action-button"; import ActionButton from "./action-button";
import classNames from "classnames"; import classNames from "classnames";
@ -154,7 +153,7 @@ export default class ContentActionDropdown extends Component<
type === "post" type === "post"
? `post-actions-dropdown-${id}` ? `post-actions-dropdown-${id}`
: `comment-actions-dropdown-${id}`; : `comment-actions-dropdown-${id}`;
const creatorBannedFromLocal = isBanned(creator); const creatorBannedFromLocal = creator.banned;
const showToggleAdmin = !creatorBannedFromLocal && creator.local; const showToggleAdmin = !creatorBannedFromLocal && creator.local;
const canAppointCommunityMod = const canAppointCommunityMod =
(amMod(community.id) || (amAdmin() && community.local)) && (amMod(community.id) || (amAdmin() && community.local)) &&

View file

@ -23,6 +23,7 @@ import {
import { fetchLimit } from "../../config"; import { fetchLimit } from "../../config";
import { PersonListing } from "../person/person-listing"; import { PersonListing } from "../person/person-listing";
import { modalMixin } from "../mixins/modal-mixin"; import { modalMixin } from "../mixins/modal-mixin";
import { UserBadges } from "./user-badges";
interface ViewVotesModalProps { interface ViewVotesModalProps {
children?: InfernoNode; children?: InfernoNode;
@ -47,6 +48,12 @@ function voteViewTable(votes: VoteView[]) {
<tr key={v.creator.id}> <tr key={v.creator.id}>
<td className="text-start"> <td className="text-start">
<PersonListing person={v.creator} useApubName /> <PersonListing person={v.creator} useApubName />
<UserBadges
classNames="ms-1"
isBot={v.creator.bot_account}
isDeleted={v.creator.deleted}
isBanned={v.creator.banned || v.creator_banned_from_community}
/>
</td> </td>
<td className="text-end">{scoreToIcon(v.score)}</td> <td className="text-end">{scoreToIcon(v.score)}</td>
</tr> </tr>

View file

@ -20,7 +20,7 @@ import {
randomStr, randomStr,
resourcesSettled, resourcesSettled,
} from "@utils/helpers"; } from "@utils/helpers";
import { canMod, isBanned } from "@utils/roles"; import { canMod } from "@utils/roles";
import type { QueryParams } from "@utils/types"; import type { QueryParams } from "@utils/types";
import { RouteDataResponse } from "@utils/types"; import { RouteDataResponse } from "@utils/types";
import classNames from "classnames"; import classNames from "classnames";
@ -542,7 +542,7 @@ export class Profile extends Component<ProfileRouteProps, ProfileState> {
return ( return (
pv && ( pv && (
<div> <div>
{!isBanned(pv.person) && ( {!pv.person.banned && (
<BannerIconHeader <BannerIconHeader
banner={pv.person.banner} banner={pv.person.banner}
icon={pv.person.avatar} icon={pv.person.avatar}
@ -568,7 +568,7 @@ export class Profile extends Component<ProfileRouteProps, ProfileState> {
<li className="list-inline-item"> <li className="list-inline-item">
<UserBadges <UserBadges
classNames="ms-1" classNames="ms-1"
isBanned={isBanned(pv.person)} isBanned={pv.person.banned}
isDeleted={pv.person.deleted} isDeleted={pv.person.deleted}
isAdmin={pv.is_admin} isAdmin={pv.is_admin}
isBot={pv.person.bot_account} isBot={pv.person.bot_account}
@ -628,7 +628,7 @@ export class Profile extends Component<ProfileRouteProps, ProfileState> {
{canMod(pv.person.id, undefined, admins) && {canMod(pv.person.id, undefined, admins) &&
!pv.is_admin && !pv.is_admin &&
!showBanDialog && !showBanDialog &&
(!isBanned(pv.person) ? ( (!pv.person.banned ? (
<button <button
className={ className={
"d-flex align-self-start btn btn-secondary me-2" "d-flex align-self-start btn btn-secondary me-2"

View file

@ -6,7 +6,6 @@ import amTopMod from "./am-top-mod";
import canAdmin from "./can-admin"; import canAdmin from "./can-admin";
import canCreateCommunity from "./can-create-community"; import canCreateCommunity from "./can-create-community";
import canMod from "./can-mod"; import canMod from "./can-mod";
import isBanned from "./is-banned";
export { export {
amAdmin, amAdmin,
@ -17,5 +16,4 @@ export {
canAdmin, canAdmin,
canCreateCommunity, canCreateCommunity,
canMod, canMod,
isBanned,
}; };

View file

@ -1,5 +0,0 @@
import { Person } from "lemmy-js-client";
export default function isBanned(ps: Person): boolean {
return ps.banned;
}