Monorepo for Tangled tangled.org

appview: replace PullComment to Comment #865

open opened by boltless.me targeting master from sl/wnrvrwyvrlzo
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3m7iohv2yb422
+53 -4
Interdiff #1 #2
appview/db/comments.go

This file has not been changed.

+53 -4
appview/db/db.go
··· 1173 return err 1174 }) 1175 1176 - // not migrating existing comments here 1177 - // all legacy comments will be dropped 1178 orm.RunMigration(conn, logger, "add-comments-table", func(tx *sql.Tx) error { 1179 _, err := tx.Exec(` 1180 - drop table comments; 1181 1182 create table comments ( 1183 -- identifiers 1184 id integer primary key autoincrement, 1185 did text not null, 1186 rkey text not null, 1187 - at_uri text generated always as ('at://' || did || '/' || 'sh.tangled.comment' || '/' || rkey) stored, 1188 1189 -- at identifiers 1190 subject_at text not null, ··· 1201 -- constraints 1202 unique(did, rkey) 1203 ); 1204 `) 1205 return err 1206 })
··· 1173 return err 1174 }) 1175 1176 orm.RunMigration(conn, logger, "add-comments-table", func(tx *sql.Tx) error { 1177 _, err := tx.Exec(` 1178 + drop table if exists comments; 1179 1180 create table comments ( 1181 -- identifiers 1182 id integer primary key autoincrement, 1183 did text not null, 1184 + collection text not null default 'sh.tangled.comment', 1185 rkey text not null, 1186 + at_uri text generated always as ('at://' || did || '/' || collection || '/' || rkey) stored, 1187 1188 -- at identifiers 1189 subject_at text not null, ··· 1200 -- constraints 1201 unique(did, rkey) 1202 ); 1203 + 1204 + insert into comments ( 1205 + did, 1206 + collection, 1207 + rkey, 1208 + subject_at, 1209 + reply_to, 1210 + body, 1211 + created, 1212 + edited, 1213 + deleted 1214 + ) 1215 + select 1216 + did, 1217 + 'sh.tangled.repo.issue.comment', 1218 + rkey, 1219 + issue_at, 1220 + reply_to, 1221 + body, 1222 + created, 1223 + edited, 1224 + deleted 1225 + from issue_comments 1226 + where rkey is not null; 1227 + 1228 + insert into comments ( 1229 + did, 1230 + collection, 1231 + rkey, 1232 + subject_at, 1233 + pull_submission_id, 1234 + body, 1235 + created 1236 + ) 1237 + select 1238 + c.owner_did, 1239 + 'sh.tangled.repo.pull.comment', 1240 + substr( 1241 + substr(c.comment_at, 6 + instr(substr(c.comment_at, 6), '/')), -- nsid/rkey 1242 + instr( 1243 + substr(c.comment_at, 6 + instr(substr(c.comment_at, 6), '/')), -- nsid/rkey 1244 + '/' 1245 + ) + 1 1246 + ), -- rkey 1247 + p.at_uri, 1248 + c.submission_id, 1249 + c.body, 1250 + c.created 1251 + from pull_comments c 1252 + join pulls p on c.repo_at = p.repo_at and c.pull_id = p.pull_id; 1253 `) 1254 return err 1255 })
appview/db/pulls.go

This file has not been changed.

appview/db/reference.go

This file has not been changed.

appview/models/comment.go

This file has not been changed.

appview/models/pull.go

This file has not been changed.

appview/notify/db/db.go

This patch was likely rebased, as context lines do not match.

appview/notify/merged_notifier.go

This patch was likely rebased, as context lines do not match.

appview/notify/notifier.go

This file has not been changed.

appview/notify/posthog/notifier.go

This file has not been changed.

appview/pages/templates/repo/pulls/pull.html

This file has not been changed.

appview/pulls/opengraph.go

This file has not been changed.

appview/pulls/pulls.go

This file has not been changed.

History

8 rounds 4 comments
sign up or login to add to the discussion
1 commit
expand
appview: replace PullComment to Comment
2/3 timeout, 1/3 success
expand
merge conflicts detected
expand
  • appview/notify/db/db.go:260
  • appview/notify/merged_notifier.go:81
  • appview/notify/notifier.go:22
  • appview/pulls/opengraph.go:277
expand 0 comments
1 commit
expand
appview: replace PullComment to Comment
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview: replace PullComment to Comment
3/3 success
expand
expand 0 comments
1 commit
expand
appview: replace PullComment to Comment
3/3 success
expand
expand 1 comment

here, the sort order is reversed, it should be .Before.

1 commit
expand
appview: replace PullComment to Comment
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview: replace PullComment to Comment
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview: replace PullComment to Comment
3/3 success
expand
expand 3 comments

here will this delete all comments made on tangled thus far? don't think this is the right approach if so.

I should've been more precise about my expression. Existing comments won't be dropped as they are stored in issue_comments and pull_comments table (I'm just dropping legacy table with same name there), but yeah this PR itself doesn't include the backward compatibility layer yet so old comments won't be rendered.

Honestly this PR hasn't been updated since you two suggested to just ingest old records. I'll push more commits on top of this stack.

As a side note: I'd suggest to not publish the new sh.tangled.comment lexicon yet.

This unified comment record can be used for PR review comments and it might make us to modify the schema again. I think it would be safest to publish this when PR redesign discussion is finished.

1 commit
expand
appview: replace PullComment to Comment
3/3 success
expand
expand 0 comments