aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues
diff options
context:
space:
mode:
authorNanguan Lin <70063547+lng2020@users.noreply.github.com>2023-10-20 22:43:08 +0800
committerGitHub <noreply@github.com>2023-10-20 14:43:08 +0000
commit881806a50ba4e3bb761245b2b590046eb1423b95 (patch)
treeef427c4ee00438259c75b42e347fd8729be49a8a /models/issues
parenteb1478791f2bdf77f54853e25878e3c5371a80d3 (diff)
downloadgitea-881806a50ba4e3bb761245b2b590046eb1423b95.tar.gz
gitea-881806a50ba4e3bb761245b2b590046eb1423b95.zip
Replace -1 with GhostUserID (#27703)
Diffstat (limited to 'models/issues')
-rw-r--r--models/issues/comment.go2
-rw-r--r--models/issues/issue.go2
-rw-r--r--models/issues/pull.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go
index 901958dc5d..8e06838f73 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -349,7 +349,7 @@ func (c *Comment) LoadPoster(ctx context.Context) (err error) {
c.Poster, err = user_model.GetPossibleUserByID(ctx, c.PosterID)
if err != nil {
if user_model.IsErrUserNotExist(err) {
- c.PosterID = -1
+ c.PosterID = user_model.GhostUserID
c.Poster = user_model.NewGhostUser()
} else {
log.Error("getUserByID[%d]: %v", c.ID, err)
diff --git a/models/issues/issue.go b/models/issues/issue.go
index 6d9c8727b3..8655b9de3f 100644
--- a/models/issues/issue.go
+++ b/models/issues/issue.go
@@ -219,7 +219,7 @@ func (issue *Issue) LoadPoster(ctx context.Context) (err error) {
if issue.Poster == nil && issue.PosterID != 0 {
issue.Poster, err = user_model.GetPossibleUserByID(ctx, issue.PosterID)
if err != nil {
- issue.PosterID = -1
+ issue.PosterID = user_model.GhostUserID
issue.Poster = user_model.NewGhostUser()
if !user_model.IsErrUserNotExist(err) {
return fmt.Errorf("getUserByID.(poster) [%d]: %w", issue.PosterID, err)
diff --git a/models/issues/pull.go b/models/issues/pull.go
index 971ce049c3..2379c61976 100644
--- a/models/issues/pull.go
+++ b/models/issues/pull.go
@@ -272,7 +272,7 @@ func (pr *PullRequest) LoadAttributes(ctx context.Context) (err error) {
if pr.HasMerged && pr.Merger == nil {
pr.Merger, err = user_model.GetUserByID(ctx, pr.MergerID)
if user_model.IsErrUserNotExist(err) {
- pr.MergerID = -1
+ pr.MergerID = user_model.GhostUserID
pr.Merger = user_model.NewGhostUser()
} else if err != nil {
return fmt.Errorf("getUserByID [%d]: %w", pr.MergerID, err)