#2743 workaround to fix XORM problem

release/v0.9
Unknwon 8 years ago
parent 4d930f3598
commit c9901bbba5

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current version: 0.8.50 ##### Current version: 0.8.51
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

@ -19,6 +19,7 @@ Cysioland
Daniel Speichert <daniel AT speichert DOT pl> Daniel Speichert <daniel AT speichert DOT pl>
David Yzaguirre <dvdyzag AT gmail DOT com> David Yzaguirre <dvdyzag AT gmail DOT com>
Dmitriy Nogay <me AT catwhocode DOT ga> Dmitriy Nogay <me AT catwhocode DOT ga>
Enrico Testori hypertesto AT gmail DOT com
Ezequiel Gonzalez Rial <gonrial AT gmail DOT com> Ezequiel Gonzalez Rial <gonrial AT gmail DOT com>
Gregor Santner <gdev AT live DOT de> Gregor Santner <gdev AT live DOT de>
Hamid Feizabadi <hamidfzm AT gmail DOT com> Hamid Feizabadi <hamidfzm AT gmail DOT com>
@ -33,15 +34,18 @@ Lauri Ojansivu <x AT xet7 DOT org>
Luc Stepniewski <luc AT stepniewski DOT fr> Luc Stepniewski <luc AT stepniewski DOT fr>
Luca Kröger <l DOT kroeger01 AT gmail DOT com> Luca Kröger <l DOT kroeger01 AT gmail DOT com>
Marc Schiller <marc AT schiller DOT im> Marc Schiller <marc AT schiller DOT im>
Marvin Menzerath <github AT marvin-menzerath DOT de>
Miguel de la Cruz <miguel AT mcrx DOT me> Miguel de la Cruz <miguel AT mcrx DOT me>
Mikhail Burdin <xdshot9000 AT gmail DOT com> Mikhail Burdin <xdshot9000 AT gmail DOT com>
Morten Sørensen <klim8d AT gmail DOT com> Morten Sørensen <klim8d AT gmail DOT com>
Nakao Takamasa <at.mattenn AT gmail DOT com> Nakao Takamasa <at.mattenn AT gmail DOT com>
Natan Albuquerque <natanalbuquerque5 AT gmail DOT com> Natan Albuquerque <natanalbuquerque5 AT gmail DOT com>
Odilon Junior <odilon DOT junior93 AT gmail DOT com> Odilon Junior <odilon DOT junior93 AT gmail DOT com>
SeongJae Park <sj38 DOT park AT gmail DOT com>
Thomas Fanninger <gogs DOT thomas AT fanninger DOT at> Thomas Fanninger <gogs DOT thomas AT fanninger DOT at>
Tilmann Bach <tilmann AT outlook DOT com> Tilmann Bach <tilmann AT outlook DOT com>
Toni Villena Jiménez <tonivj5 AT gmail DOT com> Toni Villena Jiménez <tonivj5 AT gmail DOT com>
Vladimir Jigulin mogaika AT yandex DOT ru
Vladimir Vissoultchev <wqweto AT gmail DOT com> Vladimir Vissoultchev <wqweto AT gmail DOT com>
YJSoft <yjsoft AT yjsoft DOT pe DOT kr> YJSoft <yjsoft AT yjsoft DOT pe DOT kr>
Łukasz Jan Niemier <lukasz AT niemier DOT pl> Łukasz Jan Niemier <lukasz AT niemier DOT pl>

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.8.50.0301" const APP_VER = "0.8.51.0303"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

@ -1055,8 +1055,7 @@ func RemoveOrgRepo(orgID, repoID int64) error {
// that the user with the given userID has access to. // that the user with the given userID has access to.
func (org *User) GetUserRepositories(userID int64) (err error) { func (org *User) GetUserRepositories(userID int64) (err error) {
teams := make([]*Team, 0, 10) teams := make([]*Team, 0, 10)
if err = x.Cols("`team`.id"). if err = x.Where("`team_user`.org_id=?", org.Id).
Where("`team_user`.org_id=?", org.Id).
And("`team_user`.uid=?", userID). And("`team_user`.uid=?", userID).
Join("INNER", "`team_user`", "`team_user`.team_id=`team`.id"). Join("INNER", "`team_user`", "`team_user`.team_id=`team`.id").
Find(&teams); err != nil { Find(&teams); err != nil {
@ -1076,8 +1075,7 @@ func (org *User) GetUserRepositories(userID int64) (err error) {
// As a workaround, we have to build the IN statement on our own, until this is fixed. // As a workaround, we have to build the IN statement on our own, until this is fixed.
// https://github.com/go-xorm/xorm/issues/342 // https://github.com/go-xorm/xorm/issues/342
if err = x.Cols("`repository`.*"). if err = x.Join("INNER", "`team_repo`", "`team_repo`.repo_id=`repository`.id").
Join("INNER", "`team_repo`", "`team_repo`.repo_id=`repository`.id").
Where("`repository`.owner_id=?", org.Id). Where("`repository`.owner_id=?", org.Id).
And("`repository`.is_private=?", false). And("`repository`.is_private=?", false).
Or("`team_repo`.team_id IN (?)", strings.Join(teamIDs, ",")). Or("`team_repo`.team_id IN (?)", strings.Join(teamIDs, ",")).

@ -1 +1 @@
0.8.50.0301 0.8.51.0303
Loading…
Cancel
Save