Merge pull request #919 from team-lab/fix-push-commit-url
fix commit url in webhook `push` event.
commit c5da975ceaa56b95f44738c63b4ed7336e604ec4
2 parents 1f3ef96 + d566f64
@Naoki Takezoe Naoki Takezoe authored on 2 Oct 2015
Showing 6 changed files
View
2
■■■
src/main/scala/gitbucket/core/api/ApiCommit.scala
added: List[String],
removed: List[String],
modified: List[String],
author: ApiPersonIdent,
committer: ApiPersonIdent)(repositoryName:RepositoryName){
committer: ApiPersonIdent)(repositoryName:RepositoryName) extends FieldSerializable{
val url = ApiPath(s"/api/v3/${repositoryName.fullName}/commits/${id}")
val html_url = ApiPath(s"/${repositoryName.fullName}/commit/${id}")
}
 
View
40
src/main/scala/gitbucket/core/api/ApiPushCommit.scala 0 → 100644
package gitbucket.core.api
 
import gitbucket.core.util.JGitUtil
import gitbucket.core.util.JGitUtil.CommitInfo
import gitbucket.core.util.RepositoryName
 
import org.eclipse.jgit.diff.DiffEntry
import org.eclipse.jgit.api.Git
 
import java.util.Date
 
/**
* https://developer.github.com/v3/activity/events/types/#pushevent
*/
case class ApiPushCommit(
id: String,
message: String,
timestamp: Date,
added: List[String],
removed: List[String],
modified: List[String],
author: ApiPersonIdent,
committer: ApiPersonIdent)(repositoryName:RepositoryName) extends FieldSerializable {
val url = ApiPath(s"/${repositoryName.fullName}/commit/${id}")
}
 
object ApiPushCommit{
def apply(commit: ApiCommit, repositoryName: RepositoryName): ApiPushCommit = ApiPushCommit(
id = commit.id,
message = commit.message,
timestamp = commit.timestamp,
added = commit.added,
removed = commit.removed,
modified = commit.modified,
author = commit.author,
committer = commit.committer)(repositoryName)
def apply(git: Git, repositoryName: RepositoryName, commit: CommitInfo): ApiPushCommit =
ApiPushCommit(ApiCommit(git, repositoryName, commit), repositoryName)
}
View
src/main/scala/gitbucket/core/api/FieldSerializable.scala 0 → 100644
View
src/main/scala/gitbucket/core/api/JsonFormat.scala
View
src/main/scala/gitbucket/core/service/WebHookService.scala
View
src/test/scala/gitbucket/core/api/JsonFormatSpec.scala