diff options
author | Unknwon <u@gogs.io> | 2015-09-02 16:18:09 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-02 16:18:09 -0400 |
commit | 83dc2468f574e9cf83515e54268bdb4c03f6d98c (patch) | |
tree | 03499c31d850c1c0e4cb063b9cc70f9c1d2a063b /models/action.go | |
parent | 842770d7fbc72789d6df885da7ec5a2d4070f25f (diff) | |
download | gitea-83dc2468f574e9cf83515e54268bdb4c03f6d98c.tar.gz gitea-83dc2468f574e9cf83515e54268bdb4c03f6d98c.zip |
finish initial version of pull request
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go index 1f6f25496b..d1f0be4a78 100644 --- a/models/action.go +++ b/models/action.go @@ -27,16 +27,17 @@ import ( type ActionType int const ( - CREATE_REPO ActionType = iota + 1 // 1 - RENAME_REPO // 2 - STAR_REPO // 3 - FOLLOW_REPO // 4 - COMMIT_REPO // 5 - CREATE_ISSUE // 6 - PULL_REQUEST // 7 - TRANSFER_REPO // 8 - PUSH_TAG // 9 - COMMENT_ISSUE // 10 + CREATE_REPO ActionType = iota + 1 // 1 + RENAME_REPO // 2 + STAR_REPO // 3 + FOLLOW_REPO // 4 + COMMIT_REPO // 5 + CREATE_ISSUE // 6 + CREATE_PULL_REQUEST // 7 + TRANSFER_REPO // 8 + PUSH_TAG // 9 + COMMENT_ISSUE // 10 + MERGE_PULL_REQUEST // 11 ) var ( @@ -526,6 +527,25 @@ func TransferRepoAction(actUser, oldOwner, newOwner *User, repo *Repository) err return transferRepoAction(x, actUser, oldOwner, newOwner, repo) } +func mergePullRequestAction(e Engine, actUser *User, repo *Repository, pull *Issue) error { + return notifyWatchers(e, &Action{ + ActUserID: actUser.Id, + ActUserName: actUser.Name, + ActEmail: actUser.Email, + OpType: MERGE_PULL_REQUEST, + Content: fmt.Sprintf("%d|%s", pull.Index, pull.Name), + RepoID: repo.ID, + RepoUserName: repo.Owner.Name, + RepoName: repo.Name, + IsPrivate: repo.IsPrivate, + }) +} + +// MergePullRequestAction adds new action for merging pull request. +func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error { + return mergePullRequestAction(x, actUser, repo, pull) +} + // GetFeeds returns action list of given user in given context. func GetFeeds(uid, offset int64, isProfile bool) ([]*Action, error) { actions := make([]*Action, 0, 20) |