Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicated feed #2370

Merged
merged 1 commit into from
Aug 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions models/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ type GetFeedsOptions struct {
IncludePrivate bool // include private actions
OnlyPerformedBy bool // only actions performed by requested user
IncludeDeleted bool // include deleted actions
Collaborate bool // Include collaborative repositories
}

// GetFeeds returns actions according to the provided options
Expand All @@ -733,13 +732,7 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) {
cond = cond.And(builder.In("repo_id", repoIDs))
}

var userIDCond builder.Cond = 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)
cond = cond.And(builder.Eq{"user_id": opts.RequestedUser.ID})

if opts.OnlyPerformedBy {
cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID})
Expand Down
1 change: 0 additions & 1 deletion routers/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func Dashboard(ctx *context.Context) {
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
IncludePrivate: true,
OnlyPerformedBy: false,
Collaborate: true,
IncludeDeleted: false,
})
if ctx.Written() {
Expand Down
1 change: 0 additions & 1 deletion routers/user/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func Profile(ctx *context.Context) {
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
IncludePrivate: showPrivate,
OnlyPerformedBy: true,
Collaborate: true,
IncludeDeleted: false,
})
if ctx.Written() {
Expand Down