UX: show complete URL path if website domain is same as instance domain - #5
UX: show complete URL path if website domain is same as instance domain#5ShashankFC wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Walkthrough
This PR refactors how user website names are displayed in the profile by moving the logic from frontend computed properties to backend serialization. The websiteName computed property is removed from the user controller, and template references are updated to use model.website_name instead. A new website_name attribute is added to the UserSerializer that intelligently extracts the hostname from the website URL and conditionally includes the path when the website domain matches or is a subdomain of the Discourse instance. Comprehensive test coverage verifies the domain matching logic, and a JSDoc documentation error is corrected in the User model.
Changes
| File(s) | Summary |
|---|---|
app/assets/javascripts/discourse/controllers/user.js.es6 |
Removed the websiteName computed property that previously extracted domain names from user website URLs. |
app/assets/javascripts/discourse/templates/user/user.hbs |
Refactored to use model.website_name directly instead of the websiteName computed property in three locations (conditional check and two display locations). |
app/serializers/user_serializer.rb |
Added website_name attribute that extracts hostname from website URL and conditionally includes path when domain matches or is a subdomain of the Discourse instance hostname. |
spec/serializers/user_serializer_spec.rb |
Added test coverage for website_name field with three test cases verifying hostname-only display, full path display for matching domains, and subdomain handling. Updated test URL to include path. |
app/assets/javascripts/discourse/models/user.js.es6 |
Fixed JSDoc documentation error: corrected @property tag from websiteName to profileBackground. |
Sequence Diagram
This diagram shows the interactions between components:
sequenceDiagram
participant Component as Ember Component
participant Model as Model Object
Note over Component: websiteName property (REMOVED)
Component->>Model: get('model.website')
Model-->>Component: website URL string
alt website is empty
Component->>Component: return undefined
else website has value
Component->>Component: split("/")[2]
Note over Component: Extract domain from URL<br/>(e.g., "http://example.com/path"<br/>→ "example.com")
Component->>Component: return domain name
end
Note over Component: This computed property has been<br/>removed in this PR
🔗 Cross-Repository Impact Analysis
Enable automatic detection of breaking changes across your dependent repositories. → Set up now
Learn more about Cross-Repository Analysis
What It Does
- Automatically identifies repositories that depend on this code
- Analyzes potential breaking changes across your entire codebase
- Provides risk assessment before merging to prevent cross-repo issues
How to Enable
- Visit Settings → Code Management
- Configure repository dependencies
- Future PRs will automatically include cross-repo impact analysis!
Benefits
- 🛡️ Prevent breaking changes across repositories
- 🔍 Catch integration issues before they reach production
- 📊 Better visibility into your multi-repo architecture
Install the extension
Note for Windsurf
Please change the default marketplace provider to the following in the windsurf settings:Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery
Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items
Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below
Emoji Descriptions:
⚠️ Potential Issue - May require further investigation.- 🔒 Security Vulnerability - Fix to ensure system safety.
- 💻 Code Improvement - Suggestions to enhance code quality.
- 🔨 Refactor Suggestion - Recommendations for restructuring code.
- ℹ️ Others - General comments and information.
Interact with the Bot:
- Send a message or request using the format:
@entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
- Help the Bot learn by providing feedback on its responses.
@entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !
Also you can trigger various commands with the bot by doing
@entelligenceai command
The current supported commands are
config- shows the current configretrigger_review- retriggers the review
More commands to be added soon.
| :bio_cooked, | ||
| :created_at, | ||
| :website, | ||
| :website_name, | ||
| :profile_background, | ||
| :card_background, | ||
| :location, |
There was a problem hiding this comment.
Correctness: Move :website_name from the attributes list to the untrusted_attributes list. Since :website_name is derived from :website, it must be subject to the same scope.restrict_user_fields?(object) check to prevent a privacy leak where untrusted users' website information is exposed while the main :website field is restricted. Additionally, the predicate include_website_name is missing the ? suffix required by the serializer to correctly gate the attribute.
Test 6
Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Replicated from ai-code-review-evaluation/discourse-coderabbit#6
EntelligenceAI PR Summary
Refactored user website name display logic from frontend computed properties to backend serialization with intelligent domain-based path inclusion.
websiteNamecomputed property from user controllermodel.website_nameinstead ofwebsiteNamewebsite_nameserializer attribute that extracts hostname and conditionally includes path for same-domain or subdomain websiteswebsiteName→profileBackground)