fix duplicated feed (#2370)
This commit is contained in:
parent
f916aa0fe3
commit
1cbe502cc2
|
@ -713,7 +713,6 @@ type GetFeedsOptions struct {
|
||||||
IncludePrivate bool // include private actions
|
IncludePrivate bool // include private actions
|
||||||
OnlyPerformedBy bool // only actions performed by requested user
|
OnlyPerformedBy bool // only actions performed by requested user
|
||||||
IncludeDeleted bool // include deleted actions
|
IncludeDeleted bool // include deleted actions
|
||||||
Collaborate bool // Include collaborative repositories
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFeeds returns actions according to the provided options
|
// GetFeeds returns actions according to the provided options
|
||||||
|
@ -733,13 +732,7 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) {
|
||||||
cond = cond.And(builder.In("repo_id", repoIDs))
|
cond = cond.And(builder.In("repo_id", repoIDs))
|
||||||
}
|
}
|
||||||
|
|
||||||
var userIDCond builder.Cond = builder.Eq{"user_id": opts.RequestedUser.ID}
|
cond = cond.And(builder.Eq{"user_id": opts.RequestedUser.ID})
|
||||||
if opts.Collaborate {
|
|
||||||
userIDCond = userIDCond.Or(builder.Expr(
|
|
||||||
"repo_id IN (SELECT repo_id FROM `access` WHERE access.user_id = ?)",
|
|
||||||
opts.RequestedUser.ID))
|
|
||||||
}
|
|
||||||
cond = cond.And(userIDCond)
|
|
||||||
|
|
||||||
if opts.OnlyPerformedBy {
|
if opts.OnlyPerformedBy {
|
||||||
cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID})
|
cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID})
|
||||||
|
|
|
@ -156,7 +156,6 @@ func Dashboard(ctx *context.Context) {
|
||||||
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
|
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
|
||||||
IncludePrivate: true,
|
IncludePrivate: true,
|
||||||
OnlyPerformedBy: false,
|
OnlyPerformedBy: false,
|
||||||
Collaborate: true,
|
|
||||||
IncludeDeleted: false,
|
IncludeDeleted: false,
|
||||||
})
|
})
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
|
|
@ -141,7 +141,6 @@ func Profile(ctx *context.Context) {
|
||||||
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
|
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
|
||||||
IncludePrivate: showPrivate,
|
IncludePrivate: showPrivate,
|
||||||
OnlyPerformedBy: true,
|
OnlyPerformedBy: true,
|
||||||
Collaborate: true,
|
|
||||||
IncludeDeleted: false,
|
IncludeDeleted: false,
|
||||||
})
|
})
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user