Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(site): ensure notification settings page follows RBAC correctly#19097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedJul 30, 2025
edited
Loading

Ensure template admin and user admins are able to see the correct notification groups on the notification settings page.

Template admins have been unable to change their notificationpreferences via the website as we have historically hidden the settingsfor them. This PR ensures the frontend shows template events settingswhen a user has the `createTemplates` permission.
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR enables template administrators to access and modify their notification preferences for template events through the frontend. Previously, these settings were hidden from users without full deployment configuration access.

  • Updated notification filtering logic to show "Template Events" group to users withcreateTemplates permission
  • Added mock template event notification templates for testing
  • Created a new story for template creators in the notifications page

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
site/src/testHelpers/entities.tsAdded mock template event notification templates for testing scenarios
site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsxModified permission logic to display template events for users with createTemplates permission
site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsxAdded TemplateCreator story to test the new permission scenario

"Workspace Events":groups["Workspace Events"],
};

letdisplayedGroups:Record<string,NotificationTemplate[]>={
Copy link
Preview

CopilotAIJul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[nitpick] The variabledisplayedGroups is initialized with only 'Workspace Events' and then potentially reassigned completely. Consider initializing it with the base case and then conditionally adding to it to make the logic clearer.

Copilot uses AI. Check for mistakes.

Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would like to suggest a different approach:

#19115

Looking at the backend, it seems like user admins also have this exact same issue: by hiding the notifications based on theviewDeploymentConfig we're making it impossible for user admins to disable notifications they are opted into by default. That was always the wrong permission to check here, for both cases. For template notifications it's better to checkcreateTemplates like you've done here, but we should fix users too by checkingcreateUser.

I also don't think that aselect is actually the right place to filter this, because the object wrangling we're doing is very awkward. I think it's easier to just check if a group should be rendered or not by returning early in themap later on. We can just have a little utility function that picks the right permission based on the group name, and if the permission isfalse then wereturn null.

I ended up just doing exactly all of that while looking at the code and pushed it to a branch of my own. If you want to bring that code into this branch you can just go click merge on that PR. I set this PR as the target.

Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

cool, this is much better now 😄 thanks!

@DanielleMaywoodDanielleMaywood changed the titlefix(site): allow template admins to see template notification settingsfix(site): ensure notification settings page follows RBAC correctlyJul 31, 2025
@DanielleMaywoodDanielleMaywood merged commita185d3a intomainJul 31, 2025
29 of 31 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle/template-admin-see-template-events branchJuly 31, 2025 20:20
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 31, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@aslilacaslilacaslilac approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@DanielleMaywood@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp