tangled
alpha
login
or
join now
back
round
1
view raw
appview/models: rename Pull.PullAt() to Pull.AtUri()
#752
merged
opened by
oppi.li
2 months ago
targeting
master
from
push-toykwqpnvqrs
in sync with Issue.AtUri.
Signed-off-by: oppiliappan
me@oppi.li
options
unified
split
Changed files
+15
-15
appview
db
pulls.go
models
pull.go
notify
db
db.go
pages
templates
repo
pulls
fragments
pullHeader.html
pull.html
pulls
pulls.go
+4
-4
appview/db/pulls.go
···
92
_, err = tx.Exec(`
93
insert into pull_submissions (pull_at, round_number, patch, combined, source_rev)
94
values (?, ?, ?, ?, ?)
95
-
`, pull.PullAt(), 0, pull.Submissions[0].Patch, pull.Submissions[0].Combined, pull.Submissions[0].SourceRev)
96
return err
97
}
98
···
101
if err != nil {
102
return "", err
103
}
104
-
return pull.PullAt(), err
105
}
106
107
func NextPullId(e Execer, repoAt syntax.ATURI) (int, error) {
···
214
pull.ParentChangeId = parentChangeId.String
215
}
216
217
-
pulls[pull.PullAt()] = &pull
218
}
219
220
var pullAts []syntax.ATURI
221
for _, p := range pulls {
222
-
pullAts = append(pullAts, p.PullAt())
223
}
224
submissionsMap, err := GetPullSubmissions(e, FilterIn("pull_at", pullAts))
225
if err != nil {
···
92
_, err = tx.Exec(`
93
insert into pull_submissions (pull_at, round_number, patch, combined, source_rev)
94
values (?, ?, ?, ?, ?)
95
+
`, pull.AtUri(), 0, pull.Submissions[0].Patch, pull.Submissions[0].Combined, pull.Submissions[0].SourceRev)
96
return err
97
}
98
···
101
if err != nil {
102
return "", err
103
}
104
+
return pull.AtUri(), err
105
}
106
107
func NextPullId(e Execer, repoAt syntax.ATURI) (int, error) {
···
214
pull.ParentChangeId = parentChangeId.String
215
}
216
217
+
pulls[pull.AtUri()] = &pull
218
}
219
220
var pullAts []syntax.ATURI
221
for _, p := range pulls {
222
+
pullAts = append(pullAts, p.AtUri())
223
}
224
submissionsMap, err := GetPullSubmissions(e, FilterIn("pull_at", pullAts))
225
if err != nil {
+1
-1
appview/models/pull.go
···
167
return p.LatestSubmission().SourceRev
168
}
169
170
-
func (p *Pull) PullAt() syntax.ATURI {
171
return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", p.OwnerDid, tangled.RepoPullNSID, p.Rkey))
172
}
173
···
167
return p.LatestSubmission().SourceRev
168
}
169
170
+
func (p *Pull) AtUri() syntax.ATURI {
171
return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", p.OwnerDid, tangled.RepoPullNSID, p.Rkey))
172
}
173
+3
-3
appview/notify/db/db.go
···
203
actorDid := syntax.DID(pull.OwnerDid)
204
eventType := models.NotificationTypePullCreated
205
entityType := "pull"
206
-
entityId := pull.PullAt().String()
207
repoId := &repo.Id
208
var issueId *int64
209
p := int64(pull.ID)
···
249
actorDid := syntax.DID(comment.OwnerDid)
250
eventType := models.NotificationTypePullCommented
251
entityType := "pull"
252
-
entityId := pull.PullAt().String()
253
repoId := &repo.Id
254
var issueId *int64
255
p := int64(pull.ID)
···
353
}
354
355
entityType := "pull"
356
-
entityId := pull.PullAt().String()
357
repoId := &repo.Id
358
var issueId *int64
359
var eventType models.NotificationType
···
203
actorDid := syntax.DID(pull.OwnerDid)
204
eventType := models.NotificationTypePullCreated
205
entityType := "pull"
206
+
entityId := pull.AtUri().String()
207
repoId := &repo.Id
208
var issueId *int64
209
p := int64(pull.ID)
···
249
actorDid := syntax.DID(comment.OwnerDid)
250
eventType := models.NotificationTypePullCommented
251
entityType := "pull"
252
+
entityId := pull.AtUri().String()
253
repoId := &repo.Id
254
var issueId *int64
255
p := int64(pull.ID)
···
353
}
354
355
entityType := "pull"
356
+
entityId := pull.AtUri().String()
357
repoId := &repo.Id
358
var issueId *int64
359
var eventType models.NotificationType
+1
-1
appview/pages/templates/repo/pulls/fragments/pullHeader.html
···
75
"Kind" $kind
76
"Count" $reactionData.Count
77
"IsReacted" (index $.UserReacted $kind)
78
-
"ThreadAt" $.Pull.PullAt
79
"Users" $reactionData.Users)
80
}}
81
{{ end }}
···
75
"Kind" $kind
76
"Count" $reactionData.Count
77
"IsReacted" (index $.UserReacted $kind)
78
+
"ThreadAt" $.Pull.AtUri
79
"Users" $reactionData.Users)
80
}}
81
{{ end }}
+1
-1
appview/pages/templates/repo/pulls/pull.html
···
18
{{ template "repo/fragments/labelPanel"
19
(dict "RepoInfo" $.RepoInfo
20
"Defs" $.LabelDefs
21
-
"Subject" $.Pull.PullAt
22
"State" $.Pull.Labels) }}
23
{{ template "repo/fragments/participants" $.Pull.Participants }}
24
</div>
···
18
{{ template "repo/fragments/labelPanel"
19
(dict "RepoInfo" $.RepoInfo
20
"Defs" $.LabelDefs
21
+
"Subject" $.Pull.AtUri
22
"State" $.Pull.Labels) }}
23
{{ template "repo/fragments/participants" $.Pull.Participants }}
24
</div>
+5
-5
appview/pulls/pulls.go
···
192
m[p.Sha] = p
193
}
194
195
-
reactionMap, err := db.GetReactionMap(s.db, 20, pull.PullAt())
196
if err != nil {
197
log.Println("failed to get pull reactions")
198
s.pages.Notice(w, "pulls", "Failed to load pull. Try again later.")
···
200
201
userReactions := map[models.ReactionKind]bool{}
202
if user != nil {
203
-
userReactions = db.GetReactionStatusMap(s.db, user.Did, pull.PullAt())
204
}
205
206
labelDefs, err := db.GetLabelDefinitions(
···
752
Rkey: tid.TID(),
753
Record: &lexutil.LexiconTypeDecoder{
754
Val: &tangled.RepoPullComment{
755
-
Pull: pull.PullAt().String(),
756
Body: body,
757
CreatedAt: createdAt,
758
},
···
1839
}
1840
defer tx.Rollback()
1841
1842
-
pullAt := pull.PullAt()
1843
newRoundNumber := len(pull.Submissions)
1844
newPatch := patch
1845
newSourceRev := sourceRev
···
2036
}
2037
2038
// resubmit the new pull
2039
-
pullAt := op.PullAt()
2040
newRoundNumber := len(op.Submissions)
2041
newPatch := np.LatestPatch()
2042
combinedPatch := np.LatestSubmission().Combined
···
192
m[p.Sha] = p
193
}
194
195
+
reactionMap, err := db.GetReactionMap(s.db, 20, pull.AtUri())
196
if err != nil {
197
log.Println("failed to get pull reactions")
198
s.pages.Notice(w, "pulls", "Failed to load pull. Try again later.")
···
200
201
userReactions := map[models.ReactionKind]bool{}
202
if user != nil {
203
+
userReactions = db.GetReactionStatusMap(s.db, user.Did, pull.AtUri())
204
}
205
206
labelDefs, err := db.GetLabelDefinitions(
···
752
Rkey: tid.TID(),
753
Record: &lexutil.LexiconTypeDecoder{
754
Val: &tangled.RepoPullComment{
755
+
Pull: pull.AtUri().String(),
756
Body: body,
757
CreatedAt: createdAt,
758
},
···
1839
}
1840
defer tx.Rollback()
1841
1842
+
pullAt := pull.AtUri()
1843
newRoundNumber := len(pull.Submissions)
1844
newPatch := patch
1845
newSourceRev := sourceRev
···
2036
}
2037
2038
// resubmit the new pull
2039
+
pullAt := op.AtUri()
2040
newRoundNumber := len(op.Submissions)
2041
newPatch := np.LatestPatch()
2042
combinedPatch := np.LatestSubmission().Combined