Skip to content

[WEB-4172] Chore: Links favicon and title#7124

Closed
JayashTripathy wants to merge 13 commits intofeat-crawl-work-item-linkfrom
chore-link-metadata
Closed

[WEB-4172] Chore: Links favicon and title#7124
JayashTripathy wants to merge 13 commits intofeat-crawl-work-item-linkfrom
chore-link-metadata

Conversation

@JayashTripathy
Copy link
Member

@JayashTripathy JayashTripathy commented May 26, 2025

Description

Added Favicon and title to the links

image

Type of Change

  • Enhancement

Summary by CodeRabbit

  • New Features
    • Issue links now automatically display webpage titles and favicons, providing richer visual context for each link.
  • Bug Fixes
    • Improved handling of missing or invalid metadata to ensure consistent display of link items.

vamsikrishnamathala and others added 8 commits May 26, 2025 14:28
* 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>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A 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

File(s) Change Summary
apiserver/plane/app/views/issue/link.py Triggers new background task to crawl link title and favicon after issue link creation/update; reloads and re-serializes updated data.
apiserver/plane/bgtasks/work_item_link_task.py New module implementing Celery task and helper functions to fetch page title and favicon, update IssueLink, and handle errors.
web/core/components/issues/issue-detail/links/link-item.tsx Updates component to display fetched favicon and page title from metadata alongside each issue link.

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
Loading

Suggested labels

🧹chore, 🌟improvement

Suggested reviewers

  • anmolsinghbhatia

Poem

A clever new trick for links on display,
Fetching favicons and titles the asynchronous way.
Now each little link wears a bright, shiny hat,
With metadata magic—imagine that!
The rabbit hops by, with a smile on its face,
For links now have style, and a touch of grace.
🐇✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented May 26, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04c7c53 and 83128c2.

📒 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 tsx

Length of output: 72


🏁 Script executed:

#!/bin/bash
# Description: Search for metadata references across frontend code
rg "metadata" --glob "*.{ts,tsx,js,jsx}" -A5 -B5

Length of output: 38567


Handle asynchronous metadata enrichment in the UI

After triggering the background task, the initial GET will return an empty metadata object—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 (where metadata: {} is sent on create/update)
  • web/core/components/issues/issue-detail/links/link-item.tsx (where metadata?.favicon and metadata?.title are rendered)

@JayashTripathy JayashTripathy marked this pull request as draft May 28, 2025 13:46
@JayashTripathy JayashTripathy changed the base branch from preview to feat-crawl-work-item-link May 28, 2025 14:07
@JayashTripathy JayashTripathy marked this pull request as ready for review May 28, 2025 14:10
@JayashTripathy JayashTripathy deleted the chore-link-metadata branch September 15, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants