mirror of
https://github.com/outline/outline.git
synced 2026-11-27 07:58:51 +03:00
review
This commit is contained in:
1 parent
08f73a8836
commit
9d27fa2920
7 files changed
+39
-18
No files matched your search
@@ -233,7 +233,7 @@ export const subscribeCollection = createAction({
|
||||
|
||||
await collection?.subscribe();
|
||||
|
||||
toast.success(t("Subscribed to collection notifications"));
|
||||
toast.success(t("Subscribed to document notifications"));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -263,7 +263,7 @@ export const unsubscribeCollection = createAction({
|
||||
|
||||
await collection?.unsubscribe();
|
||||
|
||||
toast.success(t("Unsubscribed from collection notifications"));
|
||||
toast.success(t("Unsubscribed from document notifications"));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -393,5 +393,7 @@ export const rootCollectionActions = [
|
||||
createCollection,
|
||||
starCollection,
|
||||
unstarCollection,
|
||||
subscribeCollection,
|
||||
unsubscribeCollection,
|
||||
deleteCollection,
|
||||
];
|
||||
@@ -348,9 +348,9 @@ export const unsubscribeDocument = createAction({
|
||||
const document = stores.documents.get(activeDocumentId);
|
||||
|
||||
return (
|
||||
!document?.collection?.isSubscribed &&
|
||||
!!document?.isSubscribed &&
|
||||
stores.policies.abilities(activeDocumentId).unsubscribe
|
||||
!!document?.collection?.isSubscribed ||
|
||||
(!!document?.isSubscribed &&
|
||||
stores.policies.abilities(activeDocumentId).unsubscribe)
|
||||
);
|
||||
},
|
||||
perform: async ({ activeDocumentId, stores, currentUserId, t }) => {
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
MenuHeading,
|
||||
MenuItem as TMenuItem,
|
||||
} from "~/types";
|
||||
import Tooltip from "../Tooltip";
|
||||
import Header from "./Header";
|
||||
import MenuItem, { MenuAnchor } from "./MenuItem";
|
||||
import MouseSafeArea from "./MouseSafeArea";
|
||||
@@ -167,7 +168,7 @@ function Template({ items, actions, context, showIcons, ...menu }: Props) {
|
||||
}
|
||||
|
||||
if (item.type === "button") {
|
||||
return (
|
||||
const menuItem = (
|
||||
<MenuItem
|
||||
as="button"
|
||||
id={`${item.title}-${index}`}
|
||||
@@ -182,6 +183,14 @@ function Template({ items, actions, context, showIcons, ...menu }: Props) {
|
||||
{item.title}
|
||||
</MenuItem>
|
||||
);
|
||||
|
||||
return item.tooltip ? (
|
||||
<Tooltip content={item.tooltip} placement={"bottom"}>
|
||||
<div>{menuItem}</div>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<>{menuItem}</>
|
||||
);
|
||||
}
|
||||
|
||||
if (item.type === "submenu") {
|
||||
|
||||
@@ -57,7 +57,7 @@ import useMobile from "~/hooks/useMobile";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useRequest from "~/hooks/useRequest";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { MenuItem } from "~/types";
|
||||
import { MenuItem, MenuItemButton } from "~/types";
|
||||
import { documentEditPath } from "~/utils/routeHelpers";
|
||||
import { MenuContext, useMenuContext } from "./MenuContext";
|
||||
|
||||
@@ -257,8 +257,20 @@ const MenuContent: React.FC<MenuContentProps> = observer(function MenuContent_({
|
||||
},
|
||||
actionToMenuItem(starDocument, context),
|
||||
actionToMenuItem(unstarDocument, context),
|
||||
actionToMenuItem(subscribeDocument, context),
|
||||
actionToMenuItem(unsubscribeDocument, context),
|
||||
{
|
||||
...actionToMenuItem(subscribeDocument, context),
|
||||
disabled: collection?.isSubscribed,
|
||||
tooltip: collection?.isSubscribed
|
||||
? t("Subscription inherited from collection")
|
||||
: undefined,
|
||||
} as MenuItemButton,
|
||||
{
|
||||
...actionToMenuItem(unsubscribeDocument, context),
|
||||
disabled: collection?.isSubscribed,
|
||||
tooltip: collection?.isSubscribed
|
||||
? t("Subscription inherited from collection")
|
||||
: undefined,
|
||||
} as MenuItemButton,
|
||||
{
|
||||
type: "button",
|
||||
title: `${t("Find and replace")}…`,
|
||||
|
||||
@@ -27,6 +27,7 @@ export type MenuItemButton = {
|
||||
selected?: boolean;
|
||||
disabled?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
tooltip?: React.ReactChild;
|
||||
};
|
||||
|
||||
export type MenuItemWithChildren = {
|
||||
|
||||
@@ -168,12 +168,10 @@ export default class NotificationHelper {
|
||||
attributes: ["userId"],
|
||||
where: {
|
||||
userId: recipients.map((recipient) => recipient.id),
|
||||
event: SubscriptionType.Document,
|
||||
[Op.or]: [
|
||||
{
|
||||
collectionId: document.collectionId,
|
||||
event: SubscriptionType.Document,
|
||||
},
|
||||
{ documentId: document.id, event: SubscriptionType.Document },
|
||||
{ collectionId: document.collectionId },
|
||||
{ documentId: document.id },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
"Star": "Star",
|
||||
"Unstar": "Unstar",
|
||||
"Subscribe": "Subscribe",
|
||||
"Subscribed to collection notifications": "Subscribed to collection notifications",
|
||||
"Subscribed to document notifications": "Subscribed to document notifications",
|
||||
"Unsubscribe": "Unsubscribe",
|
||||
"Unsubscribed from collection notifications": "Unsubscribed from collection notifications",
|
||||
"Unsubscribed from document notifications": "Unsubscribed from document notifications",
|
||||
"Archive": "Archive",
|
||||
"Archive collection": "Archive collection",
|
||||
"Collection archived": "Collection archived",
|
||||
@@ -47,8 +47,6 @@
|
||||
"Publish document": "Publish document",
|
||||
"Unpublish": "Unpublish",
|
||||
"Unpublished {{ documentName }}": "Unpublished {{ documentName }}",
|
||||
"Subscribed to document notifications": "Subscribed to document notifications",
|
||||
"Unsubscribed from document notifications": "Unsubscribed from document notifications",
|
||||
"Share this document": "Share this document",
|
||||
"HTML": "HTML",
|
||||
"PDF": "PDF",
|
||||
@@ -534,6 +532,7 @@
|
||||
"{{ documentName }} restored": "{{ documentName }} restored",
|
||||
"Document options": "Document options",
|
||||
"Choose a collection": "Choose a collection",
|
||||
"Subscription inherited from collection": "Subscription inherited from collection",
|
||||
"Enable embeds": "Enable embeds",
|
||||
"Export options": "Export options",
|
||||
"Group members": "Group members",
|
||||
|
||||
Reference in new issue
Block a user