Make it more obvious when a community is locked (#2329)

* Make it more obvious when a community is locked

* Add translations

---------

Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
This commit is contained in:
SleeplessOne1917 2024-01-20 13:22:13 +00:00 committed by GitHub
parent dee4257082
commit 57b4aacfad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 11 deletions

View file

@ -5,3 +5,4 @@ src/api_tests
**/*.css **/*.css
**/*.scss **/*.scss
**/*.svg **/*.svg
src/shared/translations/**

@ -1 +1 @@
Subproject commit 3c217c609aa8826fc725f708221c8b3eb825f41a Subproject commit c3e61706e2ff7977db83e964e3010f72cad5e408

View file

@ -95,12 +95,12 @@ import { DataTypeSelect } from "../common/data-type-select";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { Icon, Spinner } from "../common/icon"; import { Icon, Spinner } from "../common/icon";
import { SortSelect } from "../common/sort-select"; import { SortSelect } from "../common/sort-select";
import { Sidebar } from "../community/sidebar";
import { SiteSidebar } from "../home/site-sidebar"; import { SiteSidebar } from "../home/site-sidebar";
import { PostListings } from "../post/post-listings"; import { PostListings } from "../post/post-listings";
import { CommunityLink } from "./community-link"; import { CommunityLink } from "./community-link";
import { PaginatorCursor } from "../common/paginator-cursor"; import { PaginatorCursor } from "../common/paginator-cursor";
import { getHttpBaseInternal } from "../../utils/env"; import { getHttpBaseInternal } from "../../utils/env";
import { Sidebar } from "./sidebar";
type CommunityData = RouteDataResponse<{ type CommunityData = RouteDataResponse<{
communityRes: GetCommunityResponse; communityRes: GetCommunityResponse;
@ -503,7 +503,21 @@ export class Community extends Component<
community && ( community && (
<div className="mb-2"> <div className="mb-2">
<BannerIconHeader banner={community.banner} icon={community.icon} /> <BannerIconHeader banner={community.banner} icon={community.icon} />
<h1 className="h4 mb-0 overflow-wrap-anywhere">{community.title}</h1> <div>
<h1
className="h4 mb-0 overflow-wrap-anywhere d-inline"
data-tippy-content={
community.posting_restricted_to_mods
? I18NextService.i18n.t("community_locked")
: ""
}
>
{community.title}
</h1>
{community.posting_restricted_to_mods && (
<Icon icon="lock" inline classes="text-danger fs-4 ms-2" />
)}
</div>
<CommunityLink <CommunityLink
community={community} community={community}
realLink realLink

View file

@ -122,9 +122,10 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
} }
sidebar() { sidebar() {
const myUSerInfo = UserService.Instance.myUserInfo; const myUserInfo = UserService.Instance.myUserInfo;
const { const {
community: { name, actor_id }, community: { name, actor_id, id, posting_restricted_to_mods },
counts,
} = this.props.community_view; } = this.props.community_view;
return ( return (
<aside className="mb-3"> <aside className="mb-3">
@ -140,8 +141,8 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
loading={this.state.followCommunityLoading} loading={this.state.followCommunityLoading}
/> />
{this.canPost && this.createPost()} {this.canPost && this.createPost()}
{myUSerInfo && this.blockCommunity()} {myUserInfo && this.blockCommunity()}
{!myUSerInfo && ( {!myUserInfo && (
<div className="alert alert-info" role="alert"> <div className="alert alert-info" role="alert">
<T <T
i18nKey="community_not_logged_in_alert" i18nKey="community_not_logged_in_alert"
@ -158,11 +159,23 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
</section> </section>
<section id="sidebarInfo" className="card border-secondary mb-3"> <section id="sidebarInfo" className="card border-secondary mb-3">
<div className="card-body"> <div className="card-body">
{posting_restricted_to_mods && (
<div
className="alert alert-warning text-sm-start text-xs-center"
role="alert"
>
<Icon
icon="lock"
inline
classes="me-sm-2 mx-auto d-sm-inline d-block"
/>
<T i18nKey="community_locked_message" className="d-inline">
#<strong className="fw-bold">#</strong>#
</T>
</div>
)}
{this.description()} {this.description()}
<Badges <Badges communityId={id} counts={counts} />
communityId={this.props.community_view.community.id}
counts={this.props.community_view.counts}
/>
{this.mods()} {this.mods()}
</div> </div>
</section> </section>