Skip to content

Commit

Permalink
Merge pull request #12 from joplin/feature/#10
Browse files Browse the repository at this point in the history
feature/Add tags mentioned in the subject to the note when monitoring a specific mailbox.
  • Loading branch information
roman-r-m authored Oct 1, 2022
2 parents 5ff3327 + 8f8bc23 commit 159fd2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/postNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export class PostNote {

if (isPostByFolderId(postCriteria)) {
this.note['parent_id'] = postCriteria['folderId'];
emailTags = await this.addTags(postCriteria['tags']);
const subject = postCriteria['emailContent'].subject;
const emailText = htmlToText(this.emailHtmlBody, {wordwrap: 130, selectors: [{selector: 'img', format: 'skip'}]});
const firstLine = (emailText || '').trim().split('\n')[0];
const {tags} = noteLocationBySubject(subject + ' ' + firstLine);

emailTags = await this.addTags(tags);

// Post the note to Joplin.
const note = await joplin.data.post(['notes'], null, this.note);
Expand Down

0 comments on commit 159fd2c

Please sign in to comment.