Skip to content

Commit

Permalink
Misc fixes (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katrix authored and felixoi committed Jan 11, 2019
1 parent 45263f8 commit 35dbf6b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ final class Application @Inject()(forms: OreForms)(
val q = query.fold("%")(qStr => s"%${qStr.toLowerCase}%")

val pageSize = this.config.ore.projects.initLoad
val pageNum = page.getOrElse(1)
val pageNum = math.max(page.getOrElse(1), 1)
val offset = (pageNum - 1) * pageSize

val versionIdsOnPlatform =
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/Users.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Users @Inject()(
val nonce = SingleSignOnConsumer.nonce
this.signOns.add(SignOn.partial(nonce = nonce)) *> redirectToSso(
this.sso.getLoginUrl(this.baseUrl + "/login", nonce)
)
).map(_.flashing("url" -> returnPath.getOrElse(request.path)))
} else {
// Redirected from SpongeSSO, decode SSO payload and convert to Ore user
this.sso
Expand Down
6 changes: 3 additions & 3 deletions app/db/impl/access/ProjectBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ class ProjectBase(implicit val service: ModelService, env: OreEnv, config: OreCo
_ = checkArgument(isAvailable, "slug not available", "")
res <- {
this.fileManager.renameProject(project.ownerName, project.name, newName)
service.update(project.copy(name = newName, slug = newSlug))
val renameModel = service.update(project.copy(name = newName, slug = newSlug))

// Project's name alter's the topic title, update it
if (project.topicId.isDefined && forums.isEnabled)
forums.updateProjectTopic(project)
forums.updateProjectTopic(project) <* renameModel
else
IO.pure(false)
renameModel.as(false)
}
} yield res
}
Expand Down
6 changes: 3 additions & 3 deletions app/ore/project/ProjectTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class ProjectTask @Inject()(actorSystem: ActorSystem, config: OreConfig)(
val interval: FiniteDuration = this.config.ore.projects.checkInterval
val draftExpire: Long = this.config.ore.projects.draftExpire.toMillis

private val dayAgo = Timestamp.from(Instant.ofEpochMilli(System.currentTimeMillis() - draftExpire))
private def dayAgo = Timestamp.from(Instant.ofEpochMilli(System.currentTimeMillis() - draftExpire))
private val newFilter = ModelFilter[Project](_.visibility === (Visibility.New: Visibility))
private val createdAtFilter = ModelFilter[Project](_.createdAt < dayAgo)
private val newProjects = service.filter[Project](newFilter && createdAtFilter)
private def createdAtFilter = ModelFilter[Project](_.createdAt < dayAgo)
private def newProjects = service.filter[Project](newFilter && createdAtFilter)

/**
* Starts the task.
Expand Down
1 change: 1 addition & 0 deletions app/ore/project/factory/ProjectFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ trait ProjectFactory {
this
.processPluginUpload(uploadData, owner)
.ensure("error.version.invalidPluginId")(_.data.id.contains(project.pluginId))
.ensure("error.version.illegalVersion")(!_.data.version.contains("recommended"))
.flatMapF { plugin =>
for {
t <- (project.channels.all, project.settings).parTupled
Expand Down
1 change: 1 addition & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ error.org.createLimit = You may only create up to {0} organizations!
error.org.cannotCreate = Unable to create an organization at this time.
error.org.cannotUpdateAvatar = Unable to update avatar at this time.
error.version.invalidPluginId = The uploaded plugin ID must match your project's plugin ID.
error.version.illegalVersion = The name of this version is not allowed.
error.version.duplicate = Found a duplicate file in project. Plugin files may only be uploaded once.
error.version.noDependency.sponge = This project is marked as a Sponge plugin but your uploaded file contains no dependency to Sponge. Please add a dependency to spongeapi and re-upload.
error.version.noDependency.forge = This project is marked as a Forge mod but your uploaded file contains no dependency to Forge. Please add a dependency to forge and re-upload.
Expand Down

0 comments on commit 35dbf6b

Please sign in to comment.