Skip to content

Commit 1ddd60c

Browse files
committed
Use views.helpers instead of extending service traits
1 parent 12fe44c commit 1ddd60c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/scala/Plugin.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import gitbucket.core.controller.Context
22
import gitbucket.core.model.Issue
3-
import gitbucket.core.service.{AccountService, IssuesService, RepositoryService}
43
import gitbucket.core.service.RepositoryService.RepositoryInfo
54
import gitbucket.core.util.Implicits.request2Session
65
import gitbucket.notifications._
76
import gitbucket.notifications.model.Watch
8-
import gitbucket.notifications.service.NotificationsService
97
import io.github.gitbucket.solidbase.migration.LiquibaseMigration
108
import io.github.gitbucket.solidbase.model.Version
119

12-
class Plugin extends gitbucket.core.plugin.Plugin
13-
with NotificationsService with RepositoryService with AccountService with IssuesService {
10+
class Plugin extends gitbucket.core.plugin.Plugin {
1411

1512
override val pluginId = "notifications"
1613

@@ -38,8 +35,12 @@ class Plugin extends gitbucket.core.plugin.Plugin
3835
context.loginAccount.map { loginAccount =>
3936
implicit val session = request2Session(context.request)
4037

41-
html.watch(getWatch(repository.owner, repository.name, loginAccount.userName).map(_.notification) getOrElse {
42-
if (autoSubscribeUsersForRepository(repository.owner, repository.name) contains loginAccount.userName) Watch.Watching else Watch.NotWatching
38+
val owner = repository.owner
39+
val name = repository.name
40+
val userName = loginAccount.userName
41+
42+
html.watch(view.helpers.getWatch(owner, name, userName).map(_.notification) getOrElse {
43+
if (view.helpers.autoSubscribeUsersForRepository(owner, name) contains userName) Watch.Watching else Watch.NotWatching
4344
}, repository)(context)
4445
}
4546
}

0 commit comments

Comments
 (0)