[WEB-2543] chore: workspace inbox guest permission (#5695)

* chore: workspace inbox permission updated

* chore: workspace inbox permission updated

* chore: code refactor

* chore: code refactor
This commit is contained in:
Anmol Singh Bhatia 2024-09-25 17:17:42 +05:30 committed by GitHub
parent 85f7483b1b
commit 22623fad33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 9 deletions

View file

@ -41,7 +41,7 @@ class NotificationViewSet(BaseViewSet, BasePaginator):
) )
@allow_permission( @allow_permission(
allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], allowed_roles=[ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST],
level="WORKSPACE", level="WORKSPACE",
) )
def list(self, request, slug): def list(self, request, slug):
@ -207,7 +207,7 @@ class NotificationViewSet(BaseViewSet, BasePaginator):
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)
@allow_permission( @allow_permission(
allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], level="WORKSPACE" allowed_roles=[ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST], level="WORKSPACE"
) )
def mark_unread(self, request, slug, pk): def mark_unread(self, request, slug, pk):
notification = Notification.objects.get( notification = Notification.objects.get(
@ -219,7 +219,7 @@ class NotificationViewSet(BaseViewSet, BasePaginator):
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)
@allow_permission( @allow_permission(
allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], level="WORKSPACE" allowed_roles=[ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST], level="WORKSPACE"
) )
def archive(self, request, slug, pk): def archive(self, request, slug, pk):
notification = Notification.objects.get( notification = Notification.objects.get(
@ -231,7 +231,7 @@ class NotificationViewSet(BaseViewSet, BasePaginator):
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)
@allow_permission( @allow_permission(
allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], level="WORKSPACE" allowed_roles=[ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST], level="WORKSPACE"
) )
def unarchive(self, request, slug, pk): def unarchive(self, request, slug, pk):
notification = Notification.objects.get( notification = Notification.objects.get(
@ -286,7 +286,7 @@ class UnreadNotificationEndpoint(BaseAPIView):
class MarkAllReadNotificationViewSet(BaseViewSet): class MarkAllReadNotificationViewSet(BaseViewSet):
@allow_permission( @allow_permission(
allowed_roles=[ROLE.ADMIN, ROLE.MEMBER], level="WORKSPACE" allowed_roles=[ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST], level="WORKSPACE"
) )
def create(self, request, slug): def create(self, request, slug):
snoozed = request.data.get("snoozed", False) snoozed = request.data.get("snoozed", False)

View file

@ -145,11 +145,12 @@ export const IssueView: FC<IIssueView> = observer((props) => {
"0px 4px 8px 0px rgba(0, 0, 0, 0.12), 0px 6px 12px 0px rgba(16, 24, 40, 0.12), 0px 1px 16px 0px rgba(16, 24, 40, 0.12)", "0px 4px 8px 0px rgba(0, 0, 0, 0.12), 0px 6px 12px 0px rgba(16, 24, 40, 0.12), 0px 1px 16px 0px rgba(16, 24, 40, 0.12)",
}} }}
> >
{isLoading && <IssuePeekOverviewLoader removeRoutePeekId={removeRoutePeekId} />} {isError ? (
{isError && (
<div className="relative h-screen w-full overflow-hidden"> <div className="relative h-screen w-full overflow-hidden">
<IssuePeekOverviewError removeRoutePeekId={removeRoutePeekId} /> <IssuePeekOverviewError removeRoutePeekId={removeRoutePeekId} />
</div> </div>
) : (
isLoading && <IssuePeekOverviewLoader removeRoutePeekId={removeRoutePeekId} />
)} )}
{!isLoading && !isError && issue && ( {!isLoading && !isError && issue && (
<> <>

View file

@ -325,7 +325,7 @@ export const SIDEBAR_USER_MENU_ITEMS: {
key: "notifications", key: "notifications",
label: "Inbox", label: "Inbox",
href: `/notifications`, href: `/notifications`,
access: [EUserPermissions.ADMIN, EUserPermissions.MEMBER], access: [EUserPermissions.ADMIN, EUserPermissions.MEMBER, EUserPermissions.GUEST],
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/notifications/`), highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/notifications/`),
Icon: Inbox, Icon: Inbox,
}, },

View file

@ -21,7 +21,7 @@ const nextConfig = {
value: "origin-when-cross-origin", value: "origin-when-cross-origin",
}, },
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" }, { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
{ key: "Cross-Origin-Embedder-Policy", value: "require-corp" }, { key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
], ],
}, },
]; ];