[UI] Agit: Add AGit label to AGit-created PRs

Adds a label to Pull Requests that were created using AGit-Flow,
in order to prevent situations where a contributor uses AGit-Flow
to push new changes - only to realize that they did not use AGit-Flow
in the first place, and that they just opened a new PR accidentally
(that was me).

Also intended to raise general awareness about the feature. Some
additional work, such as adding a tooltip, still needs to be
done.

A small typo fix for a comment and (exclusively) formatting fixes
in the copyright header are also included.

Refs: https://codeberg.org/forgejo/forgejo/issues/2433
This commit is contained in:
Panagiotis "Ivory" Vasilopoulos 2024-02-23 01:26:17 +01:00
parent c47e6ceb82
commit bf7fb89178
4 changed files with 43 additions and 4 deletions

View file

@ -1,5 +1,6 @@
// Copyright 2018 The Gitea Authors.
// Copyright 2014 The Gogs Authors.
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2018 The Gitea Authors. All rights reserved.
// Copyright 2024 The Forgejo Authors. All rights reserved.
// All rights reserved.
// SPDX-License-Identifier: MIT
@ -381,6 +382,11 @@ func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) {
} else {
ctx.Data["HeadTarget"] = pull.MustHeadUserName(ctx) + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch
}
if pull.Flow == issues_model.PullRequestFlowAGit {
ctx.Data["MadeUsingAGit"] = true
}
ctx.Data["BaseTarget"] = pull.BaseBranch
ctx.Data["HeadBranchLink"] = pull.GetHeadBranchLink(ctx)
ctx.Data["BaseBranchLink"] = pull.GetBaseBranchLink(ctx)