Skip to content

Conversation

@ChrAlpha
Copy link
Member

@ChrAlpha ChrAlpha commented Nov 21, 2025

设置描述 称「支持完整链接或用户名。」
image

但实际上并没有做单独处理,而是直接全部视为用户名。
image

这个 PR 进行了重新处理。

Copilot AI review requested due to automatic review settings November 21, 2025 06:09
@safedep
Copy link

safedep bot commented Nov 21, 2025

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@vercel
Copy link

vercel bot commented Nov 21, 2025

@ChrAlpha is attempting to deploy a commit to the innei-dev Team on Vercel.

A member of the Team first needs to authorize it.

Copilot finished reviewing on behalf of ChrAlpha November 21, 2025 06:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors social media URL handling to properly support both full URLs and usernames, as described in the configuration. Previously, all input was treated as usernames and directly concatenated with base URLs. The refactoring introduces a resolveSocialUrl helper function that detects full URLs (starting with http:// or https://) and returns them as-is, while constructing URLs from usernames when needed.

Key changes:

  • Added resolveSocialUrl utility function to handle URL detection and username-to-URL conversion
  • Pre-computed githubUrl and twitterUrl at component level rather than inline in JSX
  • Removed inline string concatenation logic from the render method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +28
if (!normalized) {
return undefined
}
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

The check if (!normalized) on line 26 is redundant and will never be true. The replace(/^@/, '') operation only removes a leading @ character, so if trimmed is non-empty (already checked on line 17), normalized cannot be an empty string. Consider removing lines 26-28.

Suggested change
if (!normalized) {
return undefined
}

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

ur wrong.

When trimmed is '@@' or sth like that, normalized'd be empty string.

Comment on lines +11 to +14
function resolveSocialUrl(
value: string,
{ baseUrl, stripAt }: { baseUrl: string; stripAt?: boolean },
): string | undefined {
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

The resolveSocialUrl function lacks documentation. Add a JSDoc comment explaining its purpose, parameters, and return value. This will help future maintainers understand the URL resolution logic, especially the difference between full URLs and usernames.

Copilot uses AI. Check for mistakes.

import { ActionGroup } from './ActionGroup'

function resolveSocialUrl(
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the resolveSocialUrl function to a shared utility file (e.g., ~/lib/url-utils.ts) since this URL resolution logic could be reusable across other components that handle social media links. This would improve maintainability and testability.

Copilot uses AI. Check for mistakes.
@Innei Innei merged commit 46e573c into Afilmory:main Nov 23, 2025
8 of 10 checks passed
@ChrAlpha ChrAlpha deleted the refactor/social-url-handling branch November 24, 2025 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants