Skip to content
Snippets Groups Projects
Unverified Commit e8da11c1 authored by Raphael Krut-Landau's avatar Raphael Krut-Landau Committed by GitHub
Browse files

Don't include blank actions in the entitymenu (#40111)

Fixes a problem introduced in #39782
parent a94ece6f
No related branches found
No related tags found
No related merge requests found
......@@ -106,26 +106,36 @@ function EntityItemMenu({
const actions = useMemo(() => {
const result = [];
const bookmarkAction = {
title: isBookmarked ? t`Remove from bookmarks` : t`Bookmark`,
icon: "bookmark",
action: onToggleBookmark,
};
const bookmarkAction = onToggleBookmark
? {
title: isBookmarked ? t`Remove from bookmarks` : t`Bookmark`,
icon: "bookmark",
action: onToggleBookmark,
}
: null;
if (isPinned) {
result.push({
title: t`Unpin`,
icon: "unpin",
action: onPin,
});
result.push(bookmarkAction);
if (onPin) {
result.push({
title: t`Unpin`,
icon: "unpin",
action: onPin,
});
}
if (bookmarkAction) {
result.push(bookmarkAction);
}
} else {
result.push(bookmarkAction);
result.push({
title: t`Pin this`,
icon: "pin",
action: onPin,
});
if (bookmarkAction) {
result.push(bookmarkAction);
}
if (onPin) {
result.push({
title: t`Pin this`,
icon: "pin",
action: onPin,
});
}
}
if (isMetabotShown) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment