forked from nutomic/lemmy
parent
a5bfc837ea
commit
8390744391
3 changed files with 452 additions and 386 deletions
41
ui/src/components/comment-node.tsx
vendored
41
ui/src/components/comment-node.tsx
vendored
|
@ -48,6 +48,7 @@ interface CommentNodeState {
|
|||
showConfirmAppointAsAdmin: boolean;
|
||||
collapsed: boolean;
|
||||
viewSource: boolean;
|
||||
showAdvanced: boolean;
|
||||
my_vote: number;
|
||||
score: number;
|
||||
upvotes: number;
|
||||
|
@ -81,6 +82,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
banType: BanType.Community,
|
||||
collapsed: false,
|
||||
viewSource: false,
|
||||
showAdvanced: false,
|
||||
showConfirmTransferSite: false,
|
||||
showConfirmTransferCommunity: false,
|
||||
showConfirmAppointAsMod: false,
|
||||
|
@ -300,6 +302,17 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</Link>
|
||||
</li>
|
||||
)}
|
||||
{!this.state.showAdvanced ? (
|
||||
<li className="list-inline-item">
|
||||
<span
|
||||
className="pointer"
|
||||
onClick={linkEvent(this, this.handleShowAdvanced)}
|
||||
>
|
||||
{i18n.t('more')}
|
||||
</span>
|
||||
</li>
|
||||
) : (
|
||||
<>
|
||||
<li className="list-inline-item">•</li>
|
||||
<li className="list-inline-item">
|
||||
<span
|
||||
|
@ -418,7 +431,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</>
|
||||
)}
|
||||
{/* Community creators and admins can transfer community to another mod */}
|
||||
{(this.amCommunityCreator || this.canAdmin) && this.isMod && (
|
||||
{(this.amCommunityCreator || this.canAdmin) &&
|
||||
this.isMod && (
|
||||
<li className="list-inline-item">
|
||||
{!this.state.showConfirmTransferCommunity ? (
|
||||
<span
|
||||
|
@ -448,7 +462,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
class="pointer d-inline-block"
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleCancelShowConfirmTransferCommunity
|
||||
this
|
||||
.handleCancelShowConfirmTransferCommunity
|
||||
)}
|
||||
>
|
||||
{i18n.t('no')}
|
||||
|
@ -465,7 +480,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
{!node.comment.banned ? (
|
||||
<span
|
||||
class="pointer"
|
||||
onClick={linkEvent(this, this.handleModBanShow)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleModBanShow
|
||||
)}
|
||||
>
|
||||
{i18n.t('ban_from_site')}
|
||||
</span>
|
||||
|
@ -503,7 +521,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</span>
|
||||
<span
|
||||
class="pointer d-inline-block mr-1"
|
||||
onClick={linkEvent(this, this.handleAddAdmin)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleAddAdmin
|
||||
)}
|
||||
>
|
||||
{i18n.t('yes')}
|
||||
</span>
|
||||
|
@ -542,7 +563,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</span>
|
||||
<span
|
||||
class="pointer d-inline-block mr-1"
|
||||
onClick={linkEvent(this, this.handleTransferSite)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleTransferSite
|
||||
)}
|
||||
>
|
||||
{i18n.t('yes')}
|
||||
</span>
|
||||
|
@ -561,6 +585,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
@ -1016,4 +1042,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
i.state.viewSource = !i.state.viewSource;
|
||||
i.setState(i.state);
|
||||
}
|
||||
|
||||
handleShowAdvanced(i: CommentNode) {
|
||||
i.state.showAdvanced = !i.state.showAdvanced;
|
||||
i.setState(i.state);
|
||||
}
|
||||
}
|
||||
|
|
46
ui/src/components/post-listing.tsx
vendored
46
ui/src/components/post-listing.tsx
vendored
|
@ -45,6 +45,7 @@ interface PostListingState {
|
|||
showConfirmTransferCommunity: boolean;
|
||||
imageExpanded: boolean;
|
||||
viewSource: boolean;
|
||||
showAdvanced: boolean;
|
||||
my_vote: number;
|
||||
score: number;
|
||||
upvotes: number;
|
||||
|
@ -75,6 +76,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
showConfirmTransferCommunity: false,
|
||||
imageExpanded: false,
|
||||
viewSource: false,
|
||||
showAdvanced: false,
|
||||
my_vote: this.props.post.my_vote,
|
||||
score: this.props.post.score,
|
||||
upvotes: this.props.post.upvotes,
|
||||
|
@ -511,6 +513,18 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!this.state.showAdvanced && this.props.showBody ? (
|
||||
<li className="list-inline-item">
|
||||
<span
|
||||
className="pointer"
|
||||
onClick={linkEvent(this, this.handleShowAdvanced)}
|
||||
>
|
||||
{i18n.t('more')}
|
||||
</span>
|
||||
</li>
|
||||
) : (
|
||||
<>
|
||||
{this.canModOnSelf && (
|
||||
<>
|
||||
<li className="list-inline-item">
|
||||
|
@ -518,7 +532,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
class="pointer"
|
||||
onClick={linkEvent(this, this.handleModLock)}
|
||||
>
|
||||
{post.locked ? i18n.t('unlock') : i18n.t('lock')}
|
||||
{post.locked
|
||||
? i18n.t('unlock')
|
||||
: i18n.t('lock')}
|
||||
</span>
|
||||
</li>
|
||||
<li className="list-inline-item">
|
||||
|
@ -539,7 +555,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
{!post.removed ? (
|
||||
<span
|
||||
class="pointer"
|
||||
onClick={linkEvent(this, this.handleModRemoveShow)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleModRemoveShow
|
||||
)}
|
||||
>
|
||||
{i18n.t('remove')}
|
||||
</span>
|
||||
|
@ -601,7 +620,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</>
|
||||
)}
|
||||
{/* Community creators and admins can transfer community to another mod */}
|
||||
{(this.amCommunityCreator || this.canAdmin) && this.isMod && (
|
||||
{(this.amCommunityCreator || this.canAdmin) &&
|
||||
this.isMod && (
|
||||
<li className="list-inline-item">
|
||||
{!this.state.showConfirmTransferCommunity ? (
|
||||
<span
|
||||
|
@ -631,7 +651,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
class="pointer d-inline-block"
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleCancelShowConfirmTransferCommunity
|
||||
this
|
||||
.handleCancelShowConfirmTransferCommunity
|
||||
)}
|
||||
>
|
||||
{i18n.t('no')}
|
||||
|
@ -648,7 +669,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
{!post.banned ? (
|
||||
<span
|
||||
class="pointer"
|
||||
onClick={linkEvent(this, this.handleModBanShow)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleModBanShow
|
||||
)}
|
||||
>
|
||||
{i18n.t('ban_from_site')}
|
||||
</span>
|
||||
|
@ -699,7 +723,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</span>
|
||||
<span
|
||||
class="pointer d-inline-block mr-1"
|
||||
onClick={linkEvent(this, this.handleTransferSite)}
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleTransferSite
|
||||
)}
|
||||
>
|
||||
{i18n.t('yes')}
|
||||
</span>
|
||||
|
@ -718,6 +745,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{this.props.showBody && post.body && (
|
||||
<li className="list-inline-item">
|
||||
<span
|
||||
|
@ -1201,4 +1230,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
i.state.viewSource = !i.state.viewSource;
|
||||
i.setState(i.state);
|
||||
}
|
||||
|
||||
handleShowAdvanced(i: PostListing) {
|
||||
i.state.showAdvanced = !i.state.showAdvanced;
|
||||
i.setState(i.state);
|
||||
}
|
||||
}
|
||||
|
|
1
ui/translations/en.json
vendored
1
ui/translations/en.json
vendored
|
@ -29,6 +29,7 @@
|
|||
"message": "Message",
|
||||
"edit": "edit",
|
||||
"reply": "reply",
|
||||
"more": "more",
|
||||
"cancel": "Cancel",
|
||||
"preview": "Preview",
|
||||
"upload_image": "upload image",
|
||||
|
|
Loading…
Reference in a new issue