1
0
Fork 0
forked from forgejo/forgejo

[GITEA] enable system users for comment.LoadPoster

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 97667e06b3)
(cherry picked from commit 8ef73a09c9)
(cherry picked from commit fa8a00d264)
This commit is contained in:
Earl Warren 2023-09-12 09:04:46 +02:00
parent fcd4535ac6
commit 2ada2074b5
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 38 additions and 1 deletions

View file

@ -342,7 +342,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
}