FIX: Hide old bookmark button on post-menu if SiteSetting.enable_bookmarks_with_reminders

Hide old bookmark post-menu item if the site setting for the new bookmark reminders is enabled and change icon for the new bookmark functionality to the same as the old bookmark button
Fix null @topic_view error in post serializer for post_bookmark, as new posts do not have a @topic_view
This commit is contained in:
Martin Brennan
2019-12-12 16:28:01 +10:00
committed by GitHub
parent 9d6a9bba96
commit 9f4c9bafa1
3 changed files with 23 additions and 5 deletions

View File

@@ -332,7 +332,7 @@ registerButton("bookmarkWithReminder", (attrs, state, siteSettings) => {
title,
titleOptions,
className: classNames.join(" "),
icon: "book"
icon: "bookmark"
};
});
@@ -460,7 +460,16 @@ export default createWidget("post-menu", {
const allButtons = [];
let visibleButtons = [];
const orderedButtons = this.menuItems();
// filter menu items based on site settings
const orderedButtons = this.menuItems().filter(button => {
if (
this.siteSettings.enable_bookmarks_with_reminders &&
button === "bookmark"
) {
return false;
}
return true;
});
// If the post is a wiki, make Edit more prominent
if (attrs.wiki && attrs.canEdit) {