Fix metting pages permissions handling
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<fb3a05b463e9f6065118d1b4441ce398>>
|
* @generated SignedSource<<6ed3e434ef2a7f39c1ccddb4c3ddd8b2>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -28,6 +28,7 @@ export type CreateMeetingDialogCreateMutation$data = {
|
|||||||
readonly fullName: string;
|
readonly fullName: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
}>;
|
}>;
|
||||||
|
readonly canDelete: boolean;
|
||||||
readonly date: any;
|
readonly date: any;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly minutes: string | null | undefined;
|
readonly minutes: string | null | undefined;
|
||||||
@@ -122,6 +123,19 @@ v4 = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -195,16 +209,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "cf37e45c7e8cffd8b44cdc85488209e8",
|
"cacheID": "6b9dce0e1a88fdf272b516cf59bb4137",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "CreateMeetingDialogCreateMutation",
|
"name": "CreateMeetingDialogCreateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation CreateMeetingDialogCreateMutation(\n $input: CreateMeetingInput!\n) {\n createMeeting(input: $input) {\n meetingEdge {\n node {\n id\n name\n date\n minutes\n attendees {\n id\n fullName\n }\n }\n }\n }\n}\n"
|
"text": "mutation CreateMeetingDialogCreateMutation(\n $input: CreateMeetingInput!\n) {\n createMeeting(input: $input) {\n meetingEdge {\n node {\n id\n name\n date\n minutes\n attendees {\n id\n fullName\n }\n canDelete: permission(action: \"core:meeting:delete\")\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "5ba1bb7a0344e0ea19b383af6d75534f";
|
(node as any).hash = "b69925d4ec72b17467f8f50158d02f6f";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<3684f6d6c3a9746dcfcb8bb0156d2201>>
|
* @generated SignedSource<<dfda77f468e3df0f5b1f0c4501739cca>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -15,6 +15,8 @@ export type MeetingDetailPageMeetingFragment$data = {
|
|||||||
readonly fullName: string;
|
readonly fullName: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
}>;
|
}>;
|
||||||
|
readonly canDelete: boolean;
|
||||||
|
readonly canUpdate: boolean;
|
||||||
readonly date: any;
|
readonly date: any;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly minutes: string | null | undefined;
|
readonly minutes: string | null | undefined;
|
||||||
@@ -62,6 +64,32 @@ return {
|
|||||||
"name": "minutes",
|
"name": "minutes",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -87,6 +115,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "ae1564a2e5115bfffe20359c5288d4eb";
|
(node as any).hash = "16fcd4d8cc7dbe80bc7fd37ac5e824e8";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<ab4ee2b9dc7e4e5443dea3bd188d6dac>>
|
* @generated SignedSource<<7ac900885cf356d87efb7496bd37bbad>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -15,6 +15,7 @@ export type MeetingGraphListQuery$variables = {
|
|||||||
};
|
};
|
||||||
export type MeetingGraphListQuery$data = {
|
export type MeetingGraphListQuery$data = {
|
||||||
readonly organization: {
|
readonly organization: {
|
||||||
|
readonly canCreateMeeting?: boolean;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"MeetingsPageListFragment">;
|
readonly " $fragmentSpreads": FragmentRefs<"MeetingsPageListFragment">;
|
||||||
};
|
};
|
||||||
@@ -47,13 +48,26 @@ v2 = {
|
|||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v3 = {
|
v3 = {
|
||||||
|
"alias": "canCreateMeeting",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:create"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:create\")"
|
||||||
|
},
|
||||||
|
v4 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "__typename",
|
"name": "__typename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v4 = [
|
v5 = [
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
@@ -84,6 +98,14 @@ return {
|
|||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
|
{
|
||||||
|
"kind": "InlineFragment",
|
||||||
|
"selections": [
|
||||||
|
(v3/*: any*/)
|
||||||
|
],
|
||||||
|
"type": "Organization",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "FragmentSpread",
|
"kind": "FragmentSpread",
|
||||||
@@ -110,11 +132,12 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
|
(v3/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -135,7 +158,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"concreteType": "MeetingConnection",
|
"concreteType": "MeetingConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "meetings",
|
"name": "meetings",
|
||||||
@@ -191,7 +214,20 @@ return {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v3/*: any*/)
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
|
},
|
||||||
|
(v4/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
@@ -261,7 +297,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"filters": [
|
"filters": [
|
||||||
"orderBy"
|
"orderBy"
|
||||||
],
|
],
|
||||||
@@ -280,16 +316,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "e320d73109abe57bb9fa89ade5fa0892",
|
"cacheID": "68a020e412baf691d3ce96eff5817190",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "MeetingGraphListQuery",
|
"name": "MeetingGraphListQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query MeetingGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ...MeetingsPageListFragment\n }\n}\n\nfragment MeetingsPageListFragment on Organization {\n id\n context {\n summary\n }\n meetings(first: 50, orderBy: {field: DATE, direction: DESC}) {\n edges {\n node {\n id\n ...MeetingsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment MeetingsPageRowFragment on Meeting {\n id\n name\n date\n attendees {\n id\n fullName\n }\n}\n"
|
"text": "query MeetingGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ... on Organization {\n canCreateMeeting: permission(action: \"core:meeting:create\")\n }\n ...MeetingsPageListFragment\n }\n}\n\nfragment MeetingsPageListFragment on Organization {\n id\n context {\n summary\n }\n meetings(first: 50, orderBy: {field: DATE, direction: DESC}) {\n edges {\n node {\n id\n ...MeetingsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment MeetingsPageRowFragment on Meeting {\n id\n name\n date\n attendees {\n id\n fullName\n }\n canDelete: permission(action: \"core:meeting:delete\")\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "be13ec2953f71c4955a5f46b93f0131f";
|
(node as any).hash = "3ec4cedaa00b3109b79df0425db7f094";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<c19b786d81cd6f7adc4da4a4c3ad9346>>
|
* @generated SignedSource<<75a92b14ee7a1d73c9dde3d9d8d76de6>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -118,6 +118,32 @@ return {
|
|||||||
"name": "minutes",
|
"name": "minutes",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -147,12 +173,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "a4df3c8c55dc1bf379bba19af16448d7",
|
"cacheID": "efaa301fdd6d05385d7858d182d4b2ec",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "MeetingGraphNodeQuery",
|
"name": "MeetingGraphNodeQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query MeetingGraphNodeQuery(\n $meetingId: ID!\n) {\n node(id: $meetingId) {\n __typename\n ...MeetingDetailPageMeetingFragment\n id\n }\n}\n\nfragment MeetingDetailPageMeetingFragment on Meeting {\n id\n name\n date\n minutes\n attendees {\n id\n fullName\n }\n}\n"
|
"text": "query MeetingGraphNodeQuery(\n $meetingId: ID!\n) {\n node(id: $meetingId) {\n __typename\n ...MeetingDetailPageMeetingFragment\n id\n }\n}\n\nfragment MeetingDetailPageMeetingFragment on Meeting {\n id\n name\n date\n minutes\n canUpdate: permission(action: \"core:meeting:update\")\n canDelete: permission(action: \"core:meeting:delete\")\n attendees {\n id\n fullName\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<829d26690dc2a6f09541f02ef8981395>>
|
* @generated SignedSource<<c50d9a4ec082e190a0f0b3a9e1a7f5c2>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -266,6 +266,19 @@ return {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
|
},
|
||||||
(v11/*: any*/)
|
(v11/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -355,12 +368,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "e5e74555d8a277638d2278c5b71b930b",
|
"cacheID": "f4135654e654bbaa31192269ff567752",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "MeetingsListQuery",
|
"name": "MeetingsListQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query MeetingsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: MeetingOrder = {field: DATE, direction: DESC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...MeetingsPageListFragment_16fISc\n id\n }\n}\n\nfragment MeetingsPageListFragment_16fISc on Organization {\n id\n context {\n summary\n }\n meetings(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n ...MeetingsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment MeetingsPageRowFragment on Meeting {\n id\n name\n date\n attendees {\n id\n fullName\n }\n}\n"
|
"text": "query MeetingsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: MeetingOrder = {field: DATE, direction: DESC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...MeetingsPageListFragment_16fISc\n id\n }\n}\n\nfragment MeetingsPageListFragment_16fISc on Organization {\n id\n context {\n summary\n }\n meetings(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n ...MeetingsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment MeetingsPageRowFragment on Meeting {\n id\n name\n date\n attendees {\n id\n fullName\n }\n canDelete: permission(action: \"core:meeting:delete\")\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<7efb971ec8052cecbd96f86ea6d3af4c>>
|
* @generated SignedSource<<2ca6c35e54eafa06ad04d91bfc555eed>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -15,6 +15,7 @@ export type MeetingsPageRowFragment$data = {
|
|||||||
readonly fullName: string;
|
readonly fullName: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
}>;
|
}>;
|
||||||
|
readonly canDelete: boolean;
|
||||||
readonly date: any;
|
readonly date: any;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
@@ -72,6 +73,19 @@ return {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:meeting:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:meeting:delete\")"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "Meeting",
|
"type": "Meeting",
|
||||||
@@ -79,6 +93,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "91ba43abb559bed5acdda60b8f61bda9";
|
(node as any).hash = "22a8c7132716408a17d39ea5ff36a38d";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ export const meetingsQuery = graphql`
|
|||||||
query MeetingGraphListQuery($organizationId: ID!) {
|
query MeetingGraphListQuery($organizationId: ID!) {
|
||||||
organization: node(id: $organizationId) {
|
organization: node(id: $organizationId) {
|
||||||
id
|
id
|
||||||
|
... on Organization {
|
||||||
|
canCreateMeeting: permission(action: "core:meeting:create")
|
||||||
|
}
|
||||||
...MeetingsPageListFragment
|
...MeetingsPageListFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,12 +21,11 @@ import {
|
|||||||
UpdateMeetingMinutesDialog,
|
UpdateMeetingMinutesDialog,
|
||||||
type UpdateMeetingMinutesDialogRef,
|
type UpdateMeetingMinutesDialogRef,
|
||||||
} from "./dialogs/UpdateMeetingMinutesDialog";
|
} from "./dialogs/UpdateMeetingMinutesDialog";
|
||||||
import { useRef, useState, useEffect, use } from "react";
|
import { useRef } from "react";
|
||||||
import {
|
import {
|
||||||
meetingNodeQuery,
|
meetingNodeQuery,
|
||||||
useDeleteMeetingMutation,
|
useDeleteMeetingMutation,
|
||||||
} from "/hooks/graph/MeetingGraph";
|
} from "/hooks/graph/MeetingGraph";
|
||||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
|
||||||
|
|
||||||
const meetingFragment = graphql`
|
const meetingFragment = graphql`
|
||||||
fragment MeetingDetailPageMeetingFragment on Meeting {
|
fragment MeetingDetailPageMeetingFragment on Meeting {
|
||||||
@@ -34,6 +33,8 @@ const meetingFragment = graphql`
|
|||||||
name
|
name
|
||||||
date
|
date
|
||||||
minutes
|
minutes
|
||||||
|
canUpdate: permission(action: "core:meeting:update")
|
||||||
|
canDelete: permission(action: "core:meeting:delete")
|
||||||
attendees {
|
attendees {
|
||||||
id
|
id
|
||||||
fullName
|
fullName
|
||||||
@@ -54,70 +55,14 @@ export default function MeetingDetailPage(props: Props) {
|
|||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { isAuthorized } = use(PermissionsContext);
|
|
||||||
|
|
||||||
const [deleteMeeting, isDeleting] = useDeleteMeetingMutation();
|
const [deleteMeeting, isDeleting] = useDeleteMeetingMutation();
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
const updateMinutesDialogRef = useRef<UpdateMeetingMinutesDialogRef>(null);
|
const updateMinutesDialogRef = useRef<UpdateMeetingMinutesDialogRef>(null);
|
||||||
|
|
||||||
const [canUpdate, setCanUpdate] = useState<boolean>(false);
|
|
||||||
const [canDelete, setCanDelete] = useState<boolean>(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!organizationId) {
|
|
||||||
setCanUpdate(false);
|
|
||||||
setCanDelete(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const updateAuth = isAuthorized("Meeting", "updateMeeting");
|
|
||||||
setCanUpdate(updateAuth);
|
|
||||||
} catch (promise) {
|
|
||||||
if (promise instanceof Promise) {
|
|
||||||
promise
|
|
||||||
.then(() => {
|
|
||||||
try {
|
|
||||||
const updateAuth = isAuthorized("Meeting", "updateMeeting");
|
|
||||||
setCanUpdate(updateAuth);
|
|
||||||
} catch {
|
|
||||||
setCanUpdate(false);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
setCanUpdate(false);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setCanUpdate(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const deleteAuth = isAuthorized("Meeting", "deleteMeeting");
|
|
||||||
setCanDelete(deleteAuth);
|
|
||||||
} catch (promise) {
|
|
||||||
if (promise instanceof Promise) {
|
|
||||||
promise
|
|
||||||
.then(() => {
|
|
||||||
try {
|
|
||||||
const deleteAuth = isAuthorized("Meeting", "deleteMeeting");
|
|
||||||
setCanDelete(deleteAuth);
|
|
||||||
} catch {
|
|
||||||
setCanDelete(false);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
setCanDelete(false);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setCanDelete(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [organizationId, isAuthorized]);
|
|
||||||
|
|
||||||
usePageTitle(meeting.name);
|
usePageTitle(meeting.name);
|
||||||
|
|
||||||
const hasAnyAction = canUpdate || canDelete;
|
const hasAnyAction = meeting.canUpdate || meeting.canDelete;
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
confirm(
|
confirm(
|
||||||
@@ -162,7 +107,7 @@ export default function MeetingDetailPage(props: Props) {
|
|||||||
/>
|
/>
|
||||||
{hasAnyAction && (
|
{hasAnyAction && (
|
||||||
<ActionDropdown variant="secondary">
|
<ActionDropdown variant="secondary">
|
||||||
{canUpdate && (
|
{meeting.canUpdate && (
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
onClick={() => updateMinutesDialogRef.current?.open()}
|
onClick={() => updateMinutesDialogRef.current?.open()}
|
||||||
icon={IconPencil}
|
icon={IconPencil}
|
||||||
@@ -170,7 +115,7 @@ export default function MeetingDetailPage(props: Props) {
|
|||||||
{__("Edit minutes")}
|
{__("Edit minutes")}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
)}
|
)}
|
||||||
{canDelete && (
|
{meeting.canDelete && (
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
variant="danger"
|
variant="danger"
|
||||||
icon={IconTrashCan}
|
icon={IconTrashCan}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import { Link } from "react-router";
|
|||||||
import { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||||
import type { MeetingsPage_UpdateSummaryMutation } from "/__generated__/core/MeetingsPage_UpdateSummaryMutation.graphql";
|
import type { MeetingsPage_UpdateSummaryMutation } from "/__generated__/core/MeetingsPage_UpdateSummaryMutation.graphql";
|
||||||
import { use } from "react";
|
|
||||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
|
||||||
|
|
||||||
const meetingsFragment = graphql`
|
const meetingsFragment = graphql`
|
||||||
fragment MeetingsPageListFragment on Organization
|
fragment MeetingsPageListFragment on Organization
|
||||||
@@ -86,7 +84,6 @@ type Props = {
|
|||||||
|
|
||||||
export default function MeetingsPage(props: Props) {
|
export default function MeetingsPage(props: Props) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const { isAuthorized } = use(PermissionsContext);
|
|
||||||
const organization = usePreloadedQuery(
|
const organization = usePreloadedQuery(
|
||||||
meetingsQuery,
|
meetingsQuery,
|
||||||
props.queryRef,
|
props.queryRef,
|
||||||
@@ -219,7 +216,7 @@ export default function MeetingsPage(props: Props) {
|
|||||||
<h3 className="text-sm font-semibold text-txt-secondary">
|
<h3 className="text-sm font-semibold text-txt-secondary">
|
||||||
{__("Summary")}
|
{__("Summary")}
|
||||||
</h3>
|
</h3>
|
||||||
{isAuthorized("Meeting", "updateMeeting") && (
|
{organization.canCreateMeeting && (
|
||||||
<Button
|
<Button
|
||||||
variant="quaternary"
|
variant="quaternary"
|
||||||
icon={IconPencil}
|
icon={IconPencil}
|
||||||
@@ -249,7 +246,7 @@ export default function MeetingsPage(props: Props) {
|
|||||||
"Track and manage your organization's meetings and their minutes.",
|
"Track and manage your organization's meetings and their minutes.",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isAuthorized("Organization", "createMeeting") && (
|
{organization.canCreateMeeting && (
|
||||||
<CreateMeetingDialog connectionId={connectionId}>
|
<CreateMeetingDialog connectionId={connectionId}>
|
||||||
<Button icon={IconPlusLarge}>{__("Add meeting")}</Button>
|
<Button icon={IconPlusLarge}>{__("Add meeting")}</Button>
|
||||||
</CreateMeetingDialog>
|
</CreateMeetingDialog>
|
||||||
@@ -304,6 +301,7 @@ const rowFragment = graphql`
|
|||||||
id
|
id
|
||||||
fullName
|
fullName
|
||||||
}
|
}
|
||||||
|
canDelete: permission(action: "core:meeting:delete")
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -321,7 +319,6 @@ function MeetingRow({
|
|||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const [deleteMeeting] = useDeleteMeetingMutation();
|
const [deleteMeeting] = useDeleteMeetingMutation();
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
const { isAuthorized } = use(PermissionsContext);
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
confirm(
|
confirm(
|
||||||
() =>
|
() =>
|
||||||
@@ -371,7 +368,7 @@ function MeetingRow({
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Td>
|
</Td>
|
||||||
{isAuthorized("Meeting", "deleteMeeting") && (
|
{meeting.canDelete && (
|
||||||
<Td noLink width={50} className="text-end w-18">
|
<Td noLink width={50} className="text-end w-18">
|
||||||
<ActionDropdown>
|
<ActionDropdown>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const createMeetingMutation = graphql`
|
|||||||
id
|
id
|
||||||
fullName
|
fullName
|
||||||
}
|
}
|
||||||
|
canDelete: permission(action: "core:meeting:delete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user