Skip to content
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

Add option to remove obsolete drafts #1627

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

milhnl
Copy link
Contributor

@milhnl milhnl commented Aug 28, 2023

Hi all!

This is an updated version of #1313 (which aimed to fix #1044). I rebased the commit, and deduplicated the code in SaveCommand and SendCommand. I think that was the most obvious feedback then, but I can imagine there's more.

# set body text
mailcontent = self.message.get_body_text()
envelope = Envelope(bodytext=mailcontent, tags=tags)
envelope = Envelope(bodytext=mailcontent, tags=tags,
previous_draft=draft)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite see how this is picket up by my editor then in envelope mode?
Am I missing something or is then envelope -> edit command simply ignoring this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your $EDITOR? Is that necessary? SendCommand and SaveCommand simply pick it up from this field in the envelope.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was confused and only now understood the logic behind this patch.
Question: What if I answer "no" to the prompt to remove the draft, then create another draft and end up with two drafts, then send the last and say "yes" to the prompt.
As far as I can see, the current logic would only remove the very last draft, not the first one?
If so, is that intentional?

I could not test this myself at the minute because I have problems installing the dev version with poetry.. :D

Copy link
Contributor Author

@milhnl milhnl Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's how it currently works. Removing every revision would require persisting their id's somehow, and that is not how @stevenengler built it. I'm not sure how I would implement that (maybe a custom header?). Currently it remembers the saved draft at runtime in envelope mode, and when it is not deleted, there is no relationship between the old and the new. I'd think that would even be the least surprising behavior.

I tested it by installing by sudo ./setup.py install which immediately says I shouldn't do it that way ;)

@milhnl
Copy link
Contributor Author

milhnl commented Aug 28, 2023

By the way, I just remembered I saw a pull request today that I think was merged which made the tags to indicate a draft configurable by the user. That is not yet incorporated in this commit.

@guludo
Copy link
Contributor

guludo commented Feb 19, 2024

I took a look at adding support for the draft_tags stuff here and it seems there are other places in the current code base that needs the same type of fix already (see the output of git grep -W -e "'draft'" -e '"draft"' upstream/master)...

@pazz
Copy link
Owner

pazz commented Jul 17, 2024

Sorry for the late response but what is the status of this?

@milhnl
Copy link
Contributor Author

milhnl commented Jul 18, 2024

No worries. I'm busy with some IRL stuff right now, but have an idea on how to fix the draft_tags situation. It boils down to also using the full list to select drafts, but it is probably clearer as a commit. I think I can get y'all a revised pull request somewhere in the coming month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

confusing command for editing draft
3 participants