-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added utility to convert markdown comments to text (#191)
* added utility to convert markdown comments to text * Minor version bump --------- Co-authored-by: Valentin <[email protected]>
- Loading branch information
1 parent
d1eee32
commit 14269e3
Showing
4 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -66,6 +67,8 @@ export class CommunicationUserMentionNotificationBuilder | |
); | ||
const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); | ||
|
||
const htmlComment: string = convertMarkdownToText(eventPayload.comment); | ||
|
||
return { | ||
emailFrom: '[email protected]', | ||
commentSender: { | ||
|
@@ -77,7 +80,7 @@ export class CommunicationUserMentionNotificationBuilder | |
email: recipient.email, | ||
notificationPreferences: notificationPreferenceURL, | ||
}, | ||
comment: eventPayload.comment, | ||
comment: htmlComment, | ||
platform: { | ||
url: alkemioURL, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |