mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Merge pull request #781 from andreynering/notifications-step-5
Notifications step 5
This commit is contained in:
commit
cc31a21192
@ -93,6 +93,16 @@ func (issue *Issue) loadRepo(e Engine) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPullRequest returns the issue pull request
|
||||||
|
func (issue *Issue) GetPullRequest() (pr *PullRequest, err error) {
|
||||||
|
if !issue.IsPull {
|
||||||
|
return nil, fmt.Errorf("Issue is not a pull request")
|
||||||
|
}
|
||||||
|
|
||||||
|
pr, err = getPullRequestByIssueID(x, issue.ID)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (issue *Issue) loadAttributes(e Engine) (err error) {
|
func (issue *Issue) loadAttributes(e Engine) (err error) {
|
||||||
if err := issue.loadRepo(e); err != nil {
|
if err := issue.loadRepo(e); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -953,9 +963,9 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
|
|||||||
|
|
||||||
switch opts.IsPull {
|
switch opts.IsPull {
|
||||||
case util.OptionalBoolTrue:
|
case util.OptionalBoolTrue:
|
||||||
sess.And("issue.is_pull=?",true)
|
sess.And("issue.is_pull=?", true)
|
||||||
case util.OptionalBoolFalse:
|
case util.OptionalBoolFalse:
|
||||||
sess.And("issue.is_pull=?",false)
|
sess.And("issue.is_pull=?", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
sortIssuesSession(sess, opts.SortType)
|
sortIssuesSession(sess, opts.SortType)
|
||||||
@ -1780,4 +1790,3 @@ func DeleteMilestoneByRepoID(repoID, id int64) error {
|
|||||||
}
|
}
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2726,17 +2726,16 @@ footer .ui.language .menu {
|
|||||||
.user.notification table tr {
|
.user.notification table tr {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.user.notification .octicon-issue-opened,
|
.user.notification .octicon.green {
|
||||||
.user.notification .octicon-git-pull-request {
|
|
||||||
color: #21ba45;
|
color: #21ba45;
|
||||||
}
|
}
|
||||||
.user.notification .octicon-issue-closed {
|
.user.notification .octicon.red {
|
||||||
color: #d01919;
|
color: #d01919;
|
||||||
}
|
}
|
||||||
.user.notification .octicon-git-merge {
|
.user.notification .octicon.purple {
|
||||||
color: #a333c8;
|
color: #a333c8;
|
||||||
}
|
}
|
||||||
.user.notification .octicon-pin {
|
.user.notification .octicon.blue {
|
||||||
color: #2185d0;
|
color: #2185d0;
|
||||||
}
|
}
|
||||||
.dashboard {
|
.dashboard {
|
||||||
|
@ -99,17 +99,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.octicon-issue-opened, .octicon-git-pull-request {
|
.octicon {
|
||||||
|
&.green {
|
||||||
color: #21ba45;
|
color: #21ba45;
|
||||||
}
|
}
|
||||||
.octicon-issue-closed {
|
&.red {
|
||||||
color: #d01919;
|
color: #d01919;
|
||||||
}
|
}
|
||||||
.octicon-git-merge {
|
&.purple {
|
||||||
color: #a333c8;
|
color: #a333c8;
|
||||||
}
|
}
|
||||||
.octicon-pin {
|
&.blue {
|
||||||
color: #2185d0;
|
color: #2185d0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,6 +875,8 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
|
|||||||
log.Error(4, "ChangeStatus: %v", err)
|
log.Error(4, "ChangeStatus: %v", err)
|
||||||
} else {
|
} else {
|
||||||
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed)
|
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed)
|
||||||
|
|
||||||
|
notification.Service.NotifyIssue(issue, ctx.User.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/base"
|
"code.gitea.io/gitea/modules/base"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
"code.gitea.io/gitea/modules/notification"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -415,6 +417,8 @@ func MergePullRequest(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notification.Service.NotifyIssue(pr.Issue, ctx.User.ID)
|
||||||
|
|
||||||
log.Trace("Pull request merged: %d", pr.ID)
|
log.Trace("Pull request merged: %d", pr.ID)
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
|
||||||
}
|
}
|
||||||
@ -707,6 +711,8 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notification.Service.NotifyIssue(pullIssue, ctx.User.ID)
|
||||||
|
|
||||||
log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID)
|
log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID)
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index))
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index))
|
||||||
}
|
}
|
||||||
|
@ -40,25 +40,31 @@
|
|||||||
<i class="blue octicon octicon-pin"></i>
|
<i class="blue octicon octicon-pin"></i>
|
||||||
{{else if $issue.IsPull}}
|
{{else if $issue.IsPull}}
|
||||||
{{if $issue.IsClosed}}
|
{{if $issue.IsClosed}}
|
||||||
<i class="octicon octicon-git-merge"></i>
|
{{if $issue.GetPullRequest.HasMerged}}
|
||||||
|
<i class="purple octicon octicon-git-merge"></i>
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="octicon octicon-git-pull-request"></i>
|
<i class="red octicon octicon-git-pull-request"></i>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<i class="green octicon octicon-git-pull-request"></i>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if $issue.IsClosed}}
|
{{if $issue.IsClosed}}
|
||||||
<i class="octicon octicon-issue-closed"></i>
|
<i class="red octicon octicon-issue-closed"></i>
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="octicon octicon-issue-opened"></i>
|
<i class="green octicon octicon-issue-opened"></i>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td class="twelve wide">
|
<td class="eleven wide">
|
||||||
<a class="item" href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
|
<a class="item" href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}/issues/{{$issue.Index}}">
|
||||||
#{{$issue.Index}} - {{$issue.Title}}
|
#{{$issue.Index}} - {{$issue.Title}}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<a class="item" href="{{AppSubUrl}}/{{$repoOwner.Name}}/{{$repo.Name}}">
|
||||||
{{$repoOwner.Name}}/{{$repo.Name}}
|
{{$repoOwner.Name}}/{{$repo.Name}}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="collapsing">
|
<td class="collapsing">
|
||||||
{{if ne $notification.Status 3}}
|
{{if ne $notification.Status 3}}
|
||||||
|
Loading…
Reference in New Issue
Block a user