reviews and inbox smashing
This commit is contained in:
@@ -317,10 +317,6 @@ func getItem(ctx context.Context, q querier, id string) (api.InboxItem, error) {
|
||||
}
|
||||
|
||||
item.Responses, err = getResponses(ctx, q, id)
|
||||
if err != nil {
|
||||
return item, err
|
||||
}
|
||||
item.Reviews, err = questionReviews(ctx, q, item)
|
||||
return item, err
|
||||
}
|
||||
|
||||
|
||||
@@ -156,21 +156,6 @@ func emitReview(ctx context.Context, tx *sql.Tx, emit emitFunc, kind, id, actor
|
||||
return emit(api.Event{Kind: kind, ProjectId: &projectID, TaskId: &r.TaskId, Actor: actor, Payload: ToPayload(r)})
|
||||
}
|
||||
|
||||
func questionReviews(ctx context.Context, q querier, item api.InboxItem) ([]api.Review, error) {
|
||||
if item.Kind != api.Question {
|
||||
return []api.Review{}, nil
|
||||
}
|
||||
rows, err := q.QueryContext(ctx, `
|
||||
SELECT `+reviewColumns+` FROM reviews WHERE task_id = ? AND snapshot_n = (
|
||||
SELECT min(n) FROM snapshots WHERE task_id = ? AND created_at >= ?
|
||||
)
|
||||
`, item.TaskId, item.TaskId, formatTime(item.CreatedAt))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return scanReviews(rows)
|
||||
}
|
||||
|
||||
func scanReviews(rows *sql.Rows) ([]api.Review, error) {
|
||||
defer rows.Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user