1
Fork 0

fix(commenter roles): don't give system users roles (#6766)

Currently on every pull request Ghost would have a misleading "First-time contributor" role.
Also, if the issue author is a Ghost, all other ghosts who commented will be labeled as authors even if they are different ghosts.

I've added a missing check to abort all other permission and contribution checks early if the user is a ghost. Also applies to other system users, as suggested by @earl-warren.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6766
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2025-02-05 17:34:45 +00:00 committed by Gusted
parent 862f4ad60c
commit d1d78c1b14
5 changed files with 140 additions and 5 deletions

View file

@ -1,4 +1,5 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package user
@ -95,3 +96,7 @@ func APActorUserAPActorID() string {
path, _ := url.JoinPath(setting.AppURL, "/api/v1/activitypub/actor")
return path
}
func (u *User) IsAPActor() bool {
return u != nil && u.ID == APActorUserID
}