]> source.dussan.org Git - gitea.git/commitdiff
Update/simplify fix that owners also see actions on their repositories
authorPeter Smit <peter@smitmail.eu>
Wed, 18 Feb 2015 06:59:22 +0000 (08:59 +0200)
committerPeter Smit <peter@smitmail.eu>
Wed, 18 Feb 2015 06:59:22 +0000 (08:59 +0200)
routers/user/home.go

index 574c6387dcdeb1688ff0c59f0890e50851dbc6f0..0a1d9dd2178f1294f04338d339f4432658559fe3 100644 (file)
@@ -103,14 +103,14 @@ func Dashboard(ctx *middleware.Context) {
        feeds := make([]*models.Action, 0, len(actions))
        for _, act := range actions {
                if act.IsPrivate {
-                       repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
                        // This prevents having to retrieve the repository for each action
-                       if act.RepoUserName == ctx.User.LowerName {
-                               repo.OwnerId = ctx.User.Id
-                       }
-                       if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
-                               continue
+                       repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+                       if act.RepoUserName != ctx.User.LowerName {
+                               if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
+                                       continue
+                               }
                        }
+
                }
                // FIXME: cache results?
                u, err := models.GetUserByName(act.ActUserName)
@@ -215,14 +215,14 @@ func Profile(ctx *middleware.Context) {
                                if !ctx.IsSigned {
                                        continue
                                }
-                               repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
                                // This prevents having to retrieve the repository for each action
-                               if act.RepoUserName == ctx.User.LowerName {
-                                       repo.OwnerId = ctx.User.Id
-                               }
-                               if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
-                                       continue
+                               repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+                               if act.RepoUserName != ctx.User.LowerName {
+                                       if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
+                                               continue
+                                       }
                                }
+
                        }
                        // FIXME: cache results?
                        u, err := models.GetUserByName(act.ActUserName)