Skip to content

Commit

Permalink
Merge pull request #223 from nypublicradio/GOTH-279-add-newsletter-so…
Browse files Browse the repository at this point in the history
…urce-tracking-to-gothamist-email-forms

Goth 279 add newsletter source tracking to gothamist email forms
  • Loading branch information
jgitlin-nypr authored Dec 16, 2022
2 parents 2ab4b7c + 602fe69 commit f82fc7f
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version = 1

exclude_patterns = [
"plugins/**",
"assets/**"
]

[[analyzers]]
name = "javascript"
enabled = true
Expand Down
4 changes: 1 addition & 3 deletions components/DatePublished.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const createDateLine = (date, prefix) => {
return `${prefix}${formatDateForByline(date)}`
}
}
{
return null
}
return null
}
const prefix = ref(props.showPrefix ? props.prefix : '')
const prefixModified = ref(props.showPrefix ? props.prefixModified : '')
Expand Down
1 change: 1 addition & 0 deletions components/NewsletterArticle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ watch(currentHeaderAdHeight, (height) => {
<template>
<div ref="newsletterElm" class="newsletter-article">
<newsletter-home
source='gothamist_articleBody'
@submit="emit('submit')"
small
:showBlurb="false"
Expand Down
6 changes: 6 additions & 0 deletions components/NewsletterHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const props = defineProps({
type: Boolean,
default: false,
},
// This "source" field is to capture the location and site as part of the record in the CRM
source: {
type: String,
default: 'gothamist'
},
altDesign: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -65,6 +70,7 @@ const submitForm = (email) => {
$fetch(config.NEWSLETTER_API, {
method: 'POST',
body: {
source: props.source,
list: config.NEWSLETTER_MULTI_LIST_IDS,
email: email,
},
Expand Down
2 changes: 1 addition & 1 deletion composables/data/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { normalizeTagPage } from './tagPages'
import { Page, ArticlePage, TagPage, InformationPage } from "../types/Page"

export async function findPage(htmlPath: string) {
let params = { html_path: htmlPath }
const params = { html_path: htmlPath }
return await useAviary('/pages/find', {params})
}

Expand Down
4 changes: 2 additions & 2 deletions composables/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import { ArticlePage, GalleryPage } from './types/Page'
diversityPolicy: 'https://www.nypublicradio.org/diversity-dei-overview/'
}

const author = article.authors?.map((author) => {
const authors = article.authors?.map((author) => {
return {
'@type': 'Person',
name: author.name,
Expand Down Expand Up @@ -126,7 +126,7 @@ import { ArticlePage, GalleryPage } from './types/Page'
description: article.searchDescription,
datePublished: article.publicationDate,
dateModified: article.updatedDate,
author,
authors,
publisher,
isAccessibleForFree: true
},
Expand Down
2 changes: 1 addition & 1 deletion pages/[sectionSlug]/[articleSlug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const showMarketingBanner = computed(() => {
/>
<div class="mt-6 mb-5">
<hr class="black mb-4" />
<newsletter-home @submit="newsletterSubmitEvent('footer')" />
<newsletter-home source="gothamist_footer" @submit="newsletterSubmitEvent('footer')" />
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const nativoSectionLoaded = (name) => {
<!-- newsletter -->
<div class="my-8">
<hr class="black mb-4" />
<newsletter-home @submit="newsletterSubmitEvent" />
<newsletter-home source="gothamist_home" @submit="newsletterSubmitEvent" />
</div>
</div>
<!-- home page collections -->
Expand Down
2 changes: 1 addition & 1 deletion server/middleware/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default (req, res, next) => {
const url = req.url.split('?')[0]
let urlParams = null
if (req.url.includes('?')) {
urlParams = '?' + req.url.split('?')[1]
urlParams = `?${req.url.split('?')[1]}`
}

const redirect = redirects.find(r => r.from === url)
Expand Down
1 change: 0 additions & 1 deletion tests/hello.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { it, describe, expect, assert } from 'vitest'
describe('suite name', () => {
it('foo', () => {
expect(1 + 1).toEqual(2)
expect(true).to.be.true
})

it('bar', () => {
Expand Down

0 comments on commit f82fc7f

Please sign in to comment.