summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-07-08 01:02:14 -0400
committerDessalines <tyhou13@gmx.com>2020-07-08 01:02:14 -0400
commitcd4e0ab3c2cfd615e4771fb9181a31ce237b5ceb (patch)
tree699dd63cd3ad7601e49a1173884506e3638ae37a /ui/src/components/post-form.tsx
parent8fda7d00d5ec9e415b44aa10cff3c4d735563a20 (diff)
HTML title bugs.
- Fixing HTML titles for some pages. Fixes #801 - Removing WebSocketService.Instance.site, fetching site on demand now.
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r--ui/src/components/post-form.tsx25
1 files changed, 14 insertions, 11 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index fdf6ebe4..8c693ac0 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -16,7 +16,6 @@ import {
SearchForm,
SearchType,
SearchResponse,
- GetSiteResponse,
WebSocketJsonResponse,
} from '../interfaces';
import { WebSocketService, UserService } from '../services';
@@ -52,6 +51,8 @@ interface PostFormProps {
onCancel?(): any;
onCreate?(id: number): any;
onEdit?(post: Post): any;
+ enableNsfw: boolean;
+ enableDownvotes: boolean;
}
interface PostFormState {
@@ -63,7 +64,6 @@ interface PostFormState {
suggestedTitle: string;
suggestedPosts: Array<Post>;
crossPosts: Array<Post>;
- enable_nsfw: boolean;
}
export class PostForm extends Component<PostFormProps, PostFormState> {
@@ -87,7 +87,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
suggestedTitle: undefined,
suggestedPosts: [],
crossPosts: [],
- enable_nsfw: undefined,
};
constructor(props: any, context: any) {
@@ -138,7 +137,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
};
WebSocketService.Instance.listCommunities(listCommunitiesForm);
- WebSocketService.Instance.getSite();
}
componentDidMount() {
@@ -240,7 +238,12 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<div class="my-1 text-muted small font-weight-bold">
{i18n.t('cross_posts')}
</div>
- <PostListings showCommunity posts={this.state.crossPosts} />
+ <PostListings
+ showCommunity
+ posts={this.state.crossPosts}
+ enableDownvotes={this.props.enableDownvotes}
+ enableNsfw={this.props.enableNsfw}
+ />
</>
)}
</div>
@@ -265,7 +268,11 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<div class="my-1 text-muted small font-weight-bold">
{i18n.t('related_posts')}
</div>
- <PostListings posts={this.state.suggestedPosts} />
+ <PostListings
+ posts={this.state.suggestedPosts}
+ enableDownvotes={this.props.enableDownvotes}
+ enableNsfw={this.props.enableNsfw}
+ />
</>
)}
</div>
@@ -346,7 +353,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
</div>
</div>
)}
- {this.state.enable_nsfw && (
+ {this.props.enableNsfw && (
<div class="form-group row">
<div class="col-sm-10">
<div class="form-check">
@@ -631,10 +638,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
this.state.crossPosts = data.posts;
}
this.setState(this.state);
- } else if (res.op == UserOperation.GetSite) {
- let data = res.data as GetSiteResponse;
- this.state.enable_nsfw = data.site.enable_nsfw;
- this.setState(this.state);
}
}
}