Skip to content

Commit

Permalink
Merge pull request #686 from SpongePowered/fix/pages
Browse files Browse the repository at this point in the history
Fix pages
  • Loading branch information
felixoi authored Oct 10, 2018
2 parents 1767ebf + 6f67e53 commit 5f85dd1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions app/controllers/project/Projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import db.{ModelService, ObjectReference}
import discourse.OreDiscourseApi
import form.OreForms
import form.project.{DiscussionReplyForm, FlagForm, ProjectRoleSetBuilder}
import models.project.{Note, Page, Visibility}
import models.project.{Note, Visibility}
import models.user._
import models.viewhelper.ScopedOrganizationData
import ore.permission._
Expand Down Expand Up @@ -226,7 +226,12 @@ class Projects @Inject()(stats: StatTracker, forms: OreForms, factory: ProjectFa
* @return View of project
*/
def show(author: String, slug: String): Action[AnyContent] = ProjectAction(author, slug).async { implicit request =>
Future.successful(Redirect(routes.Pages.show(author, slug, Page.homeName)))
projects.queryProjectPages(request.project).flatMap { pages =>
val pageCount = pages.size + pages.map(_._2.size).sum
this.stats.projectViewed(
Ok(views.pages.view(request.data, request.scoped, pages, request.project.homePage, None, pageCount))
)
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/controllers/project/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ class Versions @Inject()(stats: StatTracker, forms: OreForms, factory: ProjectFa
// Found a pending project, create it with first version
pendingProject.complete
.flatTap { created =>
created._1.homePage
UserActionLogger.log(request, LoggedAction.ProjectCreated, created._1.id.value, "created", "null")
}
.flatTap(created => addUnstableTag(created._2, versionData.unstable))
Expand Down
5 changes: 3 additions & 2 deletions app/db/impl/schema/PageSchema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class PageSchema(override val service: ModelService)
this.service.find[Page](
this.modelClass,
p =>
p.projectId === page.projectId && p.name.toLowerCase === page.name.toLowerCase
&& page.parentId.isDefined && page.parentId.fold(true: Rep[Boolean])(p.parentId.get === _)
p.projectId === page.projectId && p.name.toLowerCase === page.name.toLowerCase && page.parentId.fold(
true: Rep[Boolean]
)(p.parentId.get === _)
)

}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name := "ore"
version := "1.6.16"
version := "1.6.17"

lazy val `ore` = (project in file(".")).enablePlugins(PlayScala)

Expand Down

0 comments on commit 5f85dd1

Please sign in to comment.