summaryrefslogtreecommitdiffstats
path: root/ui/src/components/inbox.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/inbox.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/inbox.tsx')
-rw-r--r--ui/src/components/inbox.tsx20
1 files changed, 14 insertions, 6 deletions
diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx
index 3b963a79..a88d45c5 100644
--- a/ui/src/components/inbox.tsx
+++ b/ui/src/components/inbox.tsx
@@ -16,6 +16,7 @@ import {
GetPrivateMessagesForm,
PrivateMessagesResponse,
PrivateMessageResponse,
+ GetSiteResponse,
} from '../interfaces';
import { WebSocketService, UserService } from '../services';
import {
@@ -56,6 +57,7 @@ interface InboxState {
messages: Array<PrivateMessageI>;
sort: SortType;
page: number;
+ enableDownvotes: boolean;
}
export class Inbox extends Component<any, InboxState> {
@@ -68,6 +70,7 @@ export class Inbox extends Component<any, InboxState> {
messages: [],
sort: SortType.New,
page: 1,
+ enableDownvotes: undefined,
};
constructor(props: any, context: any) {
@@ -85,18 +88,13 @@ export class Inbox extends Component<any, InboxState> {
);
this.refetch();
+ WebSocketService.Instance.getSite();
}
componentWillUnmount() {
this.subscription.unsubscribe();
}
- componentDidMount() {
- document.title = `/u/${UserService.Instance.user.username} ${i18n.t(
- 'inbox'
- )} - ${WebSocketService.Instance.site.name}`;
- }
-
render() {
return (
<div class="container">
@@ -270,6 +268,7 @@ export class Inbox extends Component<any, InboxState> {
noIndent
markable
showContext
+ enableDownvotes={this.state.enableDownvotes}
/>
) : (
<PrivateMessage privateMessage={i} />
@@ -287,6 +286,7 @@ export class Inbox extends Component<any, InboxState> {
noIndent
markable
showContext
+ enableDownvotes={this.state.enableDownvotes}
/>
</div>
);
@@ -301,6 +301,7 @@ export class Inbox extends Component<any, InboxState> {
noIndent
markable
showContext
+ enableDownvotes={this.state.enableDownvotes}
/>
))}
</div>
@@ -522,6 +523,13 @@ export class Inbox extends Component<any, InboxState> {
let data = res.data as CommentResponse;
createCommentLikeRes(data, this.state.replies);
this.setState(this.state);
+ } else if (res.op == UserOperation.GetSite) {
+ let data = res.data as GetSiteResponse;
+ this.state.enableDownvotes = data.site.enable_downvotes;
+ this.setState(this.state);
+ document.title = `/u/${UserService.Instance.user.username} ${i18n.t(
+ 'inbox'
+ )} - ${data.site.name}`;
}
}