Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.21.0 #707

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.21.0](https://github.com/isomerpages/isomercms-backend/compare/v0.20.0...v0.21.0)

- chore(Infra Service): fix failing build [`#706`](https://github.com/isomerpages/isomercms-backend/pull/706)
- chore(deploymentsservice): add a brand for <env>Url types [`#705`](https://github.com/isomerpages/isomercms-backend/pull/705)
- Is 59/fix/disallow special character as first character [`#699`](https://github.com/isomerpages/isomercms-backend/pull/699)
- chore: add ga4 to request schema [`#689`](https://github.com/isomerpages/isomercms-backend/pull/689)
- fix(authservice): return `userId` when e2e [`#700`](https://github.com/isomerpages/isomercms-backend/pull/700)
- build(deps): bump vm2 from 3.9.15 to 3.9.16 in /microservices [`#702`](https://github.com/isomerpages/isomercms-backend/pull/702)
- build(deps): bump vm2 from 3.9.11 to 3.9.16 [`#701`](https://github.com/isomerpages/isomercms-backend/pull/701)
- Fix/rename subcollection and rename/delete resource room [`#692`](https://github.com/isomerpages/isomercms-backend/pull/692)
- fix(constants): fixed import [`#694`](https://github.com/isomerpages/isomercms-backend/pull/694)
- 0.20.0 (develop) [`#696`](https://github.com/isomerpages/isomercms-backend/pull/696)
- fix(launches service): change to primary domain source for clarity [`#669`](https://github.com/isomerpages/isomercms-backend/pull/669)
- Feat/buttons [`#585`](https://github.com/isomerpages/isomercms-backend/pull/585)
- Feat/site creation form email [`#679`](https://github.com/isomerpages/isomercms-backend/pull/679)

#### [v0.20.0](https://github.com/isomerpages/isomercms-backend/compare/v0.19.0...v0.20.0)

> 11 April 2023

- Chore/update node [`#681`](https://github.com/isomerpages/isomercms-backend/pull/681)
- build(deps): bump xml2js from 0.4.19 to 0.5.0 in /microservices [`#691`](https://github.com/isomerpages/isomercms-backend/pull/691)
- build(deps): bump vm2 from 3.9.12 to 3.9.15 in /microservices [`#688`](https://github.com/isomerpages/isomercms-backend/pull/688)
Expand All @@ -28,15 +46,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 3 April 2023

- fix(review): return 200 for unmigrated sites [`bd69c29`](https://github.com/isomerpages/isomercms-backend/commit/bd69c29023554c5dcf8cb361227ba4ebf0d1ac08)
- fix(sanitize): use same setup for dompurify as FE [`c25f448`](https://github.com/isomerpages/isomercms-backend/commit/c25f448813e1addce67d0209375ec35ef9cb6c7b)
- Fix: change response for github users accessing collaborator endpoints [`db1130f`](https://github.com/isomerpages/isomercms-backend/commit/db1130f96a6c9cda99df43d5774134aefffeee3e)

#### [v0.18.1](https://github.com/isomerpages/isomercms-backend/compare/v0.18.0...v0.18.1)

> 31 March 2023

- fix(review): return 200 for unmigrated sites [`073cab8`](https://github.com/isomerpages/isomercms-backend/commit/073cab8c6704178ee5061b8582b4f999720dfc95)
- fix(review): return 200 for unmigrated sites [`bd69c29`](https://github.com/isomerpages/isomercms-backend/commit/bd69c29023554c5dcf8cb361227ba4ebf0d1ac08)
- fix(sanitize): use same setup for dompurify as FE [`c25f448`](https://github.com/isomerpages/isomercms-backend/commit/c25f448813e1addce67d0209375ec35ef9cb6c7b)

#### [v0.18.0](https://github.com/isomerpages/isomercms-backend/compare/v0.17.0...v0.18.0)

Expand Down
6 changes: 3 additions & 3 deletions microservices/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isomercms",
"version": "0.20.0",
"version": "0.21.0",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
Expand Down
7 changes: 4 additions & 3 deletions src/classes/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
// Constants
const FOOTER_PATH = "footer.yml"
const NAVIGATION_PATH = "navigation.yml"
const HOMEPAGE_INDEX_PATH = "index.md" // Empty string
const { HOMEPAGE_FILENAME } = require("@root/constants")

const retrieveSettingsFiles = async (
accessToken,
Expand Down Expand Up @@ -42,7 +42,7 @@ const retrieveSettingsFiles = async (

// Retrieve homepage only if flag is set to true
if (shouldRetrieveHomepage) {
fileRetrievalObj.homepage = HomepageFile.read(HOMEPAGE_INDEX_PATH)
fileRetrievalObj.homepage = HomepageFile.read(HOMEPAGE_FILENAME)
}

const fileContentsArr = await Bluebird.map(
Expand Down Expand Up @@ -109,6 +109,7 @@ class Settings {
is_government: configContent.is_government,
facebook_pixel: configContent["facebook-pixel"],
google_analytics: configContent.google_analytics,
google_analytics_ga4: configContent.google_analytics_ga4,
linkedin_insights: configContent["linkedin-insights"],
resources_name: configContent.resources_name,
colors: configContent.colors,
Expand Down Expand Up @@ -233,7 +234,7 @@ class Settings {
const homepageContent = ["---\n", homepageFrontMatter, "---"].join("")
const newHomepageContent = Base64.encode(homepageContent)

await HomepageFile.update(HOMEPAGE_INDEX_PATH, newHomepageContent, sha)
await HomepageFile.update(HOMEPAGE_FILENAME, newHomepageContent, sha)
}
}

Expand Down
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./constants"
export * from "./pages"
3 changes: 3 additions & 0 deletions src/constants/pages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const HOMEPAGE_FILENAME = "index.md"

export const CONTACT_US_FILENAME = "contact-us.md"
5 changes: 3 additions & 2 deletions src/database/models/Deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "sequelize-typescript"

import { Site } from "@database/models/Site"
import { ProdPermalink, StagingPermalink } from "@root/types/pages"

@Table({ tableName: "deployments", paranoid: true })
export class Deployment extends Model {
Expand All @@ -26,13 +27,13 @@ export class Deployment extends Model {
allowNull: false,
type: DataType.TEXT,
})
productionUrl!: string
productionUrl!: ProdPermalink

@Column({
allowNull: false,
type: DataType.TEXT,
})
stagingUrl!: string
stagingUrl!: StagingPermalink

@CreatedAt
createdAt!: Date
Expand Down
7 changes: 7 additions & 0 deletions src/errors/DatabaseError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { BaseIsomerError } from "./BaseError"

export default class DatabaseError extends BaseIsomerError {
constructor(message = "Unable to retrieve data from database") {
super(500, message)
}
}
9 changes: 9 additions & 0 deletions src/errors/EmptyStringError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BaseIsomerError } from "./BaseError"

export default class EmptyStringError extends BaseIsomerError {
constructor(
message = "An empty string was provided for a method that requires a non-empty string"
) {
super(500, message)
}
}
7 changes: 7 additions & 0 deletions src/errors/MissingResourceRoomError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NotFoundError } from "./NotFoundError"

export default class MissingResourceRoomError extends NotFoundError {
constructor(message = "No resource room exists for the site") {
super(message)
}
}
7 changes: 7 additions & 0 deletions src/errors/MissingSiteError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NotFoundError } from "./NotFoundError"

export default class MissingSiteError extends NotFoundError {
constructor(message = "The site could not be found in Isomer") {
super(message)
}
}
7 changes: 7 additions & 0 deletions src/errors/MissingUserEmailError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NotFoundError } from "./NotFoundError"

export default class MissingUserEmailError extends NotFoundError {
constructor(message = "No email exists for the specified user!") {
super(message)
}
}
7 changes: 7 additions & 0 deletions src/errors/MissingUserError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NotFoundError } from "./NotFoundError"

export default class MissingUserError extends NotFoundError {
constructor(message = "The user could not be found in Isomer") {
super(message)
}
}
5 changes: 1 addition & 4 deletions src/errors/RequestNotFoundError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { NotFoundError } from "./NotFoundError"

export default class RequestNotFoundError extends NotFoundError {
constructor(message = "The specified review request could not be found!") {
super()
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
super(message)
}
}
3 changes: 3 additions & 0 deletions src/fixtures/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ is_government: false
shareicon: /images/isomer-logo.svg
facebook-pixel: "true"
google_analytics: UA-39345131-33
google_analytics_ga4: GA-test
linkedin-insights: "12345"
`

Expand Down Expand Up @@ -112,6 +113,7 @@ const configContent = {
shareicon: "/images/isomer-logo.svg",
"facebook-pixel": "true",
google_analytics: "UA-39345131-33",
google_analytics_ga4: "GA-test",
"linkedin-insights": "12345",
}

Expand All @@ -126,6 +128,7 @@ const configResponse = {
is_government: configContent.is_government,
facebook_pixel: configContent["facebook-pixel"],
google_analytics: configContent.google_analytics,
google_analytics_ga4: configContent.google_analytics_ga4,
linkedin_insights: configContent["linkedin-insights"],
colors: configContent.colors,
}
Expand Down
10 changes: 10 additions & 0 deletions src/fixtures/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,13 @@ export const MOCK_GITHUB_RAWCOMMENT_TWO: RawComment = {
body: JSON.stringify(MOCK_GITHUB_COMMENT_OBJECT_TWO),
created_at: MOCK_GITHUB_COMMIT_DATE_THREE,
}

export const MOCK_PAGE_PERMALINK = "/department/english"

export const MOCK_GITHUB_FRONTMATTER = Buffer.from(
`---
permalink: ${MOCK_PAGE_PERMALINK}
---
`,
"binary"
).toString("base64")
28 changes: 20 additions & 8 deletions src/fixtures/repoInfo.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import { ConfigYmlData } from "@root/types/configYml"
import { GitHubRepositoryData } from "@root/types/repoInfo"
import { Brand } from "@root/types/util"

export const MOCK_STAGING_URL_GITHUB = "https://repo-staging.netlify.app"
export const MOCK_STAGING_URL_CONFIGYML =
"https://repo-staging-configyml.netlify.app"
export const MOCK_STAGING_URL_DB = "https://repo-staging-db.netlify.app"
export const MOCK_STAGING_URL_GITHUB: NonNullable<
ConfigYmlData["staging"]
> = Brand.fromString("https://repo-staging.netlify.app")
export const MOCK_STAGING_URL_CONFIGYML: NonNullable<
ConfigYmlData["staging"]
> = Brand.fromString("https://repo-staging-configyml.netlify.app")
export const MOCK_STAGING_URL_DB: NonNullable<
ConfigYmlData["staging"]
> = Brand.fromString("https://repo-staging-db.netlify.app")

export const MOCK_PRODUCTION_URL_GITHUB = "https://repo-prod.netlify.app"
export const MOCK_PRODUCTION_URL_CONFIGYML =
"https://repo-prod-configyml.netlify.app"
export const MOCK_PRODUCTION_URL_DB = "https://repo-prod-db.netlify.app"
export const MOCK_PRODUCTION_URL_GITHUB: NonNullable<
ConfigYmlData["prod"]
> = Brand.fromString("https://repo-prod.netlify.app")
export const MOCK_PRODUCTION_URL_CONFIGYML: NonNullable<
ConfigYmlData["prod"]
> = Brand.fromString("https://repo-prod-configyml.netlify.app")
export const MOCK_PRODUCTION_URL_DB: NonNullable<
ConfigYmlData["prod"]
> = Brand.fromString("https://repo-prod-db.netlify.app")

export const repoInfo: GitHubRepositoryData = {
name: "repo",
Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const MOCK_REPO_DBENTRY_TWO: Attributes<Repo> = {
updatedAt: MOCK_SITE_DATE_TWO,
}

export const MOCK_DEPLOYMENT_DBENTRY_ONE: Attributes<Deployment> = {
export const MOCK_DEPLOYMENT_DBENTRY_ONE = {
id: 1,
siteId: MOCK_SITE_ID_ONE,
productionUrl: MOCK_DEPLOYMENT_PROD_URL_ONE,
Expand Down
62 changes: 61 additions & 1 deletion src/integration/NotificationOnEditHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ import {
mockIsomerUserId,
mockSiteName,
} from "@fixtures/sessionData"
import { BaseDirectoryService } from "@root/services/directoryServices/BaseDirectoryService"
import { ResourceRoomDirectoryService } from "@root/services/directoryServices/ResourceRoomDirectoryService"
import { CollectionPageService } from "@root/services/fileServices/MdPageServices/CollectionPageService"
import { ContactUsPageService } from "@root/services/fileServices/MdPageServices/ContactUsPageService"
import { HomepagePageService } from "@root/services/fileServices/MdPageServices/HomepagePageService"
import { PageService } from "@root/services/fileServices/MdPageServices/PageService"
import { ResourcePageService } from "@root/services/fileServices/MdPageServices/ResourcePageService"
import { SubcollectionPageService } from "@root/services/fileServices/MdPageServices/SubcollectionPageService"
import { UnlinkedPageService } from "@root/services/fileServices/MdPageServices/UnlinkedPageService"
import { CollectionYmlService } from "@root/services/fileServices/YmlFileServices/CollectionYmlService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import { GitHubService } from "@services/db/GitHubService"
import * as ReviewApi from "@services/db/review"
import { ConfigYmlService } from "@services/fileServices/YmlFileServices/ConfigYmlService"
Expand All @@ -41,13 +52,62 @@ const mockGithubService = {
getComments: jest.fn(),
}
const usersService = getUsersService(sequelize)
const footerYmlService = new FooterYmlService({
gitHubService: mockGithubService,
})
const collectionYmlService = new CollectionYmlService({
gitHubService: mockGithubService,
})
const baseDirectoryService = new BaseDirectoryService({
gitHubService: mockGithubService,
})

const contactUsService = new ContactUsPageService({
gitHubService: mockGithubService,
footerYmlService,
})
const collectionPageService = new CollectionPageService({
gitHubService: mockGithubService,
collectionYmlService,
})
const subCollectionPageService = new SubcollectionPageService({
gitHubService: mockGithubService,
collectionYmlService,
})
const homepageService = new HomepagePageService({
gitHubService: mockGithubService,
})
const resourcePageService = new ResourcePageService({
gitHubService: mockGithubService,
})
const unlinkedPageService = new UnlinkedPageService({
gitHubService: mockGithubService,
})
const configYmlService = new ConfigYmlService({
gitHubService: mockGithubService,
})
const resourceRoomDirectoryService = new ResourceRoomDirectoryService({
baseDirectoryService,
configYmlService,
gitHubService: mockGithubService,
})
const pageService = new PageService({
collectionPageService,
contactUsService,
subCollectionPageService,
homepageService,
resourcePageService,
unlinkedPageService,
resourceRoomDirectoryService,
})
const reviewRequestService = new ReviewRequestService(
(mockGithubService as unknown) as typeof ReviewApi,
User,
ReviewRequest,
Reviewer,
ReviewMeta,
ReviewRequestView
ReviewRequestView,
pageService
)
const sitesService = new SitesService({
siteRepository: Site,
Expand Down
Loading