Skip to content

Commit

Permalink
Merge pull request #192 from alkem-io/develop
Browse files Browse the repository at this point in the history
Release:  Markdown to text
  • Loading branch information
valentinyanakiev authored Feb 20, 2023
2 parents 77f069b + 14269e3 commit fcb2182
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
54 changes: 48 additions & 6 deletions service/package-lock.json

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

3 changes: 2 additions & 1 deletion service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-notifications",
"version": "0.6.6",
"version": "0.6.7",
"description": "Alkemio notifications service",
"author": "Alkemio Foundation",
"private": false,
Expand Down Expand Up @@ -48,6 +48,7 @@
"apollo-server-express": "^3.3.0",
"cross-env": "^7.0.3",
"dotenv": "^10.0.0",
"markdown-to-text": "^0.1.1",
"module-alias": "^2.2.2",
"nest-winston": "^1.5.0",
"nodemon": "^2.0.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NotificationTemplateType } from '@src/types/notification.template.type'
import { CommunicationUserMentionEmailPayload } from '@common/email-template-payload';
import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers';
import { UserPreferenceType } from '@alkemio/client-lib';
import { convertMarkdownToText } from '@src/utils/markdown-to-text.util';

@Injectable()
export class CommunicationUserMentionNotificationBuilder
Expand Down Expand Up @@ -66,6 +67,8 @@ export class CommunicationUserMentionNotificationBuilder
);
const alkemioURL = this.alkemioUrlGenerator.createPlatformURL();

const htmlComment: string = convertMarkdownToText(eventPayload.comment);

return {
emailFrom: '[email protected]',
commentSender: {
Expand All @@ -77,7 +80,7 @@ export class CommunicationUserMentionNotificationBuilder
email: recipient.email,
notificationPreferences: notificationPreferenceURL,
},
comment: eventPayload.comment,
comment: htmlComment,
platform: {
url: alkemioURL,
},
Expand Down
5 changes: 5 additions & 0 deletions service/src/utils/markdown-to-text.util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import removeMarkdown from 'markdown-to-text';

export function convertMarkdownToText(markdown: string): string {
return removeMarkdown(markdown);
}

0 comments on commit fcb2182

Please sign in to comment.