);
}
@@ -649,14 +642,24 @@ export class PostListing extends Component {
);
}
- get hasAdvancedButtons() {
+ showPreviewButton() {
+ const post_view = this.postView;
+ const body = post_view.post.body;
+
return (
- this.myPost ||
- (this.showBody && this.postView.post.body) ||
- amMod(this.props.moderators) ||
- amAdmin() ||
- this.canMod_ ||
- this.canAdmin_
+
+
+
);
}
@@ -664,57 +667,64 @@ export class PostListing extends Component {
// Possible enhancement: Priority+ pattern instead of just hard coding which get hidden behind the show more button.
// Possible enhancement: Make each button a component.
const post_view = this.postView;
+ const post = post_view.post;
+
return (
<>
{this.saveButton}
{this.crossPostButton}
+ {/**
+ * If there is a URL, or if the post has a body and we were told not to
+ * show the body, show the MetadataCard/body toggle.
+ */}
+ {(post.url || (post.body && !this.props.showBody)) &&
+ this.showPreviewButton()}
+
{this.showBody && post_view.post.body && this.viewSourceButton}
- {this.hasAdvancedButtons && (
-
-
-
-
+
+
+
+
-
- {!this.myPost ? (
- <>
-
{this.reportButton}
-
{this.blockButton}
- >
- ) : (
- <>
-
{this.editButton}
-
{this.deleteButton}
- >
- )}
+
+ {!this.myPost ? (
+ <>
+
{this.reportButton}
+
{this.blockButton}
+ >
+ ) : (
+ <>
+
{this.editButton}
+
{this.deleteButton}
+ >
+ )}
- {/* Any mod can do these, not limited to hierarchy*/}
- {(amMod(this.props.moderators) || amAdmin()) && (
- <>
-
-
-
-
{this.lockButton}
- {this.featureButtons}
- >
- )}
+ {/* Any mod can do these, not limited to hierarchy*/}
+ {(amMod(this.props.moderators) || amAdmin()) && (
+ <>
+