[GITEA] Rework when recently pushed branches are displayed
With this change, the "You pushed on branch xyz" banner will be
displayed when either the viewed repository or its base repo (if the
current one's a fork) has pull requests enabled. Previously it only
displayed if the viewed repo had PRs enabled.
Furthermore, if the viewed repository is an original repository that the
viewing user has a fork of, if the forked repository has recently pushed
branches, then the banner will appear for the original repository too.
In this case, the notification will include branches from the viewing
user's fork, and branches they pushed to the base repo, too.
Refs: https://codeberg.org/forgejo/forgejo/pulls/2195
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit a29f10661d
)
This commit is contained in:
parent
68fceb9b7a
commit
70c5e2021d
4 changed files with 215 additions and 12 deletions
|
@ -128,6 +128,10 @@ func (b *Branch) LoadDeletedBy(ctx context.Context) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
func (b *Branch) GetRepo(ctx context.Context) (*repo_model.Repository, error) {
|
||||
return repo_model.GetRepositoryByID(ctx, b.RepoID)
|
||||
}
|
||||
|
||||
func (b *Branch) LoadPusher(ctx context.Context) (err error) {
|
||||
if b.Pusher == nil && b.PusherID > 0 {
|
||||
b.Pusher, err = user_model.GetUserByID(ctx, b.PusherID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue