diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/ArtifactSelection.scala b/modules/core/shared/src/main/scala/scaladex/core/model/ArtifactSelection.scala index 8314f97ff..f3d77cfa5 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/ArtifactSelection.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/ArtifactSelection.scala @@ -14,17 +14,20 @@ case class ArtifactSelection( ( // default artifact (ex: akka-actors is the default for akka/akka) project.settings.defaultArtifact.contains(artifact.artifactName), + // not deprecated + !project.settings.deprecatedArtifacts.contains(artifact.artifactName), // project repository (ex: shapeless) project.repository.value == artifact.artifactName.value, // alphabetically artifact.artifactName, // stable version first - project.settings.defaultStableVersion && artifact.version.preRelease.isDefined, + project.settings.preferStableVersion && artifact.version.preRelease.isDefined, artifact.version, artifact.binaryVersion ) }( - Ordering.Tuple6( + Ordering.Tuple7( + Ordering[Boolean], Ordering[Boolean], Ordering[Boolean], Ordering[Artifact.Name].reverse, @@ -42,18 +45,21 @@ case class ArtifactSelection( ( // default artifact (ex: akka-actors is the default for akka/akka) project.settings.defaultArtifact.contains(artifact.artifactName), + // not deprecated + !project.settings.deprecatedArtifacts.contains(artifact.artifactName), // project repository (ex: shapeless) project.repository.value == artifact.artifactName.value, // alphabetically artifact.artifactName, // stable version first - project.settings.defaultStableVersion && artifact.version.preRelease.isDefined, + project.settings.preferStableVersion && artifact.version.preRelease.isDefined, artifact.version, artifact.binaryVersion ) }( Ordering - .Tuple6( + .Tuple7( + Ordering[Boolean], Ordering[Boolean], Ordering[Boolean], Ordering[Artifact.Name].reverse, diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/DocumentationPattern.scala b/modules/core/shared/src/main/scala/scaladex/core/model/DocumentationPattern.scala index 4968cbaa2..5e82d7f4e 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/DocumentationPattern.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/DocumentationPattern.scala @@ -1,7 +1,7 @@ package scaladex.core.model final case class DocumentationPattern(label: String, pattern: String) { - def eval: Option[DocumentationLink] = + def asGlobal: Option[DocumentationLink] = if (DocumentationPattern.placeholders.exists(pattern.contains)) None else Some(DocumentationLink(label, pattern)) diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/GithubInfo.scala b/modules/core/shared/src/main/scala/scaladex/core/model/GithubInfo.scala index 0436be338..bed5974f1 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/GithubInfo.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/GithubInfo.scala @@ -41,7 +41,6 @@ case class GithubInfo( topics: Set[String], contributingGuide: Option[Url], codeOfConduct: Option[Url], - chatroom: Option[Url], openIssues: Seq[GithubIssue], // right now it's all issues, not only beginners issues scalaPercentage: Option[Int], license: Option[License], @@ -57,7 +56,6 @@ case class GithubInfo( openIssues = openIssues, topics = topics.toSeq, contributingGuide = contributingGuide, - chatroom = chatroom, codeOfConduct = codeOfConduct, stars = stars, forks = forks, @@ -84,7 +82,6 @@ object GithubInfo { topics = Set(), contributingGuide = None, codeOfConduct = None, - chatroom = None, openIssues = Seq(), scalaPercentage = None, license = None, diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/Project.scala b/modules/core/shared/src/main/scala/scaladex/core/model/Project.scala index 70a58a141..b79d254a0 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/Project.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/Project.scala @@ -44,8 +44,8 @@ case class Project( .orElse(artifact.defaultScaladoc.map(DocumentationLink("Scaladoc", _))) def globalDocumentation: Seq[DocumentationLink] = - settings.customScalaDoc.flatMap(DocumentationPattern("Scaladoc", _).eval).toSeq ++ - settings.documentationLinks.flatMap(_.eval) + settings.customScalaDoc.flatMap(DocumentationPattern("Scaladoc", _).asGlobal).toSeq ++ + settings.documentationLinks.flatMap(_.asGlobal) def artifactDocumentation(artifact: Artifact): Seq[DocumentationLink] = scaladoc(artifact).toSeq ++ settings.documentationLinks.map(_.eval(artifact)) @@ -84,21 +84,19 @@ object Project { githubStatus = githubInfo.map(_ => GithubStatus.Ok(now)).getOrElse(GithubStatus.Unknown(now)), githubInfo = githubInfo, creationDate = creationDate, - settings = settings.getOrElse(Settings.default) + settings = settings.getOrElse(Settings.empty) ) case class Settings( - defaultStableVersion: Boolean, + preferStableVersion: Boolean, defaultArtifact: Option[Artifact.Name], - strictVersions: Boolean, customScalaDoc: Option[String], documentationLinks: Seq[DocumentationPattern], - deprecated: Boolean, contributorsWanted: Boolean, - artifactDeprecations: Set[Artifact.Name], + deprecatedArtifacts: Set[Artifact.Name], cliArtifacts: Set[Artifact.Name], category: Option[Category], - beginnerIssuesLabel: Option[String] + chatroom: Option[String] ) case class Organization private (value: String) extends AnyVal { @@ -117,18 +115,16 @@ object Project { } object Settings { - val default: Settings = Settings( - defaultStableVersion = true, + val empty: Settings = Settings( + preferStableVersion = true, defaultArtifact = None, - strictVersions = false, customScalaDoc = None, documentationLinks = List(), - deprecated = false, contributorsWanted = false, - artifactDeprecations = Set(), + deprecatedArtifacts = Set(), cliArtifacts = Set(), category = None, - beginnerIssuesLabel = None + chatroom = None ) } } diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/search/GithubInfoDocument.scala b/modules/core/shared/src/main/scala/scaladex/core/model/search/GithubInfoDocument.scala index 7549d547e..f71651198 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/search/GithubInfoDocument.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/search/GithubInfoDocument.scala @@ -11,7 +11,6 @@ case class GithubInfoDocument( openIssues: Seq[GithubIssue], topics: Seq[String], contributingGuide: Option[Url], - chatroom: Option[Url], codeOfConduct: Option[Url], stars: Option[Int], forks: Option[Int], @@ -22,6 +21,6 @@ case class GithubInfoDocument( ) object GithubInfoDocument { - def default: GithubInfoDocument = - GithubInfoDocument(None, None, None, Seq.empty, Seq.empty, None, None, None, None, None, 0, None, None, None) + def empty: GithubInfoDocument = + GithubInfoDocument(None, None, None, Seq.empty, Seq.empty, None, None, None, None, 0, None, None, None) } diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectDocument.scala b/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectDocument.scala index e09701ffa..b4f2508d3 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectDocument.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectDocument.scala @@ -67,7 +67,7 @@ object ProjectDocument { .map(_.artifactName) .distinct .sorted - .partition(project.settings.artifactDeprecations.contains) + .partition(project.settings.deprecatedArtifacts.contains) import project._ ProjectDocument( organization, diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectHit.scala b/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectHit.scala index aa161f30a..aac29b2ea 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectHit.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/search/ProjectHit.scala @@ -7,9 +7,9 @@ import scaladex.core.model.GithubIssue */ final case class ProjectHit( document: ProjectDocument, - beginnerIssueHits: Seq[GithubIssue] + issues: Seq[GithubIssue] ) { def displayedIssues: Seq[GithubIssue] = - if (beginnerIssueHits.nonEmpty) beginnerIssueHits + if (issues.nonEmpty) issues else document.githubInfo.toSeq.flatMap(_.openIssues) } diff --git a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala index 08163b2cd..f0d8e415f 100644 --- a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala +++ b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala @@ -74,17 +74,15 @@ object Values { contributors = Seq(contributor("olafurpg"), contributor("scala-steward")) ) val settings: Settings = Settings( - defaultStableVersion = false, + preferStableVersion = false, defaultArtifact = None, - strictVersions = false, customScalaDoc = None, documentationLinks = List(), - deprecated = false, contributorsWanted = false, - artifactDeprecations = Set(), + deprecatedArtifacts = Set(), cliArtifacts = Set(), category = Some(Category.LintingAndRefactoring), - beginnerIssuesLabel = None + chatroom = None ) val project: Project = Project.default(reference, None, Some(githubInfo), Some(settings), now = now) @@ -118,11 +116,10 @@ object Values { Scope("compile") ) val githubInfo: GithubInfo = GithubInfo.empty - val settings: Project.Settings = - Project.Settings.default.copy( - defaultArtifact = Some(artifact.artifactName), - category = Some(Category.Json) - ) + val settings: Project.Settings = Project.Settings.empty.copy( + defaultArtifact = Some(artifact.artifactName), + category = Some(Category.Json) + ) } object Cats { @@ -136,7 +133,6 @@ object Values { stars = Some(4337), forks = Some(1081), contributingGuide = Some(Url("https://github.com/typelevel/cats/blob/main/CONTRIBUTING.md")), - chatroom = Some(Url("https://gitter.im/typelevel/cats")), openIssues = List(issueAboutFoo, issueAboutBar), contributors = Seq(contributor("travisbrown"), contributor("ceedub"), contributor("kailuowang")), commitActivity = Seq(GithubCommitActivity(25, Instant.now, IndexedSeq(0, 3, 4, 0, 5, 6, 7))) diff --git a/modules/infra/src/it/scala/scaladex/infra/GithubClientImplTests.scala b/modules/infra/src/it/scala/scaladex/infra/GithubClientImplTests.scala index 34ae555db..0e8e2cb8d 100644 --- a/modules/infra/src/it/scala/scaladex/infra/GithubClientImplTests.scala +++ b/modules/infra/src/it/scala/scaladex/infra/GithubClientImplTests.scala @@ -56,10 +56,6 @@ class GithubClientImplTests extends AsyncFunSpec with Matchers { for (openIssues <- client.getOpenIssues(Scalafix.reference)) yield openIssues should not be empty } - it("getGitterChatRoom") { - for (chatroom <- client.getGitterChatRoom(Scalafix.reference)) - yield chatroom shouldBe defined - } it("should return moved project") { val reference = Project.Reference.from("rickynils", "scalacheck") diff --git a/modules/infra/src/main/resources/migrations/V19__alter_project_settings.sql b/modules/infra/src/main/resources/migrations/V19__alter_project_settings.sql new file mode 100644 index 000000000..bb110dad0 --- /dev/null +++ b/modules/infra/src/main/resources/migrations/V19__alter_project_settings.sql @@ -0,0 +1,11 @@ +ALTER TABLE project_settings RENAME COLUMN default_stable_version TO prefer_stable_version; +ALTER TABLE project_settings RENAME COLUMN artifact_deprecations TO deprecated_artifacts; + +ALTER TABLE project_settings + DROP COLUMN strict_versions, + DROP COLUMN deprecated, + DROP COLUMN primary_topic, + DROP COLUMN beginner_issues_label, + ADD chatroom VARCHAR(2083); + +ALTER TABLE github_info DROP COLUMN chatroom; diff --git a/modules/infra/src/main/scala/scaladex/infra/ElasticsearchEngine.scala b/modules/infra/src/main/scala/scaladex/infra/ElasticsearchEngine.scala index f24ca410b..1d7923a3a 100644 --- a/modules/infra/src/main/scala/scaladex/infra/ElasticsearchEngine.scala +++ b/modules/infra/src/main/scala/scaladex/infra/ElasticsearchEngine.scala @@ -447,7 +447,6 @@ class ElasticsearchEngine(esClient: ElasticClient, index: String)(implicit ec: E existsQuery("githubInfo.openIssues") ), existsQuery("githubInfo.contributingGuide"), - existsQuery("githubInfo.chatroom") ) ) diff --git a/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala b/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala index 4c63e082a..05d1adb77 100644 --- a/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala +++ b/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala @@ -85,7 +85,6 @@ class GithubClientImpl(token: Secret)(implicit val system: ActorSystem) communityProfile <- getCommunityProfile(repo.ref) contributors <- getContributors(repo.ref) openIssues <- getOpenIssues(repo.ref) - chatroom <- getGitterChatRoom(repo.ref) scalaPercentage <- getPercentageOfLanguage(repo.ref, language = "Scala") commitActivity <- getCommitActivity(repo.ref) } yield GithubInfo( @@ -103,7 +102,6 @@ class GithubClientImpl(token: Secret)(implicit val system: ActorSystem) topics = repo.topics.toSet, contributingGuide = communityProfile.flatMap(_.contributingFile).map(Url), codeOfConduct = communityProfile.flatMap(_.codeOfConductFile).map(Url), - chatroom = chatroom.map(Url), openIssues = openIssues.map(_.toGithubIssue).toList, scalaPercentage = Option(scalaPercentage), license = repo.licenseName.flatMap(License.get), @@ -212,22 +210,6 @@ class GithubClientImpl(token: Secret)(implicit val system: ActorSystem) get[Seq[GithubCommitActivity]](request).fallbackTo(Future.successful(Seq.empty)) } - def getGitterChatRoom(ref: Project.Reference): Future[Option[String]] = { - val uri = s"https://gitter.im/$ref" - val request = HttpRequest(uri = uri) - Http().singleRequest(request).map { - case HttpResponse(StatusCodes.OK, _, entity, _) => - entity.discardBytes() - Some(uri) - case HttpResponse(StatusCodes.Redirection(_), _, entity, _) => - entity.discardBytes() - Some(uri) - case resp => - resp.entity.discardBytes() - None - } - } - def getUserOrganizations(user: String): Future[Seq[Project.Organization]] = getAllRecursively(getUserOrganizationsPage(user)) diff --git a/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala b/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala index b7a4624be..076b1f930 100644 --- a/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala +++ b/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala @@ -250,7 +250,7 @@ class SqlDatabase(datasource: HikariDataSource, xa: doobie.Transactor[IO]) exten oldProject <- getProject(ref) _ <- updateGithubStatus(ref, status) _ <- run(ProjectTable.insertIfNotExists.run((status.destination, GithubStatus.Ok(status.updateDate)))) - _ <- updateProjectSettings(status.destination, oldProject.map(_.settings).getOrElse(Project.Settings.default)) + _ <- updateProjectSettings(status.destination, oldProject.map(_.settings).getOrElse(Project.Settings.empty)) _ <- run(GithubInfoTable.insertOrUpdate.run(status.destination, githubInfo, githubInfo)) } yield () diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/DoobieUtils.scala b/modules/infra/src/main/scala/scaladex/infra/sql/DoobieUtils.scala index d2455ee2b..f24779628 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/DoobieUtils.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/DoobieUtils.scala @@ -241,7 +241,7 @@ object DoobieUtils { githubStatus = githubStatus, githubInfo = githubInfo, creationDate = creationDate, - settings = settings.getOrElse(Project.Settings.default) + settings = settings.getOrElse(Project.Settings.empty) ) } diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/GithubInfoTable.scala b/modules/infra/src/main/scala/scaladex/infra/sql/GithubInfoTable.scala index 423069d7e..dfedd9c8b 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/GithubInfoTable.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/GithubInfoTable.scala @@ -24,7 +24,6 @@ object GithubInfoTable { "topics", "contributing_guide", "code_of_conduct", - "chatroom", "open_issues", "scala_percentage", "license", diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/ProjectSettingsTable.scala b/modules/infra/src/main/scala/scaladex/infra/sql/ProjectSettingsTable.scala index 0bfdb3beb..27cb7d58a 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/ProjectSettingsTable.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/ProjectSettingsTable.scala @@ -10,17 +10,15 @@ object ProjectSettingsTable { val referenceFields: Seq[String] = Seq("organization", "repository") val settingsFields: Seq[String] = Seq( - "default_stable_version", + "prefer_stable_version", "default_artifact", - "strict_versions", "custom_scaladoc", "documentation_links", - "deprecated", "contributors_wanted", - "artifact_deprecations", + "deprecated_artifacts", "cli_artifacts", "category", - "beginner_issues_label" + "chatroom" ) val insertOrUpdate: Update[(Project.Reference, Project.Settings, Project.Settings)] = diff --git a/modules/infra/src/test/scala/scaladex/infra/ElasticsearchEngineTests.scala b/modules/infra/src/test/scala/scaladex/infra/ElasticsearchEngineTests.scala index f1dd88feb..e62fa3d5c 100644 --- a/modules/infra/src/test/scala/scaladex/infra/ElasticsearchEngineTests.scala +++ b/modules/infra/src/test/scala/scaladex/infra/ElasticsearchEngineTests.scala @@ -90,7 +90,7 @@ class ElasticsearchEngineTests extends AsyncFreeSpec with Matchers with BeforeAn for { _ <- insertAll(projects) hits <- searchEngine.find(params, pageParams) - } yield hits.items.flatMap(_.beginnerIssueHits) should contain theSameElementsAs expected + } yield hits.items.flatMap(_.issues) should contain theSameElementsAs expected } "count by topics" in { @@ -173,7 +173,7 @@ class ElasticsearchEngineTests extends AsyncFreeSpec with Matchers with BeforeAn } private def projectDocument(ref: String, stars: Int, scalaPercentage: Int): ProjectDocument = { - val githubInfo = GithubInfoDocument.default.copy(stars = Some(stars), scalaPercentage = Some(scalaPercentage)) + val githubInfo = GithubInfoDocument.empty.copy(stars = Some(stars), scalaPercentage = Some(scalaPercentage)) ProjectDocument.default(Project.Reference.from(ref)).copy(githubInfo = Some(githubInfo)) } diff --git a/modules/server/src/main/assets/css/partials/_project.scss b/modules/server/src/main/assets/css/partials/_project.scss index b2b712181..533bf5428 100644 --- a/modules/server/src/main/assets/css/partials/_project.scss +++ b/modules/server/src/main/assets/css/partials/_project.scss @@ -92,20 +92,6 @@ margin-left: 5px; } } - - .project-contributing-info { - a { - display: block; - padding-bottom: 10px; - color: $gray; - &:hover, - &:focus { - color: $brand-primary; - text-decoration: underline; - } - } - td {padding-left: 30px;} - } .commit-activities { canvas.commit-activity { @@ -138,7 +124,7 @@ } } - .collaborators { + .contributors { ul { li { margin: 0 6px 6px 0; @@ -152,7 +138,7 @@ } } } - .more-collaborators { + .more-contributors { padding-top: 15px; } } @@ -180,13 +166,6 @@ } } - .deprecated-project { - background-color: #FFF8C5; - font-size: 22px; - text-align: center; - color: $gray-darker; - } - .install { .nav-tabs>li>a { background: transparent; diff --git a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala index c21a8e861..4bdaae5d8 100644 --- a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala +++ b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala @@ -291,40 +291,27 @@ class ProjectPages(env: Env, database: WebDatabase, searchEngine: SearchEngine)( } } - // TODO remove all unused parameters private val editForm: Directive1[Project.Settings] = formFieldSeq.tflatMap(fields => formFields( - "contributorsWanted".as[Boolean] ? false, - "defaultArtifact".?, - "defaultStableVersion".as[Boolean] ? false, - "strictVersions".as[Boolean] ? false, - "deprecated".as[Boolean] ? false, - "artifactDeprecations".as[String].*, - "cliArtifacts".as[String].*, - "customScalaDoc".?, "category".?, - "beginnerIssuesLabel".?, - "selectedBeginnerIssues".as[String].*, "chatroom".?, - "contributingGuide".?, - "codeOfConduct".? + "contributorsWanted".as[Boolean].?(false), + "defaultArtifact".?, + "preferStableVersion".as[Boolean].?(false), + "deprecatedArtifacts".as[String].*, + "cliArtifacts".as[String].*, + "customScalaDoc".? ).tmap { case ( + rawCategory, + rawChatroom, contributorsWanted, rawDefaultArtifact, - defaultStableVersion, - strictVersions, - deprecated, - rawArtifactDeprecations, + preferStableVersion, + rawDeprecatedArtifacts, rawCliArtifacts, - rawCustomScalaDoc, - rawCategory, - rawBeginnerIssuesLabel, - _, - _, - _, - _ + rawCustomScalaDoc ) => val documentationLinks = fields._1 @@ -342,18 +329,17 @@ class ProjectPages(env: Env, database: WebDatabase, searchEngine: SearchEngine)( if (value.isEmpty) None else Some(value) val settings: Project.Settings = Project.Settings( - defaultStableVersion, + preferStableVersion, rawDefaultArtifact.flatMap(noneIfEmpty).map(Artifact.Name.apply), - strictVersions, rawCustomScalaDoc.flatMap(noneIfEmpty), documentationLinks, - deprecated, contributorsWanted, - rawArtifactDeprecations.map(Artifact.Name.apply).toSet, + rawDeprecatedArtifacts.map(Artifact.Name.apply).toSet, rawCliArtifacts.map(Artifact.Name.apply).toSet, rawCategory.flatMap(Category.byLabel.get), - rawBeginnerIssuesLabel.flatMap(noneIfEmpty) + rawChatroom.flatMap(noneIfEmpty) ) + println(settings) Tuple1(settings) } ) diff --git a/modules/server/src/main/scala/scaladex/server/route/api/OldSearchApi.scala b/modules/server/src/main/scala/scaladex/server/route/api/OldSearchApi.scala index a6da4c97c..6d6a89161 100644 --- a/modules/server/src/main/scala/scaladex/server/route/api/OldSearchApi.scala +++ b/modules/server/src/main/scala/scaladex/server/route/api/OldSearchApi.scala @@ -195,7 +195,7 @@ class OldSearchApi(searchEngine: SearchEngine, database: WebDatabase)( val (deprecatedArtifacts, artifacts) = filteredArtifacts .map(_.artifactName) .distinct - .partition(project.settings.artifactDeprecations.contains) + .partition(project.settings.deprecatedArtifacts.contains) // Sort semantic versions by descending order val versions = filteredArtifacts.map(_.version).distinct.sorted(Ordering[SemanticVersion].reverse) OldSearchApi.ArtifactOptions( diff --git a/modules/server/src/main/scala/scaladex/server/service/AdminService.scala b/modules/server/src/main/scala/scaladex/server/service/AdminService.scala index d93f53c22..8ca6bb917 100644 --- a/modules/server/src/main/scala/scaladex/server/service/AdminService.scala +++ b/modules/server/src/main/scala/scaladex/server/service/AdminService.scala @@ -109,7 +109,7 @@ class AdminService( creationDate = None, GithubStatus.Ok(java.time.Instant.now), githubInfo = Some(info), - settings = Settings.default + settings = Settings.empty ) database .insertProject(project) diff --git a/modules/server/src/main/scala/scaladex/server/service/SearchSynchronizer.scala b/modules/server/src/main/scala/scaladex/server/service/SearchSynchronizer.scala index 7dfc7e447..9f79489e5 100644 --- a/modules/server/src/main/scala/scaladex/server/service/SearchSynchronizer.scala +++ b/modules/server/src/main/scala/scaladex/server/service/SearchSynchronizer.scala @@ -17,7 +17,6 @@ class SearchSynchronizer(database: WebDatabase, searchEngine: SearchEngine)(impl for { allProjects <- database.getAllProjects() allProjectsAndStatus = allProjects.map(p => (p, p.githubStatus)) - deprecatedProjects = allProjects.filter(_.settings.deprecated).map(_.reference).toSet // Create a map of project reference to their old references movedProjects = allProjectsAndStatus @@ -26,13 +25,11 @@ class SearchSynchronizer(database: WebDatabase, searchEngine: SearchEngine)(impl newRef -> p.reference } .groupMap { case (newRef, _) => newRef } { case (_, ref) => ref } - projectsToDelete = deprecatedProjects ++ + projectsToDelete = allProjectsAndStatus.collect { case (p, GithubStatus.NotFound(_)) => p.reference } projectsToSync = allProjectsAndStatus .collect { - case (p, GithubStatus.Ok(_) | GithubStatus.Unknown(_) | GithubStatus.Failed(_, _, _)) - if !deprecatedProjects.contains(p.reference) => - p + case (p, GithubStatus.Ok(_) | GithubStatus.Unknown(_) | GithubStatus.Failed(_, _, _)) => p } _ = logger.info(s"${movedProjects.size} projects were moved") diff --git a/modules/server/src/test/scala/scaladex/server/route/ProjectPagesTests.scala b/modules/server/src/test/scala/scaladex/server/route/ProjectPagesTests.scala index 17baa7cdc..775d097c5 100644 --- a/modules/server/src/test/scala/scaladex/server/route/ProjectPagesTests.scala +++ b/modules/server/src/test/scala/scaladex/server/route/ProjectPagesTests.scala @@ -70,12 +70,9 @@ class ProjectPagesTests extends ControllerBaseSuite with BeforeAndAfterEach { it("should replace empty customScalaDoc with None") { val formData = FormData( "category" -> "json", - "beginnerIssuesLabel" -> "", "chatroom" -> "", - "contributingGuide" -> "", - "codeOfConduct" -> "", "defaultArtifact" -> "play-json-extra", - "defaultStableVersion" -> "on", + "preferStableVersion" -> "on", "customScalaDoc" -> "", "documentationLinks[0].label" -> "", "documentationLinks[0].url" -> "", @@ -84,11 +81,10 @@ class ProjectPagesTests extends ControllerBaseSuite with BeforeAndAfterEach { ) Post(s"/${PlayJsonExtra.reference}/settings", formData) ~> route ~> check { status shouldBe StatusCodes.SeeOther - for (project <- database.getProject(PlayJsonExtra.reference)) - yield { - val settings = project.get.settings - settings shouldBe PlayJsonExtra.settings - } + for (project <- database.getProject(PlayJsonExtra.reference)) yield { + val settings = project.get.settings + settings shouldBe PlayJsonExtra.settings + } } } } diff --git a/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html b/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html index 1a1a020a9..d4e44d06e 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/artifact.scala.html @@ -45,7 +45,7 @@

@artifact.artifactName @artifact.version - @if(project.settings.artifactDeprecations.contains(artifact.artifactName)) { + @if(project.settings.deprecatedArtifacts.contains(artifact.artifactName)) { Deprecated }

diff --git a/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html b/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html index 3a810db20..f87549bc3 100644 --- a/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html +++ b/modules/template/src/main/twirl/scaladex/view/project/editproject.scala.html @@ -21,63 +21,18 @@ Cancel -

Edit project

+

Project Settings

-
- - Contributors Wanted -
- -
- - -
- -
- - -
- -
- - -
-
+

This is used to compute the Awesome Scala page.

- @for(github <- project.githubInfo) { -
- Contributing Info -
-

In order for this project to show up on the front page and in the - Contributing Search, it needs to have a Beginner Issues Label, Chatroom - and Contributing Guide. The Code of Conduct is optional.

- - -
-
- - -
-
- - -
-
- - -
-
- } +
+ + +
+
+ +
+ +
- Default Artifact Selection + Artifact Settings

@@ -141,7 +74,6 @@

Edit project

name="defaultArtifact" data-live-search="true" class="selectpicker" data-style="btn-primary"> - @for(artifact <- artifactNames){
-

If possible we do not use any release candidate or milestone as the default version. For example, if an artifact has version 1.2.1 and 2.0.0-RC1, we will use 1.2.1 as default. If you prefer to select 2.0.0-RC1 uncheck this box:

- - - -

Remove versions not following the semver.org specifications

- - + +

If enabled, Scaladex filters pre-release versions out to compute the latest version.

+ +
+
+ + +
+
+ +
- -
Documentation -
 [groupId]    org.example
 [artifactId] foo_2.11
@@ -179,17 +136,16 @@ 

Edit project

-

Default: https://www.javadoc.io/doc/[groupId]/[artifactId]/[version]