Credit the user who forked a task as a co-author on its merge
This commit is contained in:
@@ -1148,6 +1148,15 @@ func TestForkSnapshot(t *testing.T) {
|
||||
t.Fatalf("fork session %+v", sess)
|
||||
}
|
||||
|
||||
coAuthors, err := m.CoAuthors(e.ctx, fork.Id, "carol@example.com")
|
||||
if err != nil || len(coAuthors) != 1 || coAuthors[0].Login != login {
|
||||
t.Fatalf("fork co-authors %+v %v, want the forker %s", coAuthors, err, login)
|
||||
}
|
||||
coAuthors, err = m.CoAuthors(e.ctx, e.task.Id, "carol@example.com")
|
||||
if err != nil || len(coAuthors) != 1 || coAuthors[0].Login != login {
|
||||
t.Fatalf("source co-authors %+v %v", coAuthors, err)
|
||||
}
|
||||
|
||||
_, err = m.Send(e.ctx, sess.Id, login, "Without using any tools, list the contents of every file you have created in this conversation, one per line, and nothing else.", "")
|
||||
if err != nil {
|
||||
t.Fatalf("send to fork: %v", err)
|
||||
|
||||
@@ -795,7 +795,7 @@ func (s *Store) Participants(ctx context.Context, taskID string) ([]api.Particip
|
||||
rows, err := s.db.QueryContext(ctx, `
|
||||
SELECT u.login, u.display_name, u.git_name, u.git_email
|
||||
FROM events e JOIN users u ON u.login = e.actor
|
||||
WHERE e.task_id = ? AND e.kind = 'user.message'
|
||||
WHERE e.task_id = ? AND (e.kind = 'user.message' OR (e.kind = 'task.created' AND json_extract(e.payload, '$.forked_from') IS NOT NULL))
|
||||
GROUP BY u.login ORDER BY min(e.seq)
|
||||
`, taskID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user