-Subproject commit 5c50ce3ebaf058ad5d4e9bcd445653960cbc98b1
+Subproject commit 007e53683768aeba63e9e4c179c1d240217bcee2
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,
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() {
render() {
return (
<div className="container-lg">
+ {!UserService.Instance.myUserInfo && <Redirect to="/login" />}
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
amMod,
amTopMod,
getUnixTime,
+ hostname,
mdToHtml,
myAuth,
numToSI,
}
sidebar() {
+ const myUSerInfo = UserService.Instance.myUserInfo;
+ const { name, actor_id } = this.props.community_view.community;
return (
<div>
<div className="card border-secondary mb-3">
<div className="card-body">
{this.communityTitle()}
{this.props.editable && this.adminButtons()}
- {this.subscribe()}
+ {myUSerInfo && this.subscribe()}
{this.canPost && this.createPost()}
- {this.blockCommunity()}
+ {myUSerInfo && this.blockCommunity()}
+ {!myUSerInfo && (
+ <div className="alert alert-info" role="alert">
+ {i18n.t("community_not_logged_in_alert", {
+ community: name,
+ instance: hostname(actor_id),
+ })}
+ </div>
+ )}
</div>
</div>
<div className="card border-secondary mb-3">
<BannerIconHeader icon={community.icon} banner={community.banner} />
)}
<span className="mr-2">{community.title}</span>
- {subscribed == SubscribedType.Subscribed && (
+ {subscribed === SubscribedType.Subscribed && (
<button
className="btn btn-secondary btn-sm mr-2"
onClick={linkEvent(this, this.handleUnsubscribe)}
{i18n.t("joined")}
</button>
)}
- {subscribed == SubscribedType.Pending && (
+ {subscribed === SubscribedType.Pending && (
<button
className="btn btn-warning mr-2"
onClick={linkEvent(this, this.handleUnsubscribe)}
.format("MMM DD, YYYY")}
</span>
</div>
+ {!UserService.Instance.myUserInfo && (
+ <div className="alert alert-info" role="alert">
+ {i18n.t("profile_not_logged_in_alert")}
+ </div>
+ )}
</div>
</div>
</div>
import { Component } from "inferno";
+import { Redirect } from "inferno-router";
import { RouteComponentProps } from "inferno-router/dist/Route";
import {
GetCommunity,
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
return (
<div className="container-lg">
+ {!UserService.Instance.myUserInfo && <Redirect to="/login" />}
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
| PostFormParams
| undefined;
- this.props.history.push(
+ this.props.history.replace(
`/create_post${getQueryString(queryParams)}`,
locationState
);