-
Notifications
You must be signed in to change notification settings - Fork 8.6k
DEV: Improve user handling and access in post components #34013
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Reorganized the `post-avatar` component by introducing `let` bindings to share `avatarOutletArgs` in all plugin outlets
…ents Moved user creation logic to a `user` getter in the `post` model. Updated `post-stream` and `post-avatar` components to leverage this centralized logic, enhancing maintainability and consistency.
Removed the redundant `test` class from the `post-notice-message` div to clean up the template and avoid unused styles.
Updated the `avatarTemplate` property check to `avatar_template` for consistency with user object properties.
Introduced `#transformerContext` to simplify repeated code and centralize context creation for `applyValueTransformer` calls, improving readability and maintainability.
9bce04a
to
1398914
Compare
Updated the `poster-name` component to rely on the `user` model from the `post` object, replacing direct property access. Simplified logic in templates and improved maintainability by aligning with recent user model centralization efforts.
Removed the `store` service from the `post` model as it was unused. Restored `dismissed_banner_key` as a tracked property in the `user` model
Replaced inline condition in template with a `shouldShowUserStatus` getter. Improves readability and centralizes logic for checking user status visibility.
Centralized `user` logic in reactions by aligning `post_user` with `post.user`. Updated `group_post_serializer` to expose `user_id` for consistency. Simplifies user object management across reactions and serialization.
Aligned `poster-name` component with centralized `user` handling in `post` model. Consolidated name sanitization logic and ensured consistency by using `user` object throughout templates and tests. Improves readability and maintainability.
Added a check to return `null` for cases where the `user` is missing. Updated `userWasDeleted` logic to use the `user` object instead of `user_id`. Simplifies error handling and ensures consistency with centralized `user` handling.
…rendering issues
…rendering issues
davidtaylorhq
approved these changes
Aug 6, 2025
This pull request has been mentioned on Discourse Meta. There might be relevant details there: https://meta.discourse.org/t/trust-level-avatar-flair/82656/122 |
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.
This pull request improves how user properties are managed and accessed in post-related components and models. Notable improvements include:
Post
model now provides a cacheduser
property, ensuring a consistent and up-to-date user object using relevant post fields, instead of relying onuser
being set directly or via thePostStream
.PostAvatar
andPostMetaDataPosterName
now consistently reference theuser
property, improving reliability and reducing the risk of missing or inconsistent user data.GroupPostSerializer
now includes theuser_id
attribute, improving API consistency.discourse-reactions
plugin was updated to align with the new user property logic, ensuring reaction-related user data is accessed consistently.Overall, these changes improve data integrity, reduce the risk of rendering errors due to user data inconsistencies, and streamline how user information is passed through Discourse post-related features.