forked from nutomic/lemmy
parent
6563fd6c41
commit
0b75d46453
4 changed files with 14 additions and 0 deletions
9
ui/src/components/comment-node.tsx
vendored
9
ui/src/components/comment-node.tsx
vendored
|
@ -33,6 +33,7 @@ interface CommentNodeProps {
|
||||||
markable?: boolean;
|
markable?: boolean;
|
||||||
moderators: Array<CommunityUser>;
|
moderators: Array<CommunityUser>;
|
||||||
admins: Array<UserView>;
|
admins: Array<UserView>;
|
||||||
|
postCreatorId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
|
@ -87,6 +88,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
{this.isAdmin &&
|
{this.isAdmin &&
|
||||||
<li className="list-inline-item badge badge-light"><T i18nKey="admin">#</T></li>
|
<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) &&
|
{(node.comment.banned_from_community || node.comment.banned) &&
|
||||||
<li className="list-inline-item badge badge-danger"><T i18nKey="banned">#</T></li>
|
<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}
|
locked={this.props.locked}
|
||||||
moderators={this.props.moderators}
|
moderators={this.props.moderators}
|
||||||
admins={this.props.admins}
|
admins={this.props.admins}
|
||||||
|
postCreatorId={this.props.postCreatorId}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{/* A collapsed clearfix */}
|
{/* 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);
|
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 {
|
get canMod(): boolean {
|
||||||
|
|
||||||
if (this.props.admins && this.props.moderators) {
|
if (this.props.admins && this.props.moderators) {
|
||||||
|
|
2
ui/src/components/comment-nodes.tsx
vendored
2
ui/src/components/comment-nodes.tsx
vendored
|
@ -9,6 +9,7 @@ interface CommentNodesProps {
|
||||||
nodes: Array<CommentNodeI>;
|
nodes: Array<CommentNodeI>;
|
||||||
moderators?: Array<CommunityUser>;
|
moderators?: Array<CommunityUser>;
|
||||||
admins?: Array<UserView>;
|
admins?: Array<UserView>;
|
||||||
|
postCreatorId?: number;
|
||||||
noIndent?: boolean;
|
noIndent?: boolean;
|
||||||
viewOnly?: boolean;
|
viewOnly?: boolean;
|
||||||
locked?: boolean;
|
locked?: boolean;
|
||||||
|
@ -31,6 +32,7 @@ export class CommentNodes extends Component<CommentNodesProps, CommentNodesState
|
||||||
locked={this.props.locked}
|
locked={this.props.locked}
|
||||||
moderators={this.props.moderators}
|
moderators={this.props.moderators}
|
||||||
admins={this.props.admins}
|
admins={this.props.admins}
|
||||||
|
postCreatorId={this.props.postCreatorId}
|
||||||
markable={this.props.markable}
|
markable={this.props.markable}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
2
ui/src/components/post.tsx
vendored
2
ui/src/components/post.tsx
vendored
|
@ -183,6 +183,7 @@ export class Post extends Component<any, PostState> {
|
||||||
locked={this.state.post.locked}
|
locked={this.state.post.locked}
|
||||||
moderators={this.state.moderators}
|
moderators={this.state.moderators}
|
||||||
admins={this.state.admins}
|
admins={this.state.admins}
|
||||||
|
postCreatorId={this.state.post.creator_id}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -256,6 +257,7 @@ export class Post extends Component<any, PostState> {
|
||||||
locked={this.state.post.locked}
|
locked={this.state.post.locked}
|
||||||
moderators={this.state.moderators}
|
moderators={this.state.moderators}
|
||||||
admins={this.state.admins}
|
admins={this.state.admins}
|
||||||
|
postCreatorId={this.state.post.creator_id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
1
ui/src/translations/en.ts
vendored
1
ui/src/translations/en.ts
vendored
|
@ -64,6 +64,7 @@ export const en = {
|
||||||
save: 'save',
|
save: 'save',
|
||||||
unsave: 'unsave',
|
unsave: 'unsave',
|
||||||
create: 'create',
|
create: 'create',
|
||||||
|
creator: 'creator',
|
||||||
username: 'Username',
|
username: 'Username',
|
||||||
email_or_username: 'Email or Username',
|
email_or_username: 'Email or Username',
|
||||||
number_of_users:'{{count}} Users',
|
number_of_users:'{{count}} Users',
|
||||||
|
|
Loading…
Reference in a new issue