Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
week 6 & 7& 8 #5
week 6 & 7& 8 #5
Changes from 1 commit
156b2bf
5f96f62
250d95e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setting will grow over time, could become a performance bottleneck at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I came up with a better solution: get the converted message and store it in a variable, then query that variable to see if there is a new message, and when there is, the values are updated. This means that the converted message in Joplin is not only updated until there is a new message(If you have another solution please tell me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by variable here? You need to persists this information between restarts somehow.
It seems to me that the easiest way to store this information is to use the email account itself - you either delete messages you've converted, mark them read, or move to another folder.
Or you could only store the date of the last seen email and only process newer. This way you store it on the client but at least it's just one number per mailbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, the thought came to my mind to store this information by using the email account itself, but there is no standard way to mark the message. To be more clear, some email providers allow you to mark messages while others don't.
But I found a solution One of the flags that are standard for all email providers is the 'SEEN' flag. Every message is flagged as 'UNSEEN' if the message is new or the user marks it as 'UNSEEN'.
So I will add an additional condition in the search, which is to search for the messages that are "from" a specific email and marked as "UNSEEN" and then mark the messages as "SEEN" after fetching them.
I think this solution is better than deleting. and the user can mark as an "unread" message any number of messages in their email provider.
Sorry for the delay in suggesting this solution. It took me a lot of time to test this solution across different email providers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example:
git2.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth cleaning up the temp file afterwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried deleting folders in this place, but it will slow down when there are a lot of messages that you want to convert because it will create and delete and so on. What I did is every time the plugin starts, it deletes the old attachments and starts creating a new temporary folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially be a security risk, say, if you run the plugin in Joplin portable from a USB drive, your emails will be left on the computer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't the delete job be a self-running/isolated background job?
The "old" temp folder could be renamed, a new one created, old, now renamed, deleted in the background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I refacted the function to this mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a sync function, which means I can't go to the next line after finishing this function(delete a temp folder).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could in theory use a web worker (or whatever the equivalent of threads in the JS world is called) but this looks like an overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good since we can add all the notes and attachments posting functions in the other JS thread.
I will read more about web worker. and I will definitely add it if I notice its presence will be important.