feat: add unstar feed

This commit is contained in:
moonrailgun 2024-08-23 00:06:47 +08:00
parent cbdb1c4a07
commit 446ddafa0a

View File

@ -78,7 +78,9 @@ export const feedIntegrationRouter = router({
const senderName = String(get(data, 'sender.login')); const senderName = String(get(data, 'sender.login'));
const senderUrl = String(get(data, 'sender.html_url')); const senderUrl = String(get(data, 'sender.html_url'));
const url = String(get(data, 'compare')); const url = String(get(data, 'compare'));
const action = String(get(data, 'action'));
if (action === 'created') {
await createFeedEvent(workspaceId, { await createFeedEvent(workspaceId, {
channelId: channelId, channelId: channelId,
eventName: eventType, eventName: eventType,
@ -90,6 +92,19 @@ export const feedIntegrationRouter = router({
important: false, important: false,
url, 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'; return 'ok';
} else if (eventType === 'issues') { } else if (eventType === 'issues') {
@ -115,8 +130,8 @@ export const feedIntegrationRouter = router({
if (eventContent) { if (eventContent) {
await createFeedEvent(workspaceId, { await createFeedEvent(workspaceId, {
channelId: channelId, channelId: channelId,
eventName: eventName, eventName,
eventContent: `${senderName} star repo [${fullName}], now is ${starCount}.`, eventContent,
tags: [], tags: [],
source: 'github', source: 'github',
senderId, senderId,