From: Dessalines Date: Fri, 13 Sep 2019 15:37:12 +0000 (-0700) Subject: Add Creator flair for post creator / OPs comments X-Git-Url: http://these/git/%22https:/image.com/readmes/%7B%60%24%7BarchiveUrl%7D/%7Bnode.comment.attributed_to%7D?a=commitdiff_plain;h=c8da0a92ec7aecfb8fd37435ad2973af6b6fc04b;p=lemmy.git Add Creator flair for post creator / OPs comments - Fixes #275 --- 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; admins: Array; + postCreatorId?: number; } export class CommentNode extends Component { @@ -87,6 +88,9 @@ export class CommentNode extends Component { {this.isAdmin &&
  • #
  • } + {this.isPostCreator && +
  • #
  • + } {(node.comment.banned_from_community || node.comment.banned) &&
  • #
  • } @@ -255,6 +259,7 @@ export class CommentNode extends Component { 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 { 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; moderators?: Array; admins?: Array; + postCreatorId?: number; noIndent?: boolean; viewOnly?: boolean; locked?: boolean; @@ -31,6 +32,7 @@ export class CommentNodes extends Component )} 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 { locked={this.state.post.locked} moderators={this.state.moderators} admins={this.state.admins} + postCreatorId={this.state.post.creator_id} /> )} @@ -256,6 +257,7 @@ export class Post extends Component { locked={this.state.post.locked} moderators={this.state.moderators} admins={this.state.admins} + postCreatorId={this.state.post.creator_id} /> ); 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',