Skip to content

Commit

Permalink
feat: add unstar feed
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Aug 22, 2024
1 parent cbdb1c4 commit 446ddaf
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions src/server/trpc/routers/feed/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,33 @@ export const feedIntegrationRouter = router({
const senderName = String(get(data, 'sender.login'));
const senderUrl = String(get(data, 'sender.html_url'));
const url = String(get(data, 'compare'));
const action = String(get(data, 'action'));

await createFeedEvent(workspaceId, {
channelId: channelId,
eventName: eventType,
eventContent: `[${senderName}](${senderUrl}) star repo [${fullName}](${repoUrl}), now is ${starCount}.`,
tags: [],
source: 'github',
senderId,
senderName,
important: false,
url,
});
if (action === 'created') {
await createFeedEvent(workspaceId, {
channelId: channelId,
eventName: eventType,
eventContent: `[${senderName}](${senderUrl}) star repo [${fullName}](${repoUrl}), now is ${starCount}.`,
tags: [],
source: 'github',
senderId,
senderName,
important: false,
url,
});
} else if (action === 'deleted') {
await createFeedEvent(workspaceId, {
channelId: channelId,
eventName: eventType,
eventContent: `[${senderName}](${senderUrl}) unstar repo [${fullName}](${repoUrl}), now is ${starCount}.`,
tags: [],
source: 'github',
senderId,
senderName,
important: false,
url,
});
}

return 'ok';
} else if (eventType === 'issues') {
Expand All @@ -115,8 +130,8 @@ export const feedIntegrationRouter = router({
if (eventContent) {
await createFeedEvent(workspaceId, {
channelId: channelId,
eventName: eventName,
eventContent: `${senderName} star repo [${fullName}], now is ${starCount}.`,
eventName,
eventContent,
tags: [],
source: 'github',
senderId,
Expand Down

0 comments on commit 446ddaf

Please sign in to comment.