mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
fix internal error in get PR activity list API
This commit is contained in:
parent
bfed860f7d
commit
3274fca051
@ -25,8 +25,10 @@ import (
|
|||||||
var _ store.PullReqActivityStore = (*PullReqActivityStore)(nil)
|
var _ store.PullReqActivityStore = (*PullReqActivityStore)(nil)
|
||||||
|
|
||||||
// NewPullReqActivityStore returns a new PullReqJournalStore.
|
// NewPullReqActivityStore returns a new PullReqJournalStore.
|
||||||
func NewPullReqActivityStore(db *sqlx.DB,
|
func NewPullReqActivityStore(
|
||||||
pCache store.PrincipalInfoCache) *PullReqActivityStore {
|
db *sqlx.DB,
|
||||||
|
pCache store.PrincipalInfoCache,
|
||||||
|
) *PullReqActivityStore {
|
||||||
return &PullReqActivityStore{
|
return &PullReqActivityStore{
|
||||||
db: db,
|
db: db,
|
||||||
pCache: pCache,
|
pCache: pCache,
|
||||||
@ -321,8 +323,10 @@ func (s *PullReqActivityStore) UpdateOptLock(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count of pull requests for a repo.
|
// Count of pull requests for a repo.
|
||||||
func (s *PullReqActivityStore) Count(ctx context.Context, prID int64,
|
func (s *PullReqActivityStore) Count(ctx context.Context,
|
||||||
opts *types.PullReqActivityFilter) (int64, error) {
|
prID int64,
|
||||||
|
opts *types.PullReqActivityFilter,
|
||||||
|
) (int64, error) {
|
||||||
stmt := builder.
|
stmt := builder.
|
||||||
Select("count(*)").
|
Select("count(*)").
|
||||||
From("pullreq_activities").
|
From("pullreq_activities").
|
||||||
@ -365,8 +369,10 @@ func (s *PullReqActivityStore) Count(ctx context.Context, prID int64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List returns a list of pull requests for a repo.
|
// List returns a list of pull requests for a repo.
|
||||||
func (s *PullReqActivityStore) List(ctx context.Context, prID int64,
|
func (s *PullReqActivityStore) List(ctx context.Context,
|
||||||
opts *types.PullReqActivityFilter) ([]*types.PullReqActivity, error) {
|
prID int64,
|
||||||
|
opts *types.PullReqActivityFilter,
|
||||||
|
) ([]*types.PullReqActivity, error) {
|
||||||
stmt := builder.
|
stmt := builder.
|
||||||
Select(pullreqActivityColumns).
|
Select(pullreqActivityColumns).
|
||||||
From("pullreq_activities").
|
From("pullreq_activities").
|
||||||
@ -552,14 +558,16 @@ func (s *PullReqActivityStore) mapPullReqActivity(ctx context.Context, act *pull
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PullReqActivityStore) mapSlicePullReqActivity(ctx context.Context,
|
func (s *PullReqActivityStore) mapSlicePullReqActivity(
|
||||||
activities []*pullReqActivity) ([]*types.PullReqActivity, error) {
|
ctx context.Context,
|
||||||
|
activities []*pullReqActivity,
|
||||||
|
) ([]*types.PullReqActivity, error) {
|
||||||
// collect all principal IDs
|
// collect all principal IDs
|
||||||
ids := make([]int64, 0, 2*len(activities))
|
ids := make([]int64, 0, 2*len(activities))
|
||||||
for _, act := range activities {
|
for _, act := range activities {
|
||||||
ids = append(ids, act.CreatedBy)
|
ids = append(ids, act.CreatedBy)
|
||||||
if act.ResolvedBy.Valid {
|
if act.ResolvedBy.Valid {
|
||||||
ids = append(ids, act.Resolved.Int64)
|
ids = append(ids, act.ResolvedBy.Int64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user