// State returns string representation of issue status. | // State returns string representation of issue status. | ||||
func (issue *Issue) State() api.StateType { | func (issue *Issue) State() api.StateType { | ||||
if issue.IsClosed { | if issue.IsClosed { | ||||
return api.STATE_CLOSED | |||||
return api.StateClosed | |||||
} | } | ||||
return api.STATE_OPEN | |||||
return api.StateOpen | |||||
} | } | ||||
// APIFormat assumes some fields assigned with values: | // APIFormat assumes some fields assigned with values: | ||||
if isClosed { | if isClosed { | ||||
apiPullRequest.Action = api.HookIssueClosed | apiPullRequest.Action = api.HookIssueClosed | ||||
} else { | } else { | ||||
apiPullRequest.Action = api.HookIssueReopened | |||||
apiPullRequest.Action = api.HookIssueReOpened | |||||
} | } | ||||
err = PrepareWebhooks(repo, HookEventPullRequest, apiPullRequest) | err = PrepareWebhooks(repo, HookEventPullRequest, apiPullRequest) | ||||
} | } | ||||
// State returns string representation of milestone status. | // State returns string representation of milestone status. | ||||
func (m *Milestone) State() api.StateType { | func (m *Milestone) State() api.StateType { | ||||
if m.IsClosed { | if m.IsClosed { | ||||
return api.STATE_CLOSED | |||||
return api.StateClosed | |||||
} | } | ||||
return api.STATE_OPEN | |||||
return api.StateOpen | |||||
} | } | ||||
// APIFormat returns this Milestone in API format. | // APIFormat returns this Milestone in API format. |
if pr.Status != PullRequestStatusChecking { | if pr.Status != PullRequestStatusChecking { | ||||
mergeable := pr.Status != PullRequestStatusConflict | mergeable := pr.Status != PullRequestStatusConflict | ||||
apiPullRequest.Mergeable = &mergeable | |||||
apiPullRequest.Mergeable = mergeable | |||||
} | } | ||||
if pr.HasMerged { | if pr.HasMerged { | ||||
apiPullRequest.Merged = &pr.Merged | apiPullRequest.Merged = &pr.Merged |
UserName: u.Name, | UserName: u.Name, | ||||
FullName: u.FullName, | FullName: u.FullName, | ||||
Email: u.Email, | Email: u.Email, | ||||
AvatarUrl: u.AvatarLink(), | |||||
AvatarURL: u.AvatarLink(), | |||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
text = fmt.Sprintf("[%s] Pull request closed: %s by %s", p.Repository.FullName, titleLink, senderLink) | text = fmt.Sprintf("[%s] Pull request closed: %s by %s", p.Repository.FullName, titleLink, senderLink) | ||||
} | } | ||||
case api.HookIssueReopened: | |||||
case api.HookIssueReOpened: | |||||
text = fmt.Sprintf("[%s] Pull request re-opened: %s by %s", p.Repository.FullName, titleLink, senderLink) | text = fmt.Sprintf("[%s] Pull request re-opened: %s by %s", p.Repository.FullName, titleLink, senderLink) | ||||
case api.HookIssueEdited: | case api.HookIssueEdited: | ||||
text = fmt.Sprintf("[%s] Pull request edited: %s by %s", p.Repository.FullName, titleLink, senderLink) | text = fmt.Sprintf("[%s] Pull request edited: %s by %s", p.Repository.FullName, titleLink, senderLink) |
func ToOrganization(org *models.User) *api.Organization { | func ToOrganization(org *models.User) *api.Organization { | ||||
return &api.Organization{ | return &api.Organization{ | ||||
ID: org.ID, | ID: org.ID, | ||||
AvatarUrl: org.AvatarLink(), | |||||
AvatarURL: org.AvatarLink(), | |||||
UserName: org.Name, | UserName: org.Name, | ||||
FullName: org.FullName, | FullName: org.FullName, | ||||
Description: org.Description, | Description: org.Description, |
return | return | ||||
} | } | ||||
if form.State != nil { | if form.State != nil { | ||||
if err = issue.ChangeStatus(ctx.User, ctx.Repo.Repository, api.STATE_CLOSED == api.StateType(*form.State)); err != nil { | |||||
if err = issue.ChangeStatus(ctx.User, ctx.Repo.Repository, api.StateClosed == api.StateType(*form.State)); err != nil { | |||||
ctx.Error(500, "ChangeStatus", err) | ctx.Error(500, "ChangeStatus", err) | ||||
return | return | ||||
} | } |
results[i] = &api.User{ | results[i] = &api.User{ | ||||
ID: users[i].ID, | ID: users[i].ID, | ||||
UserName: users[i].Name, | UserName: users[i].Name, | ||||
AvatarUrl: users[i].AvatarLink(), | |||||
AvatarURL: users[i].AvatarLink(), | |||||
FullName: users[i].FullName, | FullName: users[i].FullName, | ||||
} | } | ||||
if ctx.IsSigned { | if ctx.IsSigned { |