fix : restrict public templates list and view to importable types - #333
Open
mohammadsherif0 wants to merge 2 commits into
Open
fix : restrict public templates list and view to importable types#333mohammadsherif0 wants to merge 2 commits into
mohammadsherif0 wants to merge 2 commits into
Conversation
mohammadsherif0
requested review from
bingobongomann,
dennis-zyska and
karimouf
and removed request for
karimouf
August 9, 2026 14:14
bingobongomann
requested changes
Aug 12, 2026
| const isOwner = template.userId === this.userId; | ||
| const isPublicFromOthers = template.public === true && !isOwner; | ||
| const isAdmin = await this.isAdmin(); | ||
| const isEmailType = [1, 2, 3, 6, 7].includes(template.type); |
Collaborator
There was a problem hiding this comment.
I think this is the 9th or 10th time that we have the [1,...,7], [1,2,3,6,7] and [4,5] arrays in the template code. I think we should move this into some static lists like emailTemplateTypes = [1,2,3,6,7], otherTemplateTypes = [4,5], allTemplateTypes = emailTemplateTypes + otherTemplateTypes
And then use those statics lists. otherwise we have to adjust many different locations when adding new types in the future
| * | ||
| * Fetches the template and returns its content as Quill Delta format for the given language. | ||
| * - For owners: returns stable content from template_content composed with draft edits (like documents) | ||
| * - For non-owners: returns only stable content (no drafts) |
Collaborator
There was a problem hiding this comment.
The docstring should reflect the rejection behavior for non-owners non-admins on email templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #307: non-admins could see and open public email templates in Public Templates even though they cannot import them. Listing and content view now follow the same importable-type rules as copy (types 4/5 for non-admins).
Improvements
Public Templates modal shows only importable public templates for non-admins (types 4 and 5); admins still see all public templates.
templateGetContentblocks non-owners from viewing public email templates unless they are admin.