mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
Add TODO to retrieving the current timestamp.
This commit is contained in:
@@ -38,7 +38,7 @@ trait AccountControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
post("/:userName/_edit", form)(ownerOnly { form =>
|
post("/:userName/_edit", form)(ownerOnly { form =>
|
||||||
val userName = params("userName")
|
val userName = params("userName")
|
||||||
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis) // TODO make a common function to get the current timestamp.
|
||||||
updateAccount(getAccountByUserName(userName).get.copy(
|
updateAccount(getAccountByUserName(userName).get.copy(
|
||||||
mailAddress = form.mailAddress,
|
mailAddress = form.mailAddress,
|
||||||
url = form.url,
|
url = form.url,
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
getMilestone(owner, repository, milestoneId) match {
|
getMilestone(owner, repository, milestoneId) match {
|
||||||
case None => NotFound()
|
case None => NotFound()
|
||||||
case Some(m) => {
|
case Some(m) => {
|
||||||
val currentDate = new Timestamp(System.currentTimeMillis) // TODO move to trait?
|
// TODO make a common function to get the current timestamp.
|
||||||
|
val currentDate = new Timestamp(System.currentTimeMillis)
|
||||||
updateMilestone(m.copy(closedDate = Some(currentDate)))
|
updateMilestone(m.copy(closedDate = Some(currentDate)))
|
||||||
redirect("/%s/%s/issues/milestones".format(owner, repository))
|
redirect("/%s/%s/issues/milestones".format(owner, repository))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
|||||||
})
|
})
|
||||||
|
|
||||||
post("/admin/users/_new", newForm)(adminOnly { form =>
|
post("/admin/users/_new", newForm)(adminOnly { form =>
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
createAccount(Account(
|
createAccount(Account(
|
||||||
userName = form.userName,
|
userName = form.userName,
|
||||||
@@ -57,6 +58,7 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
|||||||
|
|
||||||
post("/admin/users/:name/_edit", editForm)(adminOnly { form =>
|
post("/admin/users/:name/_edit", editForm)(adminOnly { form =>
|
||||||
val userName = params("userName")
|
val userName = params("userName")
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
updateAccount(getAccountByUserName(userName).get.copy(
|
updateAccount(getAccountByUserName(userName).get.copy(
|
||||||
password = form.password,
|
password = form.password,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ trait AccountService {
|
|||||||
account.lastLoginDate)
|
account.lastLoginDate)
|
||||||
|
|
||||||
def updateLastLoginDate(userName: String): Unit =
|
def updateLastLoginDate(userName: String): Unit =
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
|
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
|
||||||
.update(new java.sql.Timestamp(System.currentTimeMillis))
|
.update(new java.sql.Timestamp(System.currentTimeMillis))
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ trait RepositoryService { self: AccountService =>
|
|||||||
|
|
||||||
// TODO insert default labels.
|
// TODO insert default labels.
|
||||||
|
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
|
|
||||||
Repositories insert
|
Repositories insert
|
||||||
@@ -159,6 +160,7 @@ trait RepositoryService { self: AccountService =>
|
|||||||
* Updates the last activity date of the repository.
|
* Updates the last activity date of the repository.
|
||||||
*/
|
*/
|
||||||
def updateLastActivityDate(userName: String, repositoryName: String): Unit =
|
def updateLastActivityDate(userName: String, repositoryName: String): Unit =
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
Query(Repositories)
|
Query(Repositories)
|
||||||
.filter { r => (r.userName is userName.bind) && (r.repositoryName is repositoryName.bind) }
|
.filter { r => (r.userName is userName.bind) && (r.repositoryName is repositoryName.bind) }
|
||||||
.map { _.lastActivityDate }
|
.map { _.lastActivityDate }
|
||||||
@@ -169,6 +171,7 @@ trait RepositoryService { self: AccountService =>
|
|||||||
*/
|
*/
|
||||||
def saveRepositoryOptions(userName: String, repositoryName: String,
|
def saveRepositoryOptions(userName: String, repositoryName: String,
|
||||||
description: Option[String], defaultBranch: String, isPrivate: Boolean): Unit =
|
description: Option[String], defaultBranch: String, isPrivate: Boolean): Unit =
|
||||||
|
// TODO make a common function to get the current timestamp.
|
||||||
Query(Repositories)
|
Query(Repositories)
|
||||||
.filter { r => (r.userName is userName.bind) && (r.repositoryName is repositoryName.bind) }
|
.filter { r => (r.userName is userName.bind) && (r.repositoryName is repositoryName.bind) }
|
||||||
.map { r => r.description.? ~ r.defaultBranch ~ r.isPrivate ~ r.updatedDate }
|
.map { r => r.description.? ~ r.defaultBranch ~ r.isPrivate ~ r.updatedDate }
|
||||||
|
|||||||
Reference in New Issue
Block a user