@@ -3,17 +3,19 @@ package gitbucket.notifications.controller
33import gitbucket .core .controller .ControllerBase
44import gitbucket .core .service .{AccountService , IssuesService , RepositoryService }
55import gitbucket .core .util .Implicits ._
6- import gitbucket .core .util .ReadableUsersAuthenticator
6+ import gitbucket .core .util .{ OneselfAuthenticator , ReadableUsersAuthenticator }
77import gitbucket .core .util .SyntaxSugars ._
88import gitbucket .notifications .model .Watch
99import gitbucket .notifications .service .NotificationsService
1010import org .scalatra .Ok
1111
1212class NotificationsController extends NotificationsControllerBase
13- with NotificationsService with RepositoryService with AccountService with IssuesService with ReadableUsersAuthenticator
13+ with NotificationsService with RepositoryService with AccountService with IssuesService
14+ with ReadableUsersAuthenticator with OneselfAuthenticator
1415
1516trait NotificationsControllerBase extends ControllerBase {
16- self : NotificationsService with RepositoryService with AccountService with IssuesService with ReadableUsersAuthenticator =>
17+ self : NotificationsService with RepositoryService with AccountService with IssuesService
18+ with ReadableUsersAuthenticator with OneselfAuthenticator =>
1719
1820 ajaxPost(" /:owner/:repository/watch" )(readableUsersOnly { repository =>
1921 params.get(" notification" ).flatMap(Watch .Notification .valueOf).map { notification =>
@@ -33,4 +35,11 @@ trait NotificationsControllerBase extends ControllerBase {
3335 }
3436 })
3537
38+ get(" /:userName/_notifications" )(oneselfOnly {
39+ val userName = params(" userName" )
40+ getAccountByUserName(userName).map { account =>
41+ gitbucket.notifications.html.settings(disableEmail(account.userName))
42+ } getOrElse NotFound ()
43+ })
44+
3645}
0 commit comments