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

Strip the last line created by email clients before posting #6

Closed
r-a-y opened this issue Apr 19, 2012 · 4 comments
Closed

Strip the last line created by email clients before posting #6

r-a-y opened this issue Apr 19, 2012 · 4 comments

Comments

@r-a-y
Copy link
Owner

r-a-y commented Apr 19, 2012

When people reply by email via their preferred email client, a "USER wrote:" line (or variations of this string that include the timestamp or different verbiage) will be prepended to the "--- Reply ABOVE THIS LINE to add a comment ---" line.

Most people will not remove this line when replying. Hence this "USER wrote:" string will also be posted.

Perhaps do a regex match for this line and strip it before posting. We'll also have to look out for localized email clients as well.

Note: Basecamp, which this plugin is modelled after, does not do this.


Perhaps we can just search the last line and last character to see if a colon exists. If it does, strip the line?

@boonebgorges
Copy link
Collaborator

A couple of thoughts off the top of my head...

  • Maybe this should be done by means of an output filter, so that the
    content is saved in the database but stripped on the way out. That way
    if the regex is too greedy, nothing important is lost.
  • One possible way around the problem of localization etc is looking for
    colons. That is, only strip the last line if it ends with a colon. May
    not work across all languages and clients, but I bet it's pretty close
  • A future enhancement may involve an admin setting that allows users to
    enter individual lines of regex (or maybe some other pattern replacement
    syntax) for specific patters they want to remove
  • In the end, having some regex that tries to be smart about this is not
    going to be too harmful, as long as it's written to be non-greedy. The
    worst that will happen is that the "In reply to..." line will leak
    through, which is not the end of the world.

On 4/19/12 5:28 PM, r-a-y wrote:

When people reply by email via their preferred email client, a "USER wrote:" line (or variations of this string that include the timestamp or different verbiage) will be prepended to the "--- Reply ABOVE THIS LINE to add a comment ---" line.

Most people will not remove this line when replying. Hence this "USER wrote:" string will also be posted.

Perhaps do a regex match for this line and strip it before posting. We'll have to look out for localized email clients as well.

Note: Basecamp, which this plugin is modelled after, does not do this.


Reply to this email directly or view it on GitHub:
#6

@r-a-y
Copy link
Owner Author

r-a-y commented Apr 20, 2012

I had the exact same idea with the colon! In fact, I had edited the original issue with this point before you posted about it! ;)

@r-a-y
Copy link
Owner Author

r-a-y commented Jul 27, 2012

Commit f492856 overhauls email signature stripping.

Closing for now.

@r-a-y
Copy link
Owner Author

r-a-y commented Jul 5, 2013

Also see commit 4792e87 for additional email sig tweaking.

r-a-y added a commit that referenced this issue Dec 5, 2014
Forgot to trim whitespace when checking for the last line created by
email clients. (See commit f492856.)

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

No branches or pull requests

2 participants