record wiki activity via http (#2521)

This commit is contained in:
onukura
2020-08-23 18:02:01 +09:00
committed by GitHub
parent 5e4d041295
commit 07eb2bc41e

View File

@@ -440,7 +440,9 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
with WebHookService
with AccountService
with RepositoryService
with SystemSettingsService {
with ActivityService
with SystemSettingsService
with RequestCache {
private val logger = LoggerFactory.getLogger(classOf[WikiCommitHook])
@@ -470,6 +472,25 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
case diff if diff.newPath.toLowerCase.endsWith(".md") =>
val action = if (diff.changeType == ChangeType.ADD) "created" else "edited"
val fileName = diff.newPath
updateLastActivityDate(owner, repository)
action match {
case "created" =>
recordCreateWikiPageActivity(
owner,
repository,
commit.committerName,
fileName.dropRight(".md".length)
)
case "edited" =>
recordEditWikiPageActivity(
owner,
repository,
commit.committerName,
fileName.dropRight(".md".length),
commit.id
)
case _ =>
}
(action, fileName, commit.id)
}
}