From 253bc3e0afb6adf64b79f334a8bc1f972aa45eba Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 22 Jan 2020 16:35:29 -0500 Subject: Adding private messaging, and matrix user ids. - Fixes #244 --- ui/src/components/inbox.tsx | 117 +++++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 29 deletions(-) (limited to 'ui/src/components/inbox.tsx') diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx index a302b834..6a426bcc 100644 --- a/ui/src/components/inbox.tsx +++ b/ui/src/components/inbox.tsx @@ -12,10 +12,15 @@ import { GetUserMentionsResponse, UserMentionResponse, CommentResponse, + PrivateMessage as PrivateMessageI, + GetPrivateMessagesForm, + PrivateMessagesResponse, + PrivateMessageResponse, } from '../interfaces'; import { WebSocketService, UserService } from '../services'; -import { msgOp, fetchLimit } from '../utils'; +import { msgOp, fetchLimit, isCommentType } from '../utils'; import { CommentNodes } from './comment-nodes'; +import { PrivateMessage } from './private-message'; import { SortSelect } from './sort-select'; import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; @@ -26,9 +31,10 @@ enum UnreadOrAll { } enum UnreadType { - Both, + All, Replies, Mentions, + Messages, } interface InboxState { @@ -36,6 +42,7 @@ interface InboxState { unreadType: UnreadType; replies: Array; mentions: Array; + messages: Array; sort: SortType; page: number; } @@ -44,9 +51,10 @@ export class Inbox extends Component { private subscription: Subscription; private emptyState: InboxState = { unreadOrAll: UnreadOrAll.Unread, - unreadType: UnreadType.Both, + unreadType: UnreadType.All, replies: [], mentions: [], + messages: [], sort: SortType.New, page: 1, }; @@ -103,7 +111,10 @@ export class Inbox extends Component { - {this.state.replies.length + this.state.mentions.length > 0 && + {this.state.replies.length + + this.state.mentions.length + + this.state.messages.length > + 0 && this.state.unreadOrAll == UnreadOrAll.Unread && (
  • @@ -114,9 +125,10 @@ export class Inbox extends Component {
)} {this.selects()} - {this.state.unreadType == UnreadType.Both && this.both()} + {this.state.unreadType == UnreadType.All && this.all()} {this.state.unreadType == UnreadType.Replies && this.replies()} {this.state.unreadType == UnreadType.Mentions && this.mentions()} + {this.state.unreadType == UnreadType.Messages && this.messages()} {this.paginator()} @@ -150,8 +162,8 @@ export class Inbox extends Component { -