diff --git a/lemmy-translations b/lemmy-translations index 5c50ce3e..007e5368 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 5c50ce3ebaf058ad5d4e9bcd445653960cbc98b1 +Subproject commit 007e53683768aeba63e9e4c179c1d240217bcee2 diff --git a/src/shared/components/community/create-community.tsx b/src/shared/components/community/create-community.tsx index da8ef09d..81c62531 100644 --- a/src/shared/components/community/create-community.tsx +++ b/src/shared/components/community/create-community.tsx @@ -1,8 +1,9 @@ import { Component } from "inferno"; +import { Redirect } from "inferno-router"; import { CommunityView, GetSiteResponse } from "lemmy-js-client"; import { Subscription } from "rxjs"; import { i18n } from "../../i18next"; -import { UserService } from "../../services"; +import { UserService } from "../../services/UserService"; import { enableNsfw, isBrowser, @@ -32,11 +33,6 @@ export class CreateCommunity extends Component { this.parseMessage = this.parseMessage.bind(this); this.subscription = wsSubscribe(this.parseMessage); - - if (!UserService.Instance.myUserInfo && isBrowser()) { - toast(i18n.t("not_logged_in"), "danger"); - this.context.router.history.push(`/login`); - } } componentWillUnmount() { @@ -54,6 +50,7 @@ export class CreateCommunity extends Component { render() { return (
+ {!UserService.Instance.myUserInfo && } { } sidebar() { + const myUSerInfo = UserService.Instance.myUserInfo; + const { name, actor_id } = this.props.community_view.community; return (
{this.communityTitle()} {this.props.editable && this.adminButtons()} - {this.subscribe()} + {myUSerInfo && this.subscribe()} {this.canPost && this.createPost()} - {this.blockCommunity()} + {myUSerInfo && this.blockCommunity()} + {!myUSerInfo && ( +
+ {i18n.t("community_not_logged_in_alert", { + community: name, + instance: hostname(actor_id), + })} +
+ )}
@@ -123,7 +134,7 @@ export class Sidebar extends Component { )} {community.title} - {subscribed == SubscribedType.Subscribed && ( + {subscribed === SubscribedType.Subscribed && ( )} - {subscribed == SubscribedType.Pending && ( + {subscribed === SubscribedType.Pending && (
+ {!UserService.Instance.myUserInfo && ( +
+ {i18n.t("profile_not_logged_in_alert")} +
+ )}
diff --git a/src/shared/components/post/create-post.tsx b/src/shared/components/post/create-post.tsx index e40ca481..4fcca529 100644 --- a/src/shared/components/post/create-post.tsx +++ b/src/shared/components/post/create-post.tsx @@ -1,4 +1,5 @@ import { Component } from "inferno"; +import { Redirect } from "inferno-router"; import { RouteComponentProps } from "inferno-router/dist/Route"; import { GetCommunity, @@ -69,11 +70,6 @@ export class CreatePost extends Component< this.parseMessage = this.parseMessage.bind(this); this.subscription = wsSubscribe(this.parseMessage); - if (!UserService.Instance.myUserInfo && isBrowser()) { - toast(i18n.t("not_logged_in"), "danger"); - this.context.router.history.push(`/login`); - } - // Only fetch the data if coming from another route if (this.isoData.path === this.context.router.route.match.url) { const communityRes = this.isoData.routeData[0] as @@ -149,6 +145,7 @@ export class CreatePost extends Component< return (
+ {!UserService.Instance.myUserInfo && }