From a60f4be736f575eecdf8ae6e3932cf309c5830a3 Mon Sep 17 00:00:00 2001 From: Matti Ranta Date: Fri, 13 Jul 2018 21:23:12 -0400 Subject: [PATCH] make fmt --- models/org_test.go | 12 ++++++------ routers/api/v1/org/org.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/models/org_test.go b/models/org_test.go index 6108decb6..9f6cbbbfd 100644 --- a/models/org_test.go +++ b/models/org_test.go @@ -552,7 +552,7 @@ func TestHasOrgVisibleTypePublic(t *testing.T) { const newOrgName = "test-org-public" org := &User{ - Name: newOrgName, + Name: newOrgName, Visibility: VisibleTypePublic, } @@ -575,7 +575,7 @@ func TestHasOrgVisibleTypeLimited(t *testing.T) { const newOrgName = "test-org-limited" org := &User{ - Name: newOrgName, + Name: newOrgName, Visibility: VisibleTypeLimited, } @@ -586,8 +586,8 @@ func TestHasOrgVisibleTypeLimited(t *testing.T) { test1 := HasOrgVisible([]*User{org}, owner) test2 := HasOrgVisible([]*User{org}, user3) test3 := HasOrgVisible([]*User{org}, nil) - assert.Equal(t, test1, true) // owner of org - assert.Equal(t, test2, true) // user not a part of org + assert.Equal(t, test1, true) // owner of org + assert.Equal(t, test2, true) // user not a part of org assert.Equal(t, test3, false) // logged out user } @@ -598,7 +598,7 @@ func TestHasOrgVisibleTypePrivate(t *testing.T) { const newOrgName = "test-org-private" org := &User{ - Name: newOrgName, + Name: newOrgName, Visibility: VisibleTypePrivate, } @@ -609,7 +609,7 @@ func TestHasOrgVisibleTypePrivate(t *testing.T) { test1 := HasOrgVisible([]*User{org}, owner) test2 := HasOrgVisible([]*User{org}, user3) test3 := HasOrgVisible([]*User{org}, nil) - assert.Equal(t, test1, true) // owner of org + assert.Equal(t, test1, true) // owner of org assert.Equal(t, test2, false) // user not a part of org assert.Equal(t, test3, false) // logged out user } diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index 61bcbf4c9..5247b02e8 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -1,4 +1,5 @@ // Copyright 2015 The Gogs Authors. All rights reserved. +// Copyright 2018 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -78,7 +79,7 @@ func Get(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Organization" - canSeeOrg := models.HasOrgVisible([]*models.User{ctx.Org}, ctx.User) + canSeeOrg := models.HasOrgVisible([]*models.User{ctx.Org.Organization}, ctx.User) if !canSeeOrg { ctx.NotFound("HasOrgVisible", nil) return