Skip to content

remove github star feature#51

Merged
AmintaCCCP merged 2 commits into
AmintaCCCP:mainfrom
milo-container:main
Mar 8, 2026
Merged

remove github star feature#51
AmintaCCCP merged 2 commits into
AmintaCCCP:mainfrom
milo-container:main

Conversation

@milo-container

@milo-container milo-container commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Unstar repositories from the UI with confirmation; removed from your list on success.
    • Bilingual alerts for success/error.
    • Unstar button is disabled while processing and shows a pulsing icon to indicate activity.
  • Bug Fixes

    • Improved handling of API responses with no content to avoid parsing errors.

@coderabbitai

coderabbitai Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 117189cf-776b-4aa4-8ebd-874959f163cd

📥 Commits

Reviewing files that changed from the base of the PR and between c5e80c1 and 84da708.

📒 Files selected for processing (2)
  • src/components/RepositoryCard.tsx
  • src/store/useAppStore.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/RepositoryCard.tsx

📝 Walkthrough

Walkthrough

Adds an unstar feature: RepositoryCard can unstar a GitHub repo via GitHubApiService and removes the repository from the app store using a new deleteRepository action.

Changes

Cohort / File(s) Summary
UI Component
src/components/RepositoryCard.tsx
Adds unstarring state, handleUnstar (token check, bilingual confirmation, calls GitHubApiService.unstarRepository, calls deleteRepository), and an Unstar button with pulsing icon while active.
GitHub API Service
src/services/githubApi.ts
Adds unstarRepository(owner, repo): Promise<void> which DELETEs /user/starred/{owner}/{repo}. Adjusts response handling to treat HTTP 204 as null (avoid JSON.parse on no-content).
Application Store
src/store/useAppStore.ts
Adds deleteRepository(repoId: number) action to remove a repository from repositories, searchResults, and prune related release data and subscriptions.

Sequence Diagram

sequenceDiagram
    actor User
    participant RC as RepositoryCard
    participant API as GitHubApiService
    participant Store as useAppStore

    User->>RC: Click "Unstar"
    RC->>RC: Show confirmation prompt
    User->>RC: Confirm
    RC->>API: unstarRepository(owner, repo)
    API->>API: DELETE /user/starred/{owner}/{repo}
    API-->>RC: Success (204)
    RC->>Store: deleteRepository(repoId)
    Store->>Store: Remove repo, prune releases/subscriptions
    Store-->>RC: Acknowledge
    RC->>User: Update UI (remove card / success alert)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nudged a star and set it free,
Clicked confirm beneath a moonlit key,
The API hummed a soft delete,
The store hopped on and cleared the seat.
Hooray — one less star, one lighter tree! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'remove github star feature' is vague and misleading—the PR actually adds an unstar feature to RepositoryCard, not removes it. Revise the title to accurately describe the addition, such as 'Add unstar capability to RepositoryCard' or 'Implement unstar functionality with confirmation and cleanup'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/RepositoryCard.tsx`:
- Around line 317-319: The hardcoded English alert in the missing-token branch
(the if (!githubToken) { alert(...) } in RepositoryCard.tsx) should be replaced
with a localized message; update the code that shows the alert to use the
project's i18n API (e.g., useTranslation/t or intl.formatMessage) and a proper
message key like "errors.githubTokenMissing" so the new unstar flow shows a
translated string for users (replace the literal alert text with a call to the
translation function and pass the translated text to alert).

In `@src/store/useAppStore.ts`:
- Line 17: The deleteRepository implementation currently only removes the repo
from repositories and searchResults but leaves any matching releaseSubscriptions
and cached releases, causing stale ReleaseTimeline rendering; update the
deleteRepository method (and the similar handler around the other occurrence) to
also remove entries keyed by repoId from releaseSubscriptions and releases
(e.g., delete releaseSubscriptions[repoId] and delete releases[repoId] or use
the store's remove methods) so the store no longer retains subscriptions or
cached release lists for the deleted repo.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 300f2dc3-87ab-4408-af85-696ee0c61711

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0465f and c5e80c1.

⛔ Files ignored due to path filters (1)
  • dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/components/RepositoryCard.tsx
  • src/services/githubApi.ts
  • src/store/useAppStore.ts

Comment thread src/components/RepositoryCard.tsx
Comment thread src/store/useAppStore.ts
@AmintaCCCP

Copy link
Copy Markdown
Owner

审计完毕,我按 review 点做了修复并已 push 到这个 PR 分支(milo-container/main)。\n\n### ✅ 已修复\n1. deleteRepository 状态清理不完整\n - 现在删除仓库时会同时清理:\n - 中对应 \n - 中属于该仓库的 release\n - 中已不再存在的 release id\n - 避免仓库删除后 release 视图残留脏数据。\n\n2. Unstar 缺 token 提示文案未本地化\n - 将硬编码英文提示替换为中英双语分支:\n - 中文:\n - 英文:\n\n### ℹ️ 额外说明\n- 的 API 响应处理(DELETE unstar)这部分实现是正确的,已保持不变。\n- PR 标题建议从 调整为更准确的 (非阻塞)。\n\n如果你愿意,我也可以顺手把 PR 标题一起改了。

@AmintaCCCP

Copy link
Copy Markdown
Owner

审计完毕,我按 review 点做了修复并已 push 到这个 PR 分支(milo-container/main)。

✅ 已修复

  1. deleteRepository 状态清理不完整

    • 现在删除仓库时会同时清理:
      • releaseSubscriptions 中对应 repoId
      • releases 中属于该仓库的 release
      • readReleases 中已不再存在的 release id
    • 避免仓库删除后 release 视图残留脏数据。
  2. Unstar 缺 token 提示文案未本地化

    • 将硬编码英文提示替换为中英双语分支:
      • 中文:未找到 GitHub Token,请重新登录。
      • 英文:GitHub token not found. Please login again.

ℹ️ 额外说明

  • 204 No Content 的 API 响应处理(DELETE unstar)这部分实现是正确的,已保持不变。
  • PR 标题建议从 remove github star feature 调整为更准确的 feat: add unstar repository action(非阻塞)。

如果你愿意,我也可以顺手把 PR 标题一起改了。

@AmintaCCCP AmintaCCCP merged commit 7725b58 into AmintaCCCP:main Mar 8, 2026
5 checks passed
noaul pushed a commit to noaul/GithubStars that referenced this pull request May 21, 2026
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