mirror of
https://github.com/gogs/gogs.git
synced 2026-02-01 20:19:23 +01:00
repo: fix 500 error on watchers and stargazers pages using MSSQL (#6386)
Co-authored-by: Joe Chen <jc@unknwon.io> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ All notable changes to Gogs are documented in this file.
|
||||
|
||||
### Fixed
|
||||
|
||||
- 500 error on repository watchers and stargazers pages when using MSSQL. [#5482](https://github.com/gogs/gogs/issues/5482)
|
||||
- Submodules using `ssh://` protocol and a port number are not rendered correctly. [#4941](https://github.com/gogs/gogs/issues/4941)
|
||||
- Missing link to user profile on the first commit in commits history page. [#7404](https://github.com/gogs/gogs/issues/7404)
|
||||
- Unable to delete or display files with special characters in their names. [#7596](https://github.com/gogs/gogs/issues/7596)
|
||||
|
||||
@@ -2408,7 +2408,7 @@ func GetWatchers(repoID int64) ([]*Watch, error) {
|
||||
func (r *Repository) GetWatchers(page int) ([]*User, error) {
|
||||
users := make([]*User, 0, ItemsPerPage)
|
||||
sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("watch.repo_id=?", r.ID)
|
||||
if conf.UsePostgreSQL {
|
||||
if conf.UsePostgreSQL || conf.UseMSSQL {
|
||||
sess = sess.Join("LEFT", "watch", `"user".id=watch.user_id`)
|
||||
} else {
|
||||
sess = sess.Join("LEFT", "watch", "user.id=watch.user_id")
|
||||
@@ -2508,7 +2508,7 @@ func IsStaring(userID, repoID int64) bool {
|
||||
func (r *Repository) GetStargazers(page int) ([]*User, error) {
|
||||
users := make([]*User, 0, ItemsPerPage)
|
||||
sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("star.repo_id=?", r.ID)
|
||||
if conf.UsePostgreSQL {
|
||||
if conf.UsePostgreSQL || conf.UseMSSQL {
|
||||
sess = sess.Join("LEFT", "star", `"user".id=star.uid`)
|
||||
} else {
|
||||
sess = sess.Join("LEFT", "star", "user.id=star.uid")
|
||||
|
||||
Reference in New Issue
Block a user