tangled
alpha
login
or
join now
yoten.app
/
yoten
17
fork
atom
Yōten: A social tracker for your language learning journey built on the atproto.
17
fork
atom
overview
issues
pulls
pipelines
refactor: renames + deletion of unused code
brookjeynes.dev
5 months ago
825b488f
00a5366e
verified
This commit was signed with the committer's
known signature
.
brookjeynes.dev
SSH Key Fingerprint:
SHA256:N3n3PCBSiXfS6EHlmGdx+LMEruJMj6FS2hqaXyfsw0s=
+15
-28
4 changed files
expand all
collapse all
unified
split
internal
consumer
ingester.go
server
handlers
comment.go
oauth
handler
handler.go
views
partials
discussion.templ
+6
-6
internal/consumer/ingester.go
···
121
121
122
122
ddb, ok := i.Db.Execer.(*db.DB)
123
123
if !ok {
124
124
-
return fmt.Errorf("failed to index profile record: %w", err)
124
124
+
return fmt.Errorf("failed to index profile record: ddb not valid")
125
125
}
126
126
127
127
tx, err := ddb.Begin()
···
336
336
337
337
ddb, ok := i.Db.Execer.(*db.DB)
338
338
if !ok {
339
339
-
return fmt.Errorf("failed to index activity def record: %w", err)
339
339
+
return fmt.Errorf("failed to index activity def record: ddb not valid")
340
340
}
341
341
342
342
tx, err := ddb.Begin()
···
377
377
378
378
ddb, ok := i.Db.Execer.(*db.DB)
379
379
if !ok {
380
380
-
return fmt.Errorf("failed to index activity def record: %w", err)
380
380
+
return fmt.Errorf("failed to index activity def record: ddb not valid")
381
381
}
382
382
383
383
tx, err := ddb.Begin()
···
427
427
428
428
ddb, ok := i.Db.Execer.(*db.DB)
429
429
if !ok {
430
430
-
return fmt.Errorf("failed to index reaction record: %w", err)
430
430
+
return fmt.Errorf("failed to index reaction record: ddb not valid")
431
431
}
432
432
433
433
tx, err := ddb.Begin()
···
514
514
515
515
ddb, ok := i.Db.Execer.(*db.DB)
516
516
if !ok {
517
517
-
return fmt.Errorf("failed to index resource record: %w", err)
517
517
+
return fmt.Errorf("failed to index resource record: ddb not valid")
518
518
}
519
519
520
520
tx, err := ddb.Begin()
···
595
595
596
596
ddb, ok := i.Db.Execer.(*db.DB)
597
597
if !ok {
598
598
-
return fmt.Errorf("failed to index resource record: %w", err)
598
598
+
return fmt.Errorf("failed to index resource record: ddb not valid")
599
599
}
600
600
601
601
tx, err := ddb.Begin()
+6
-18
internal/server/handlers/comment.go
···
75
75
CreatedAt: time.Now(),
76
76
}
77
77
78
78
-
newCommentRecord := yoten.FeedComment{
79
79
-
LexiconTypeID: yoten.FeedCommentNSID,
80
80
-
Body: newComment.Body,
81
81
-
Subject: newComment.StudySessionUri.String(),
82
82
-
CreatedAt: newComment.CreatedAt.Format(time.RFC3339),
83
83
-
}
84
84
-
85
78
_, err = client.RepoPutRecord(r.Context(), &comatproto.RepoPutRecord_Input{
86
79
Collection: yoten.FeedCommentNSID,
87
80
Repo: newComment.Did,
88
81
Rkey: newComment.Rkey,
89
82
Record: &lexutil.LexiconTypeDecoder{
90
90
-
Val: &newCommentRecord,
83
83
+
Val: &yoten.FeedComment{
84
84
+
LexiconTypeID: yoten.FeedCommentNSID,
85
85
+
Body: newComment.Body,
86
86
+
Subject: newComment.StudySessionUri.String(),
87
87
+
CreatedAt: newComment.CreatedAt.Format(time.RFC3339),
88
88
+
},
91
89
},
92
90
})
93
91
if err != nil {
94
92
log.Println("failed to create comment record:", err)
95
93
htmx.HxError(w, http.StatusInternalServerError, "Failed to create comment, try again later.")
96
94
return
97
97
-
}
98
98
-
99
99
-
err = SavePendingCreate(h, w, r, PendingCommentCreation, newComment)
100
100
-
if err != nil {
101
101
-
log.Printf("failed to save yoten-session to add pending comment creation: %v", err)
102
95
}
103
96
104
97
if !h.Config.Core.Dev {
···
173
166
log.Println("failed to delete comment from PDS:", err)
174
167
htmx.HxError(w, http.StatusInternalServerError, "Failed to delete comment, try again later.")
175
168
return
176
176
-
}
177
177
-
178
178
-
err = SavePendingDelete(h, w, r, PendingCommentDeletion, comment)
179
179
-
if err != nil {
180
180
-
log.Printf("failed to save yoten-session to add pending comment deletion: %v", err)
181
169
}
182
170
183
171
if !h.Config.Core.Dev {
+3
-3
internal/server/oauth/handler/handler.go
···
263
263
}
264
264
}()
265
265
266
266
-
error := r.FormValue("error")
266
266
+
callbackErr := r.FormValue("error")
267
267
errorDescription := r.FormValue("error_description")
268
268
-
if error != "" || errorDescription != "" {
269
269
-
log.Printf("oauth callback error: %s, %s", error, errorDescription)
268
268
+
if callbackErr != "" || errorDescription != "" {
269
269
+
log.Printf("oauth callback error: %s, %s", callbackErr, errorDescription)
270
270
htmx.HxError(w, http.StatusUnauthorized, "Failed to authenticate. Try again later.")
271
271
return
272
272
}
-1
internal/server/views/partials/discussion.templ
···
13
13
hx-disabled-elt="#post-comment-button"
14
14
@htmx:after-request="text = ''"
15
15
x-data="{ text: '' }"
16
16
-
x-init="text = $el.querySelector('textarea').value"
17
16
>
18
17
<input type="hidden" name="study_session_uri" value={ params.StudySessionUri }/>
19
18
<div class="mt-2">