diff options
author | Earl Warren <109468362+earl-warren@users.noreply.github.com> | 2023-11-13 15:30:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 15:30:08 +0100 |
commit | f2ea31de36ec777a84f32dfdb242da2a3d9f1fc8 (patch) | |
tree | 164ac43538f8002fce213500353251ce0aea84e6 /models/issues/comment.go | |
parent | 0678c822653975c7fcf40371f2c39dd14254aa2a (diff) | |
download | gitea-f2ea31de36ec777a84f32dfdb242da2a3d9f1fc8.tar.gz gitea-f2ea31de36ec777a84f32dfdb242da2a3d9f1fc8.zip |
Enable system users for comment.LoadPoster (#28014)
System users (Ghost, ActionsUser, etc) have a negative id and may be the
author of a comment, either because it was created by a now deleted user
or via an action using a transient token.
The GetPossibleUserByID function has special cases related to system
users and will not fail if given a negative id.
Refs: https://codeberg.org/forgejo/forgejo/issues/1425
(cherry picked from commit 6a2d2fa24390116d31ae2507c0a93d423f690b7b)
Diffstat (limited to 'models/issues/comment.go')
-rw-r--r-- | models/issues/comment.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go index f2a3cb7b02..7fd07867df 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -350,7 +350,7 @@ func (c *Comment) AfterLoad(session *xorm.Session) { // LoadPoster loads comment poster func (c *Comment) LoadPoster(ctx context.Context) (err error) { - if c.PosterID <= 0 || c.Poster != nil { + if c.Poster != nil { return nil } |