alpha
Login
or
Join now
gwen.works
/
churros-notella
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
fix: remove code related to comments
author
Gwen Le Bihan
date
1 year ago
(Feb 3, 2025, 9:30 PM +0100)
commit
c10e36d1
c10e36d15bb04b3484aa5a66b4c97268498318cf
parent
0d832255
0d832255bb784b6d23355313b9cae9bc8b107d36
-60
3 changed files
Expand all
Collapse all
Unified
Split
churros.go
events.go
users.go
-2
churros.go
Reviewed
···
108
108
return db.NotificationChannelArticles
109
109
case EventShotgunClosesSoon, EventShotgunOpensSoon:
110
110
return db.NotificationChannelShotguns
111
111
-
case EventCommentReply, EventNewComment:
112
112
-
return db.NotificationChannelComments
113
111
case EventGodchildRequest, EventGodchildAccepted, EventGodchildRejected:
114
112
return db.NotificationChannelGodparentRequests
115
113
}
-2
events.go
Reviewed
···
17
17
EventClearSchedule Event = "clear_schedule"
18
18
EventNewPost Event = "new_post"
19
19
EventGodchildRequest Event = "godchild_request"
20
20
-
EventNewComment Event = "new_comment"
21
21
-
EventCommentReply Event = "comment_reply"
22
20
EventCustom Event = "custom"
23
21
EventTest Event = "test"
24
22
EventGodchildAccepted Event = "godchild_accepted"
-56
users.go
Reviewed
···
34
34
switch message.Event {
35
35
case EventNewPost:
36
36
return receiversForPost(message)
37
37
-
case EventNewComment:
38
38
-
return receiversForNewComment(message)
39
37
case EventBookingPaid:
40
38
return receiversForBookingPaid(message)
41
41
-
case EventCommentReply:
42
42
-
return receiversForCommentReply(message)
43
39
case EventContributionPaid:
44
40
return receiversForContributionPaid(message)
45
41
case EventGodchildAccepted, EventGodchildRejected:
···
110
106
return userIds, fmt.Errorf("unknown post visibility %q", post.Visibility)
111
107
}
112
108
113
113
-
func receiversForNewComment(message Message) (userIds []string, err error) {
114
114
-
comment, err := prisma.Comment.FindUnique(
115
115
-
db.Comment.ID.Equals(message.ChurrosObjectId),
116
116
-
).With(
117
117
-
db.Comment.Article.Fetch(),
118
118
-
).Exec(context.Background())
119
119
-
if err != nil {
120
120
-
err = fmt.Errorf("while getting comment: %w", err)
121
121
-
return
122
122
-
}
123
123
-
124
124
-
post, ok := comment.Article()
125
125
-
if !ok {
126
126
-
err = fmt.Errorf("comment %q has no parent post", comment.ID)
127
127
-
return
128
128
-
}
129
129
-
130
130
-
authorId, ok := post.AuthorID()
131
131
-
if !ok {
132
132
-
err = fmt.Errorf("post %q has no author", post.ID)
133
133
-
return
134
134
-
}
135
135
-
136
136
-
return []string{authorId}, nil
137
137
-
}
138
138
-
139
109
func receiversForBookingPaid(message Message) (userIds []string, err error) {
140
110
booking, err := prisma.Registration.FindUnique(
141
111
db.Registration.ID.Equals(message.ChurrosObjectId),
···
157
127
}
158
128
159
129
return
160
160
-
}
161
161
-
162
162
-
func receiversForCommentReply(message Message) (userIds []string, err error) {
163
163
-
comment, err := prisma.Comment.FindUnique(
164
164
-
db.Comment.ID.Equals(message.ChurrosObjectId),
165
165
-
).With(
166
166
-
db.Comment.InReplyTo.Fetch(),
167
167
-
).Exec(context.Background())
168
168
-
if err != nil {
169
169
-
err = fmt.Errorf("while getting comment: %w", err)
170
170
-
return
171
171
-
}
172
172
-
173
173
-
parent, ok := comment.InReplyTo()
174
174
-
if !ok {
175
175
-
err = fmt.Errorf("comment %q has no parent", comment.ID)
176
176
-
return
177
177
-
}
178
178
-
179
179
-
authorId, ok := parent.AuthorID()
180
180
-
if !ok {
181
181
-
err = fmt.Errorf("comment %q has no author", parent.ID)
182
182
-
return
183
183
-
}
184
184
-
185
185
-
return []string{authorId}, nil
186
130
}
187
131
188
132
func receiversForContributionPaid(message Message) (userIds []string, err error) {