mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Show newsfeed of private repo to members of owner group
This commit is contained in:
@@ -8,6 +8,7 @@ class IndexController extends IndexControllerBase
|
|||||||
with RepositoryService with ActivityService with AccountService with UsersAuthenticator
|
with RepositoryService with ActivityService with AccountService with UsersAuthenticator
|
||||||
|
|
||||||
trait IndexControllerBase extends ControllerBase {
|
trait IndexControllerBase extends ControllerBase {
|
||||||
|
|
||||||
self: RepositoryService with ActivityService with AccountService with UsersAuthenticator =>
|
self: RepositoryService with ActivityService with AccountService with UsersAuthenticator =>
|
||||||
|
|
||||||
case class SignInForm(userName: String, password: String)
|
case class SignInForm(userName: String, password: String)
|
||||||
@@ -26,7 +27,13 @@ trait IndexControllerBase extends ControllerBase {
|
|||||||
loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil)
|
loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil)
|
||||||
)
|
)
|
||||||
} else {
|
} 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),
|
getVisibleRepositories(loginAccount, context.baseUrl, withoutPhysicalInfo = true),
|
||||||
loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil)
|
loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ trait ActivityService {
|
|||||||
.take(30)
|
.take(30)
|
||||||
.list
|
.list
|
||||||
|
|
||||||
def getRecentActivitiesByUser(loginUserName : String): List[Activity] =
|
def getRecentActivitiesByOwners(owners : Set[String]): List[Activity] =
|
||||||
Activities
|
Activities
|
||||||
.innerJoin(Repositories).on((t1, t2) => t1.byRepository(t2.userName, t2.repositoryName))
|
.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 }
|
.sortBy { case (t1, t2) => t1.activityId desc }
|
||||||
.map { case (t1, t2) => t1 }
|
.map { case (t1, t2) => t1 }
|
||||||
.take(30)
|
.take(30)
|
||||||
|
|||||||
Reference in New Issue
Block a user