Skip to content

Commit

Permalink
Merge pull request #15 from dabigjoe6/content-fix
Browse files Browse the repository at this point in the history
Add backward compatibility for resources without content but contains …
  • Loading branch information
dabigjoe6 authored Jun 25, 2023
2 parents ff4bb4a + 88fc370 commit 2f4c7ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/send-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ class SendFeed {
try {
const newResources: ResourceI[] = [];
for (const resource of resources) {
resource.readLength = readingTime(resource.content || "").text
if (!resource.summary && resource.content) {
resource.summary = await this.summarizePost(resource.content);
resource.readLength = readingTime(resource.content || resource.description || "").text
if (!resource.summary && (resource.content || resource.description)) {
resource.summary = await this.summarizePost(resource.content ?
resource.content :
resource.description ?
resource.description : "");
resource.isUpdate = true;
}
newResources.push(resource)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/email/generateEmailTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const generatePost = (post: ResourceI, isSummaryEnabled: boolean) => `
? post?.summary[0] === ":"
? "Summary" + post.summary
: "Summary: " + post.summary
: post.description
: post.description}</p>
: (post.content || post.description)
: (post.content || post.description)}</p>
</div>
</td>
</tr>
Expand Down

0 comments on commit 2f4c7ed

Please sign in to comment.