summaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-09-13 08:37:12 -0700
committerDessalines <tyhou13@gmx.com>2019-09-13 08:37:12 -0700
commitc8da0a92ec7aecfb8fd37435ad2973af6b6fc04b (patch)
tree44202f9a52e72ec4459f31f054673e252301426d /ui/src
parent88f7c1e4ccd39d1c2cbc8f42c8a9e3938b3194fd (diff)
Add Creator flair for post creator / OPs comments
- Fixes #275
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/components/comment-node.tsx9
-rw-r--r--ui/src/components/comment-nodes.tsx2
-rw-r--r--ui/src/components/post.tsx2
-rw-r--r--ui/src/translations/en.ts1
4 files changed, 14 insertions, 0 deletions
diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx
index a4e398f1..b45f13fc 100644
--- a/ui/src/components/comment-node.tsx
+++ b/ui/src/components/comment-node.tsx
@@ -33,6 +33,7 @@ interface CommentNodeProps {
markable?: boolean;
moderators: Array<CommunityUser>;
admins: Array<UserView>;
+ postCreatorId?: number;
}
export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
@@ -87,6 +88,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{this.isAdmin &&
<li className="list-inline-item badge badge-light"><T i18nKey="admin">#</T></li>
}
+ {this.isPostCreator &&
+ <li className="list-inline-item badge badge-light"><T i18nKey="creator">#</T></li>
+ }
{(node.comment.banned_from_community || node.comment.banned) &&
<li className="list-inline-item badge badge-danger"><T i18nKey="banned">#</T></li>
}
@@ -255,6 +259,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
locked={this.props.locked}
moderators={this.props.moderators}
admins={this.props.admins}
+ postCreatorId={this.props.postCreatorId}
/>
}
{/* A collapsed clearfix */}
@@ -275,6 +280,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
return this.props.admins && isMod(this.props.admins.map(a => a.id), this.props.node.comment.creator_id);
}
+ get isPostCreator(): boolean {
+ return this.props.node.comment.creator_id == this.props.postCreatorId;
+ }
+
get canMod(): boolean {
if (this.props.admins && this.props.moderators) {
diff --git a/ui/src/components/comment-nodes.tsx b/ui/src/components/comment-nodes.tsx
index fca323e3..1e61c2f0 100644
--- a/ui/src/components/comment-nodes.tsx
+++ b/ui/src/components/comment-nodes.tsx
@@ -9,6 +9,7 @@ interface CommentNodesProps {
nodes: Array<CommentNodeI>;
moderators?: Array<CommunityUser>;
admins?: Array<UserView>;
+ postCreatorId?: number;
noIndent?: boolean;
viewOnly?: boolean;
locked?: boolean;
@@ -31,6 +32,7 @@ export class CommentNodes extends Component<CommentNodesProps, CommentNodesState
locked={this.props.locked}
moderators={this.props.moderators}
admins={this.props.admins}
+ postCreatorId={this.props.postCreatorId}
markable={this.props.markable}
/>
)}
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 5047d20b..07bddd34 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -183,6 +183,7 @@ export class Post extends Component<any, PostState> {
locked={this.state.post.locked}
moderators={this.state.moderators}
admins={this.state.admins}
+ postCreatorId={this.state.post.creator_id}
/>
)}
</div>
@@ -256,6 +257,7 @@ export class Post extends Component<any, PostState> {
locked={this.state.post.locked}
moderators={this.state.moderators}
admins={this.state.admins}
+ postCreatorId={this.state.post.creator_id}
/>
</div>
);
diff --git a/ui/src/translations/en.ts b/ui/src/translations/en.ts
index 5ec03671..459e3b79 100644
--- a/ui/src/translations/en.ts
+++ b/ui/src/translations/en.ts
@@ -64,6 +64,7 @@ export const en = {
save: 'save',
unsave: 'unsave',
create: 'create',
+ creator: 'creator',
username: 'Username',
email_or_username: 'Email or Username',
number_of_users:'{{count}} Users',