FIX: Vipps agreement and DB agreement out of sync #42
|
|
@ -38,12 +38,12 @@ Deno.test("generated rss contains promo with link to donations page", () => {
|
||||||
const feed = rss.assembleFeed(series);
|
const feed = rss.assembleFeed(series);
|
||||||
|
|
||||||
const indexOfFirstPromotion = feed.indexOf(
|
const indexOfFirstPromotion = feed.indexOf(
|
||||||
"NRSS er avhengig av din Vipps-støtte"
|
"NRSS er avhengig av din Vipps-støtte",
|
||||||
);
|
);
|
||||||
const indexOfSecondPromotion = feed.indexOf("Vurder å støtte utviklingen");
|
const indexOfSecondPromotion = feed.indexOf("Vurder å støtte utviklingen");
|
||||||
assertLess(
|
assertLess(
|
||||||
indexOfFirstPromotion,
|
indexOfFirstPromotion,
|
||||||
indexOfSecondPromotion,
|
indexOfSecondPromotion,
|
||||||
"First promotion should come before the second"
|
"First promotion should come before the second",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
25
lib/rss.ts
25
lib/rss.ts
|
|
@ -31,17 +31,15 @@ function assembleFeed(series: Series): string {
|
||||||
tag("ttl", "60"), //60 minutes
|
tag("ttl", "60"), //60 minutes
|
||||||
...(series.imageUrl
|
...(series.imageUrl
|
||||||
? [
|
? [
|
||||||
tag("itunes:image", "", [["href", series.imageUrl]]),
|
tag("itunes:image", "", [["href", series.imageUrl]]),
|
||||||
tag("image", [
|
tag("image", [
|
||||||
tag("url", series.imageUrl),
|
tag("url", series.imageUrl),
|
||||||
tag("title", series.title),
|
tag("title", series.title),
|
||||||
tag("link", series.link),
|
tag("link", series.link),
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
...series.episodes.map((episode) =>
|
...series.episodes.map((episode) => assembleEpisode(episode, series.id)),
|
||||||
assembleEpisode(episode, series.id)
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -49,14 +47,15 @@ function assembleFeed(series: Series): string {
|
||||||
["xmlns:itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd"],
|
["xmlns:itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd"],
|
||||||
["xmlns:content", "http://purl.org/rss/1.0/modules/content/"],
|
["xmlns:content", "http://purl.org/rss/1.0/modules/content/"],
|
||||||
["xmlns:podcast", "https://podcastindex.org/namespace/1.0"],
|
["xmlns:podcast", "https://podcastindex.org/namespace/1.0"],
|
||||||
]
|
],
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function descriptionWithDonationPromotion(description: string): string {
|
function descriptionWithDonationPromotion(description: string): string {
|
||||||
const firstPromotion = `⬇️NRSS er avhengig av din Vipps-støtte⬇️`;
|
const firstPromotion = `⬇️NRSS er avhengig av din Vipps-støtte⬇️`;
|
||||||
const secondPromotion = `Takk for at du bruker NRSS 🙏🌟 Vurder å støtte utviklingen via Vipps med omtrent det samme som prisen på en kaffekopp. Se mer på https://nrss.deno.dev/`;
|
const secondPromotion =
|
||||||
|
`Takk for at du bruker NRSS 🙏🌟 Vurder å støtte utviklingen via Vipps med omtrent det samme som prisen på en kaffekopp. Se mer på https://nrss.deno.dev/`;
|
||||||
|
|
||||||
return `${firstPromotion}\n\n${description}\n\n${secondPromotion}`;
|
return `${firstPromotion}\n\n${description}\n\n${secondPromotion}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue