Skip to content

Commit e01711e

Browse files
committed
Add new notification topics to transcripts
1 parent 9902fd1 commit e01711e

File tree

8 files changed

+575
-8
lines changed

8 files changed

+575
-8
lines changed

src/Share/Notifications/Queries.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ import Share.Postgres.Contributions.Queries qualified as ContributionQ
3636
import Share.Postgres.Tickets.Queries qualified as TicketQ
3737
import Share.Postgres.Users.Queries qualified as UsersQ
3838
import Share.Prelude
39-
import Share.Utils.API (Cursor (..), CursorDirection (..))
4039
import Share.Ticket
40+
import Share.Utils.API (Cursor (..), CursorDirection (..))
4141
import Share.Web.Share.DisplayInfo.Queries qualified as DisplayInfoQ
4242
import Share.Web.Share.DisplayInfo.Types (UnifiedDisplayInfo)
4343

@@ -459,8 +459,8 @@ hydrateEventPayload = \case
459459
[sql|
460460
SELECT cc.comment_id, cc.content, cc.created_at, cc.updated_at
461461
FROM comment_content cc
462-
JOIN users author ON c.author_user_id = author.id
463-
WHERE c.id = #{commentId}
462+
JOIN users author ON cc.author_id = author.id
463+
WHERE cc.comment_id = #{commentId}
464464
|]
465465
)
466466
<*> (UsersQ.userDisplayInfoOf id commentAuthorUserId)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"body": {
3+
"actor": {
4+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
5+
"handle": "transcripts",
6+
"name": "Transcript User",
7+
"userId": "U-<UUID>"
8+
},
9+
"content": "This is a new comment",
10+
"editedAt": null,
11+
"id": "CMT-<UUID>",
12+
"kind": "comment",
13+
"revision": 0,
14+
"timestamp": "<TIMESTAMP>"
15+
},
16+
"status": [
17+
{
18+
"status_code": 200
19+
}
20+
]
21+
}
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
{
2+
"body": {
3+
"items": [
4+
{
5+
"createdAt": "<TIMESTAMP>",
6+
"event": {
7+
"actor": {
8+
"info": {
9+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
10+
"handle": "transcripts",
11+
"name": "Transcript User",
12+
"userId": "U-<UUID>"
13+
},
14+
"kind": "user"
15+
},
16+
"data": {
17+
"kind": "project:ticket:comment",
18+
"link": "http://<HOST>:1234/@test/publictestproject/tickets/1",
19+
"payload": {
20+
"author": {
21+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
22+
"handle": "transcripts",
23+
"name": "Transcript User",
24+
"userId": "U-<UUID>"
25+
},
26+
"commentId": "CMT-<UUID>",
27+
"content": "This is a new comment on the ticket",
28+
"createdAt": "<TIMESTAMP>",
29+
"project": {
30+
"projectId": "P-<UUID>",
31+
"projectOwnerHandle": "test",
32+
"projectOwnerUserId": "U-<UUID>",
33+
"projectShortHand": "@test/publictestproject",
34+
"projectSlug": "publictestproject"
35+
},
36+
"ticket": {
37+
"author": {
38+
"avatarUrl": null,
39+
"handle": "test",
40+
"name": null,
41+
"userId": "U-<UUID>"
42+
},
43+
"createdAt": "<TIMESTAMP>",
44+
"description": "I want the code to solve all my problems but it does not. Please fix.\n\n## Things I need:\n\n* It should tie my *shoes*\n* It should make me _coffee_\n* It should do my taxes\n",
45+
"number": 1,
46+
"status": "open",
47+
"ticketId": "T-<UUID>",
48+
"title": "Bug Report"
49+
}
50+
}
51+
},
52+
"id": "EVENT-<UUID>",
53+
"occurredAt": "<TIMESTAMP>",
54+
"scope": {
55+
"info": {
56+
"avatarUrl": null,
57+
"handle": "test",
58+
"name": null,
59+
"userId": "U-<UUID>"
60+
},
61+
"kind": "user"
62+
}
63+
},
64+
"id": "NOT-<UUID>",
65+
"status": "unread"
66+
},
67+
{
68+
"createdAt": "<TIMESTAMP>",
69+
"event": {
70+
"actor": {
71+
"info": {
72+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
73+
"handle": "transcripts",
74+
"name": "Transcript User",
75+
"userId": "U-<UUID>"
76+
},
77+
"kind": "user"
78+
},
79+
"data": {
80+
"kind": "project:ticket:created",
81+
"link": "http://<HOST>:1234/@test/publictestproject/tickets/3",
82+
"payload": {
83+
"project": {
84+
"projectId": "P-<UUID>",
85+
"projectOwnerHandle": "test",
86+
"projectOwnerUserId": "U-<UUID>",
87+
"projectShortHand": "@test/publictestproject",
88+
"projectSlug": "publictestproject"
89+
},
90+
"ticket": {
91+
"author": {
92+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
93+
"handle": "transcripts",
94+
"name": "Transcript User",
95+
"userId": "U-<UUID>"
96+
},
97+
"createdAt": "<TIMESTAMP>",
98+
"description": "My description",
99+
"number": 3,
100+
"status": "open",
101+
"ticketId": "T-<UUID>",
102+
"title": "My Ticket"
103+
}
104+
}
105+
},
106+
"id": "EVENT-<UUID>",
107+
"occurredAt": "<TIMESTAMP>",
108+
"scope": {
109+
"info": {
110+
"avatarUrl": null,
111+
"handle": "test",
112+
"name": null,
113+
"userId": "U-<UUID>"
114+
},
115+
"kind": "user"
116+
}
117+
},
118+
"id": "NOT-<UUID>",
119+
"status": "unread"
120+
},
121+
{
122+
"createdAt": "<TIMESTAMP>",
123+
"event": {
124+
"actor": {
125+
"info": {
126+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
127+
"handle": "transcripts",
128+
"name": "Transcript User",
129+
"userId": "U-<UUID>"
130+
},
131+
"kind": "user"
132+
},
133+
"data": {
134+
"kind": "project:contribution:comment",
135+
"link": "http://<HOST>:1234/@test/publictestproject/contributions/1",
136+
"payload": {
137+
"author": {
138+
"avatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y&d=retro",
139+
"handle": "transcripts",
140+
"name": "Transcript User",
141+
"userId": "U-<UUID>"
142+
},
143+
"commentId": "CMT-<UUID>",
144+
"content": "This is a new comment",
145+
"contribution": {
146+
"author": {
147+
"avatarUrl": null,
148+
"handle": "test",
149+
"name": null,
150+
"userId": "U-<UUID>"
151+
},
152+
"contributionId": "C-<UUID>",
153+
"description": "This contribution addresses an issue where users were unable to log in due to a validation error in the authentication process.\n\n## Changes made:\n\n* Modified the validation logic for the Auth type to properly authenticate users.\n* Added unit tests to ensure the authentication process works as expected.\n\n## Testing:\n\nI tested this change locally on my development environment and confirmed that users can now log in without any issues. All unit tests are passing.",
154+
"number": 1,
155+
"sourceBranch": {
156+
"branchContributorHandle": null,
157+
"branchContributorUserId": null,
158+
"branchId": "B-<UUID>",
159+
"branchName": "main",
160+
"branchShortHand": "main",
161+
"projectBranchShortHand": "@test/publictestproject/main"
162+
},
163+
"status": "in_review",
164+
"targetBranch": {
165+
"branchContributorHandle": "transcripts",
166+
"branchContributorUserId": "U-<UUID>",
167+
"branchId": "B-<UUID>",
168+
"branchName": "contribution",
169+
"branchShortHand": "@transcripts/contribution",
170+
"projectBranchShortHand": "@test/publictestproject/@transcripts/contribution"
171+
},
172+
"title": "Fix issue with user authentication"
173+
},
174+
"createdAt": "<TIMESTAMP>",
175+
"project": {
176+
"projectId": "P-<UUID>",
177+
"projectOwnerHandle": "test",
178+
"projectOwnerUserId": "U-<UUID>",
179+
"projectShortHand": "@test/publictestproject",
180+
"projectSlug": "publictestproject"
181+
}
182+
}
183+
},
184+
"id": "EVENT-<UUID>",
185+
"occurredAt": "<TIMESTAMP>",
186+
"scope": {
187+
"info": {
188+
"avatarUrl": null,
189+
"handle": "test",
190+
"name": null,
191+
"userId": "U-<UUID>"
192+
},
193+
"kind": "user"
194+
}
195+
},
196+
"id": "NOT-<UUID>",
197+
"status": "unread"
198+
},
199+
{
200+
"createdAt": "<TIMESTAMP>",
201+
"event": {
202+
"actor": {
203+
"info": {
204+
"avatarUrl": null,
205+
"handle": "test",
206+
"name": null,
207+
"userId": "U-<UUID>"
208+
},
209+
"kind": "user"
210+
},
211+
"data": {
212+
"kind": "project:contribution:created",
213+
"link": "http://<HOST>:1234/@test/publictestproject/contributions/3",
214+
"payload": {
215+
"contribution": {
216+
"author": {
217+
"avatarUrl": null,
218+
"handle": "test",
219+
"name": null,
220+
"userId": "U-<UUID>"
221+
},
222+
"contributionId": "C-<UUID>",
223+
"description": "My description",
224+
"number": 3,
225+
"sourceBranch": {
226+
"branchContributorHandle": null,
227+
"branchContributorUserId": null,
228+
"branchId": "B-<UUID>",
229+
"branchName": "main",
230+
"branchShortHand": "main",
231+
"projectBranchShortHand": "@test/publictestproject/main"
232+
},
233+
"status": "draft",
234+
"targetBranch": {
235+
"branchContributorHandle": null,
236+
"branchContributorUserId": null,
237+
"branchId": "B-<UUID>",
238+
"branchName": "feature",
239+
"branchShortHand": "feature",
240+
"projectBranchShortHand": "@test/publictestproject/feature"
241+
},
242+
"title": "My contribution"
243+
},
244+
"project": {
245+
"projectId": "P-<UUID>",
246+
"projectOwnerHandle": "test",
247+
"projectOwnerUserId": "U-<UUID>",
248+
"projectShortHand": "@test/publictestproject",
249+
"projectSlug": "publictestproject"
250+
}
251+
}
252+
},
253+
"id": "EVENT-<UUID>",
254+
"occurredAt": "<TIMESTAMP>",
255+
"scope": {
256+
"info": {
257+
"avatarUrl": null,
258+
"handle": "test",
259+
"name": null,
260+
"userId": "U-<UUID>"
261+
},
262+
"kind": "user"
263+
}
264+
},
265+
"id": "NOT-<UUID>",
266+
"status": "unread"
267+
}
268+
],
269+
"nextCursor": "<CURSOR>",
270+
"prevCursor": "<CURSOR>"
271+
},
272+
"status": [
273+
{
274+
"status_code": 200
275+
}
276+
]
277+
}

0 commit comments

Comments
 (0)