-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Change/remove a branch of an open issue #9080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
c7d3b19
0e106f0
de06054
c99c280
c41a8a9
b84622d
668d3c0
92a031f
7d339c1
20f10af
9e36b25
bb1b87f
8b68d5d
fbf7ad9
619a128
0eac4b6
2bd8e64
f8a70ce
b913c6e
6c8e3e0
d7cd33e
c74afb9
c0a77d4
52f6763
7d97d58
f8f8d13
aeb173b
0fc8d10
def127d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -956,7 +956,7 @@ func ViewIssue(ctx *context.Context) { | |
| ctx.Data["Participants"] = participants | ||
| ctx.Data["NumParticipants"] = len(participants) | ||
| ctx.Data["Issue"] = issue | ||
| ctx.Data["ReadOnly"] = true | ||
| ctx.Data["ReadOnly"] = false | ||
| ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string) | ||
| ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.User.ID) | ||
| ctx.Data["IsIssueWriter"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) | ||
|
|
@@ -1055,6 +1055,34 @@ func UpdateIssueTitle(ctx *context.Context) { | |
| }) | ||
| } | ||
|
|
||
| // UpdateIssueRef change issue's ref (branch) | ||
| func UpdateIssueRef(ctx *context.Context) { | ||
| issue := GetActionIssue(ctx) | ||
| if ctx.Written() { | ||
| return | ||
| } | ||
|
|
||
| if !ctx.IsSigned || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)) { | ||
|
||
| ctx.Error(403) | ||
| return | ||
| } | ||
|
|
||
| ref := ctx.QueryTrim("ref") | ||
| if len(ref) == 0 { | ||
| ctx.Error(204) | ||
|
||
| return | ||
| } | ||
|
|
||
| if err := issue_service.ChangeIssueRef(issue, ctx.User, ref); err != nil { | ||
| ctx.ServerError("ChangeRef", err) | ||
| return | ||
| } | ||
|
|
||
| ctx.JSON(200, map[string]interface{}{ | ||
| "ref": ref, | ||
| }) | ||
| } | ||
|
|
||
| // UpdateIssueContent change issue's content | ||
| func UpdateIssueContent(ctx *context.Context) { | ||
| issue := GetActionIssue(ctx) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,20 @@ func ChangeTitle(issue *models.Issue, doer *models.User, title string) (err erro | |
| return nil | ||
| } | ||
|
|
||
| // ChangeIssueRef changes the branch of this issue, as the given user. | ||
| func ChangeIssueRef(issue *models.Issue, doer *models.User, ref string) (err error) { | ||
| oldRef := issue.Ref | ||
| issue.Ref = ref | ||
|
|
||
| if err = issue.ChangeRef(doer, oldRef); err != nil { | ||
| return | ||
| } | ||
vedranMv marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // TODO: implement notifications | ||
|
||
| //notification.NotifyIssueChangeTitle(doer, issue, oldRef) | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // UpdateAssignees is a helper function to add or delete one or multiple issue assignee(s) | ||
| // Deleting is done the GitHub way (quote from their api documentation): | ||
| // https://developer.github.com/v3/issues/#edit-an-issue | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.