[WEB-4172] Chore: Links favicon and title#7124
[WEB-4172] Chore: Links favicon and title#7124JayashTripathy wants to merge 13 commits intofeat-crawl-work-item-linkfrom
Conversation
* pytest bases tests for apiserver * Trimmed spaces * Updated .gitignore for pytest local files
Bumps the pip group with 1 update in the /apiserver/requirements directory: [requests](https://github.com/psf/requests). Updates `requests` from 2.31.0 to 2.32.2 - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](psf/requests@v2.31.0...v2.32.2) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.2 dependency-type: direct:production dependency-group: pip ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA new background task is introduced to asynchronously fetch and store webpage titles and favicons for issue links. The API now triggers this task upon link creation or update, then returns updated metadata. The frontend displays the fetched favicon and title alongside each issue link, enhancing the visual context for users. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant API
participant CeleryTask
participant Database
User->>Frontend: Create/Update Issue Link
Frontend->>API: POST/PATCH Issue Link
API->>Database: Save Issue Link
API->>CeleryTask: Trigger crawl_work_item_link_title(link_id, url)
CeleryTask->>Database: Fetch IssueLink
CeleryTask->>ExternalSite: Fetch URL (title, favicon)
CeleryTask->>Database: Update IssueLink metadata
API->>Database: Reload updated IssueLink
API->>Frontend: Return updated IssueLink (with metadata)
Frontend->>User: Display link with favicon and title
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 8
♻️ Duplicate comments (1)
apiserver/plane/app/views/issue/link.py (1)
96-97: Duplicate issue: Race condition in partial_update method.Same race condition issue exists in the partial_update method.
🧹 Nitpick comments (2)
apiserver/plane/bgtasks/work_item_link_task.py (1)
168-168: Replace print statement with proper logging.Using print statements in production code is not recommended.
+import logging + +logger = logging.getLogger(__name__) except Exception as e: - print(f"Failed to fetch favicon: {e}") + logger.warning(f"Failed to fetch favicon: {e}") return {web/core/components/issues/issue-detail/links/link-item.tsx (1)
69-69: Improve accessibility and styling for the title display.The title should have proper semantic meaning and better visual separation.
- {linkTitle && linkTitle !== "" && <span className="text-custom-text-400 text-xs">{linkTitle}</span>} + {linkTitle && linkTitle !== "" && ( + <span + className="text-custom-text-400 text-xs truncate" + title={linkTitle} + aria-label="Page title" + > + {linkTitle} + </span> + )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apiserver/plane/app/views/issue/link.py(5 hunks)apiserver/plane/bgtasks/work_item_link_task.py(1 hunks)web/core/components/issues/issue-detail/links/link-item.tsx(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (3)
web/core/components/issues/issue-detail/links/link-item.tsx (1)
41-42: LGTM: Clean metadata extraction.The metadata extraction is well-implemented with proper optional chaining and type safety.
apiserver/plane/app/views/issue/link.py (2)
18-18: LGTM: Proper import of the background task.The import statement is correctly placed and follows the existing pattern.
63-64:Details
❓ Verification inconclusive
Race condition: Reloading data immediately after async task trigger.
Since the background task will now run asynchronously, reloading the data immediately after triggering it won't include the metadata updates. The metadata will be empty initially and updated later by the background task.
This pattern suggests that the frontend should handle the case where metadata is initially empty and gets populated asynchronously. Let me verify how the frontend handles this:
🏁 Script executed:
#!/bin/bash # Description: Check how the frontend handles initially empty metadata # Search for metadata handling in the frontend rg -A 5 -B 5 "metadata" --type ts --type tsxLength of output: 72
🏁 Script executed:
#!/bin/bash # Description: Search for metadata references across frontend code rg "metadata" --glob "*.{ts,tsx,js,jsx}" -A5 -B5Length of output: 38567
Handle asynchronous metadata enrichment in the UI
After triggering the background task, the initial GET will return an empty
metadataobject—enrichment happens later. Ensure the frontend gracefully handles this by, for example, showing placeholders or re-fetching once metadata arrives.Please verify in these components:
web/core/components/modules/analytics-sidebar/root.tsx(wheremetadata: {}is sent on create/update)web/core/components/issues/issue-detail/links/link-item.tsx(wheremetadata?.faviconandmetadata?.titleare rendered)
Description
Added Favicon and title to the links
Type of Change
Summary by CodeRabbit