diff --git a/src/main/scala/app/IndexController.scala b/src/main/scala/app/IndexController.scala index 5742d02..8942d82 100644 --- a/src/main/scala/app/IndexController.scala +++ b/src/main/scala/app/IndexController.scala @@ -8,6 +8,7 @@ with RepositoryService with ActivityService with AccountService with UsersAuthenticator trait IndexControllerBase extends ControllerBase { + self: RepositoryService with ActivityService with AccountService with UsersAuthenticator => case class SignInForm(userName: String, password: String) @@ -26,7 +27,13 @@ loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil) ) } else { - html.index(getRecentActivitiesByUser(loginAccount.get.userName), + val loginUserName = loginAccount.get.userName + val loginUserGroups = getGroupsByUserName(loginUserName) + var visibleOwnerSet : Set[String] = Set(loginUserName) + + visibleOwnerSet ++= loginUserGroups + + html.index(getRecentActivitiesByOwners(visibleOwnerSet), getVisibleRepositories(loginAccount, context.baseUrl, withoutPhysicalInfo = true), loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil) ) diff --git a/src/main/scala/service/ActivityService.scala b/src/main/scala/service/ActivityService.scala index 34a0105..df95f16 100644 --- a/src/main/scala/service/ActivityService.scala +++ b/src/main/scala/service/ActivityService.scala @@ -31,10 +31,10 @@ .take(30) .list - def getRecentActivitiesByUser(loginUserName : String): List[Activity] = + def getRecentActivitiesByOwners(owners : Set[String]): List[Activity] = Activities .innerJoin(Repositories).on((t1, t2) => t1.byRepository(t2.userName, t2.repositoryName)) - .filter { case (t1, t2) => (t2.isPrivate is false.bind) || (t2.userName is loginUserName.bind) } + .filter { case (t1, t2) => (t2.isPrivate is false.bind) || (t2.userName inSetBind owners) } .sortBy { case (t1, t2) => t1.activityId desc } .map { case (t1, t2) => t1 } .take(30)