Merge pull request #1398 from jsit/fix/always-show-advanced-buttons

fix: Always show advanced post buttons dropdown
This commit is contained in:
SleeplessOne1917 2023-06-19 20:06:46 +00:00 committed by GitHub
commit b92d023ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 52 deletions

View File

@ -642,17 +642,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
); );
} }
get hasAdvancedButtons() {
return (
this.myPost ||
(this.showBody && this.postView.post.body) ||
amMod(this.props.moderators) ||
amAdmin() ||
this.canMod_ ||
this.canAdmin_
);
}
showPreviewButton() { showPreviewButton() {
const post_view = this.postView; const post_view = this.postView;
const body = post_view.post.body; const body = post_view.post.body;
@ -694,50 +683,48 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
{this.showBody && post_view.post.body && this.viewSourceButton} {this.showBody && post_view.post.body && this.viewSourceButton}
{this.hasAdvancedButtons && ( <div className="dropdown">
<div className="dropdown"> <button
<button className="btn btn-link btn-animate text-muted py-0 dropdown-toggle"
className="btn btn-link btn-animate text-muted py-0 dropdown-toggle" onClick={linkEvent(this, this.handleShowAdvanced)}
onClick={linkEvent(this, this.handleShowAdvanced)} data-tippy-content={i18n.t("more")}
data-tippy-content={i18n.t("more")} data-bs-toggle="dropdown"
data-bs-toggle="dropdown" aria-expanded="false"
aria-expanded="false" aria-controls="advancedButtonsDropdown"
aria-controls="advancedButtonsDropdown" aria-label={i18n.t("more")}
aria-label={i18n.t("more")} >
> <Icon icon="more-vertical" inline />
<Icon icon="more-vertical" inline /> </button>
</button>
<ul className="dropdown-menu" id="advancedButtonsDropdown"> <ul className="dropdown-menu" id="advancedButtonsDropdown">
{!this.myPost ? ( {!this.myPost ? (
<> <>
<li>{this.reportButton}</li> <li>{this.reportButton}</li>
<li>{this.blockButton}</li> <li>{this.blockButton}</li>
</> </>
) : ( ) : (
<> <>
<li>{this.editButton}</li> <li>{this.editButton}</li>
<li>{this.deleteButton}</li> <li>{this.deleteButton}</li>
</> </>
)} )}
{/* Any mod can do these, not limited to hierarchy*/} {/* Any mod can do these, not limited to hierarchy*/}
{(amMod(this.props.moderators) || amAdmin()) && ( {(amMod(this.props.moderators) || amAdmin()) && (
<> <>
<li> <li>
<hr className="dropdown-divider" /> <hr className="dropdown-divider" />
</li> </li>
<li>{this.lockButton}</li> <li>{this.lockButton}</li>
{this.featureButtons} {this.featureButtons}
</> </>
)} )}
{(this.canMod_ || this.canAdmin_) && ( {(this.canMod_ || this.canAdmin_) && (
<li>{this.modRemoveButton}</li> <li>{this.modRemoveButton}</li>
)} )}
</ul> </ul>
</div> </div>
)}
</> </>
); );
} }