rosulek / gmail-tickler

Get emails out of your inbox until a specified date
MIT License
19 stars 5 forks source link

Relative baseline problem #6

Closed orschiro closed 7 years ago

orschiro commented 9 years ago

Hi @rosulek,

I had an idea to address the relative baseline problem. As I recall correctly, you were saying that there is no way for you to know the relative date for conversations older than a week. I would like to know from you whether the following could work:

Let's say the last email conversation from a conversation dates back to Friday, 17 April. If I assign the label tomorrow to it, it would immediately come back into my inbox because Saturday, 18 April had already passed. But what if we calculate the relative date based on the date at which the label had been assigned? In that case, tomorrow would become relative to today because I assigned the label today (and this could be calculated based on the hourly trigger, right?).

Looking forward to your response!

Robert

rosulek commented 9 years ago

In the documentation I mention that I don't know a way to find out the date a label is applied. But if you learn of a way, please let me know. I agree it would be useful here. On Apr 20, 2015 1:41 AM, "Robert Orzanna" notifications@github.com wrote:

Hi @rosulek https://github.com/rosulek,

I had an idea to address the relative baseline problem. As I recall correctly, you were saying that there is no way for you to know the relative date for conversations older than a week. I would like to know from you whether the following could work:

Let's say the last email conversation from a conversation dates back to Friday, 17 April. If I assign the label tomorrow to it, it would immediately come back into my inbox because Saturday, 18 April had already passed. But what if we calculate the relative date based on the date at which the label had been assigned? In that case, tomorrow would become relative to today because I assigned the label today (and this could be calculated based on the hourly trigger, right?).

Looking forward to your response!

Robert

— Reply to this email directly or view it on GitHub https://github.com/rosulek/gmail-tickler/issues/6.

orschiro commented 9 years ago

Will try my best and get back to you!

orschiro commented 9 years ago

Without having received an extensive answer, a user on stackoverflow reports that the suggested approach might work.

http://stackoverflow.com/questions/29752621/gmail-google-apps-script-find-out-the-date-a-label-is-applied/29754907?noredirect=1#comment47757443_29754907

lehrblogger commented 8 years ago

I've been thinking about this problem too, and how to effectively recreate the tonight/tomorrow/this weekend/etc snoozes I became so accustomed to in Mailbox (R.I.P.). A few thoughts:

At some point I'll probably take a stab at implementing that last idea, but thought I'd think out loud here in case others had suggestions.

rosulek commented 8 years ago

That is a nice idea and I'd be in favor of it (especially if you implement it!). So any relative date/time specification would be replaced by the absolute one as determined by the current time (first encountering the label).

The script supports multiple labels on a single email, like tickler/tomorrow + tickler/7pm. Internally it just concatenates them together into tomorrow 7pm and parses that deadline. It might be tricky to nail down exactly how to update the labels in this case: replace just tickler/tomorrow with tickler/jan20 while leaving the other one? Replace both labels with tickler/jan20+7pm? Probably the latter since we lose the information about which term of the deadline came from different labels.

lehrblogger commented 8 years ago

Thanks for pointing that out! I've got some travel coming up so it might be a few weeks before I can implement this, but every time I tickle an email I'm reminded of it, so eventually :)

lehrblogger commented 7 years ago

I know it's been forever, but I still plan to work on this, hopefully in the next few weeks...

rosulek commented 7 years ago

I have started a new dev branch in which I implement my take on this. In fact, there was a bunch of other refactoring I wanted to do and basically everything except the date-parsing has been rewritten. I just pounded this out today and haven't tested very rigorously.

The main thing is that there are two "namespaces" for labels. Users will add labels of the form tickler/*. The script manages "internal" labels of the form tickler/@/*.

Other changes:

Comments welcome!

rosulek commented 7 years ago

I added the tickle-by-email-address functionality back (again in dev branch).

Overall I am enjoying the new workflow. I like that both mechanisms put the thread in tickler/@/* in a common format. I like being able to look at a glance in tickler/@/* to see what's there. I think internally things should scale better since it looks at labels first, then only if it needs to take action does it load actual threads within that label.

I'd be interested to hear your impressions @lehrblogger since you seem to use the tickler much more extensively.

lehrblogger commented 7 years ago

In general, this looks great! I've been using the new version for the last couple of days, and haven't noticed any issues. Personally, I don't use the email tickling functionality because the clients I use make it easier to apply labels, but it's fine with me to keep it.

I like how you've organized things in this branch. I'll continue to try things out, and might submit smaller PR's after it's been merged into master as needed.

The new error handling in particular is great. The client I use on my iPhone doesn't make it easy to tell what labels have been applied to a thread, so if there are new messages after I initially tickle the thread, I often inadvertently choose a different snooze time, creating an error state that's a hassle to clean up. Untickling at the earliest time seems like a much better solution.

There might be a small bug where threads tickled to the very near future require two passes of the script to appear properly in the inbox, rather than just one. I had accounted for this before here.

One thing I discovered while working on a different Scripts project is that it's pretty simple to split things into multiple files. On one hand, the code is more organized with a utils.gs and config.gs and so on, but on the other hand, it's more inconvenient to update everything with a new version with one copy-paste. It's not that obvious from the Scripts UI that you can have multiple files, so I thought I'd mention in case you had a preference.

rosulek commented 7 years ago

I am closing this after the merge #19 to master. Re-open if there are problems related to this new approach. I'll open another issue about the "very near future" problem.