-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added repost count on ActivityPub API #22116
base: main
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@vershwal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 1 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughThis set of changes adds a new property, Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant FS as FeedItemStats Component
participant Mutation as Repost Mutation Handler
User->>FS: Clicks repost button
FS->>Mutation: Initiates repost mutation (if not already reposted)
Mutation-->>FS: Returns mutation result
FS->>User: Updates repost count display
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
apps/admin-x-activitypub/src/components/feed/FeedItemStats.tsx (1)
87-94
: Add error handling and unrepost functionality to the repost button click handler.The click handler has several issues:
- It only handles reposting but not unreposting.
- It doesn't prevent event bubbling.
- It lacks error handling.
Apply this diff to fix the issues:
- onClick={(e?: React.MouseEvent<HTMLElement>) => { - e?.stopPropagation(); - - if (!isReposted) { - repostMutation.mutate(object.id); - setIsReposted(true); - } - }} + onClick={async (e?: React.MouseEvent<HTMLElement>) => { + e?.stopPropagation(); + if (e) { + try { + if (!isReposted) { + await repostMutation.mutateAsync(object.id); + setIsReposted(true); + } else { + // TODO: Add unrepostMutation + // await unrepostMutation.mutateAsync(object.id); + // setIsReposted(false); + } + } catch (error) { + showToast({ + type: 'error', + title: 'Failed to update repost status', + message: error instanceof Error ? error.message : 'An error occurred' + }); + } + } + }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/admin-x-activitypub/src/components/Inbox.tsx
(1 hunks)apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx
(4 hunks)apps/admin-x-activitypub/src/components/feed/FeedItem.tsx
(6 hunks)apps/admin-x-activitypub/src/components/feed/FeedItemStats.tsx
(3 hunks)apps/admin-x-activitypub/src/components/modals/ViewProfileModal.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Browser tests
🔇 Additional comments (7)
apps/admin-x-activitypub/src/components/Inbox.tsx (1)
119-119
: LGTM!The implementation correctly handles the
repostCount
prop with a safe default value using nullish coalescing, consistent with other count props.apps/admin-x-activitypub/src/components/feed/FeedItem.tsx (1)
151-151
: LGTM!The implementation is thorough and consistent:
- Properly types the
repostCount
prop.- Provides a default value.
- Consistently passes the prop to
FeedItemStats
in all layouts.Also applies to: 160-160
apps/admin-x-activitypub/src/components/feed/ArticleModal.tsx (5)
845-846
: LGTM! Consistent handling of repostCount for parent thread items.The implementation correctly handles undefined values using the nullish coalescing operator.
865-866
: LGTM! Consistent handling of repostCount for current note.The implementation correctly handles undefined values using the nullish coalescing operator.
896-897
: LGTM! Consistent handling of repostCount in article view stats.The implementation correctly handles undefined values using the nullish coalescing operator.
932-933
: LGTM! Consistent handling of repostCount for child thread items.The implementation correctly handles undefined values using the nullish coalescing operator.
423-426
: Add implementation for onLikeClick handler.The
onLikeClick
handler is currently empty with only a comment indicating future implementation.Do you want me to help implement the like functionality?
No description provided.