|
|
@ -593,21 +593,21 @@ func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetFeeds returns action list of given user in given context.
|
|
|
|
// GetFeeds returns action list of given user in given context.
|
|
|
|
// ctxUserID is the user who's requesting, userID is the user/org that is requested.
|
|
|
|
// userID is the user who's requesting, ctxUserID is the user/org that is requested.
|
|
|
|
// ctxUserID can be -1, if isProfile is true or in order to skip the permission check.
|
|
|
|
// userID can be -1, if isProfile is true or in order to skip the permission check.
|
|
|
|
func GetFeeds(ctxUserID, userID, offset int64, isProfile bool) ([]*Action, error) { |
|
|
|
func GetFeeds(ctxUserID, userID, offset int64, isProfile bool) ([]*Action, error) { |
|
|
|
actions := make([]*Action, 0, 20) |
|
|
|
actions := make([]*Action, 0, 20) |
|
|
|
sess := x.Limit(20, int(offset)).Desc("id").Where("user_id=?", userID) |
|
|
|
sess := x.Limit(20, int(offset)).Desc("id").Where("user_id=?", ctxUserID) |
|
|
|
if isProfile { |
|
|
|
if isProfile { |
|
|
|
sess.And("is_private=?", false).And("act_user_id=?", userID) |
|
|
|
sess.And("is_private=?", false).And("act_user_id=?", ctxUserID) |
|
|
|
} else if ctxUserID != -1 { |
|
|
|
} else if ctxUserID != -1 { |
|
|
|
ctxUser := &User{Id: userID} |
|
|
|
ctxUser := &User{Id: ctxUserID} |
|
|
|
if err := ctxUser.GetUserRepositories(ctxUserID); err != nil { |
|
|
|
if err := ctxUser.GetUserRepositories(userID); err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var repoIDs []int64 |
|
|
|
var repoIDs []int64 |
|
|
|
for _, repo := range ctxUser.Repos { |
|
|
|
for _, repo := range ctxUser.Repos { |
|
|
|
repoIDs = append(repoIDs, repo.ID) |
|
|
|
repoIDs = append(repoIDs, repo.ID) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|