mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Show newsfeed of private repo to its owner
This commit is contained in:
@@ -20,10 +20,17 @@ trait IndexControllerBase extends ControllerBase {
|
|||||||
get("/"){
|
get("/"){
|
||||||
val loginAccount = context.loginAccount
|
val loginAccount = context.loginAccount
|
||||||
|
|
||||||
|
if(loginAccount.isEmpty) {
|
||||||
html.index(getRecentActivities(),
|
html.index(getRecentActivities(),
|
||||||
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)
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
html.index(getRecentActivitiesByUser(loginAccount.get.userName),
|
||||||
|
getVisibleRepositories(loginAccount, context.baseUrl, withoutPhysicalInfo = true),
|
||||||
|
loginAccount.map{ account => getUserRepositories(account.userName, context.baseUrl, withoutPhysicalInfo = true) }.getOrElse(Nil)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get("/signin"){
|
get("/signin"){
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package service
|
|||||||
import model._
|
import model._
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
import Database.threadLocalSession
|
import Database.threadLocalSession
|
||||||
|
import util.JGitUtil.RepositoryInfo
|
||||||
|
|
||||||
trait ActivityService {
|
trait ActivityService {
|
||||||
|
|
||||||
@@ -30,6 +31,14 @@ trait ActivityService {
|
|||||||
.take(30)
|
.take(30)
|
||||||
.list
|
.list
|
||||||
|
|
||||||
|
def getRecentActivitiesByUser(loginUserName : 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) }
|
||||||
|
.sortBy { case (t1, t2) => t1.activityId desc }
|
||||||
|
.map { case (t1, t2) => t1 }
|
||||||
|
.take(30)
|
||||||
|
.list
|
||||||
|
|
||||||
def recordCreateRepositoryActivity(userName: String, repositoryName: String, activityUserName: String): Unit =
|
def recordCreateRepositoryActivity(userName: String, repositoryName: String, activityUserName: String): Unit =
|
||||||
Activities.autoInc insert(userName, repositoryName, activityUserName,
|
Activities.autoInc insert(userName, repositoryName, activityUserName,
|
||||||
|
|||||||
Reference in New Issue
Block a user