New and Improved 3.13 Beta. Highlights: Shareable filters and dashboards and lots of other goodies. Any feedback can be raised as JIRA issues in the JIRA project.
Issue Details (XML | Word | Printable)

Key: JRA-8319
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Sam Chang [Atlassian]
Reporter: Nick Minutello
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
JIRA

Regex Comment Handler for Mail Fetching Service

Created: 23/Oct/05 02:50 PM   Updated: 15/May/06 10:06 PM
Component/s: Email integration
Affects Version/s: 3.3
Fix Version/s: 3.4.3

Time Tracking:
Not Specified

File Attachments: 1. Java Source File RegexCommentHandler.java (2 kB)
2. Java Source File TestRegexCommentHandler.java (6 kB)

Issue Links:
Reference
 

Participants: Anton Mazkovoi [Atlassian], Daniel Hannum, Jeff Turner [Atlassian], Mark Chaimungkalanont [Atlassian], Nick Menere [Atlassian], Nick Minutello and Sam Chang [Atlassian]
Since last comment: 2 years, 13 weeks, 6 days ago
Resolution Date: 22/Dec/05 11:46 PM
Labels:


 Description  « Hide
For emails that have a format where reply and quoted message have some arbitrary "divider", I have implemented a flexible regex-based comment handler.

Given a regex pattern for the divider, it will split the email body, returning only the first part as the comment.

If the pattern is not found, it returns the email body unchanged
If the regex is not specified, it returns the email body unchanged
If there is any error (ie regex expression error), it returns the email body unchanged
(See the tests for more details)

Our immediate need is to clean the junk out of emails that Lotus Notes puts there. None of the existing handlers do anything close to what needs to be done.

If you could merge it into the next release, that would be grand.

-Nick

(see attached Handler + test)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jeff Turner [Atlassian] added a comment - 25/Oct/05 12:04 AM
Thanks, we'll take a look at this for 3.5 ('merge' might be a bit tricky - we need to integrate into our existing handler rather than just create a new one).

Nick Minutello added a comment - 25/Oct/05 07:24 AM
You probably want to be able to chain "processors" to a handler - and have different processors for different email types
However, adding it as-is to 3.4 would also be useful for a lot of people - not least us .

Nick Minutello added a comment - 25/Oct/05 06:59 PM
I think you want to do something like filters in Jive...

Anton Mazkovoi [Atlassian] added a comment - 25/Oct/05 09:51 PM
> I think you want to do something like filters in Jive...
We do indeed

> However, adding it as-is to 3.4 would also be useful for a lot of people - not least us
Agree, but we need to draw the line somewhere The feature list for 3.4 has been frozen, and we really would like to release it some time. I will have to be the bad guy here and leave it for 3.5.

Anton


Nick Minutello added a comment - 26/Oct/05 05:32 AM
Come on....
It has tests and everything...
-Nick

Nick Menere [Atlassian] added a comment - 26/Oct/05 09:59 PM
Ok, ok.... but you owe us one!
You want to doc it for us as well: JRA-8349

Nick Minutello added a comment - 26/Oct/05 11:42 PM
super.
add docs as comment on JRA-8349 ...

Anton Mazkovoi [Atlassian] added a comment - 26/Oct/05 11:45 PM
Just for information sake, are you aware that the NonQuotedCommentHandler looks at the outlook-email.translations file for delimiters of quoated messages? Only the direct matches are now found, no regexps. Adding regexps would be the next stage.

Nick Minutello added a comment - 26/Oct/05 11:55 PM
Yep - saw that when I started writing Regex....
The regex handler is a splitter-only.

Mark Chaimungkalanont [Atlassian] added a comment - 27/Oct/05 12:49 AM
Thanks for the code Nick, it's loaded and ready to go in 3.4!

Mark Chaimungkalanont [Atlassian] added a comment - 27/Oct/05 01:59 AM
Nick,

Out of curiousity, is there any reason why you didn't just add more lines to the outlook-email.translations file and use the NonQuotedCommentHandler

Cheers

Mark C


Nick Minutello added a comment - 27/Oct/05 07:56 AM
Yeah, if there is some variation on the seperator format that you havent accounted for, you have to do a re-deploy to fix it

If I do something like

>> Quoting something deliberately
>> to make a point
>> and refer to it
here

Will my quoted bits get axed by the NonQuotedCommentHandler?


Jeff Turner [Atlassian] added a comment - 28/Oct/05 05:57 AM
That would axe all lines except "here".

Nick Minutello added a comment - 28/Oct/05 09:12 AM
Thats what I thought...
Thats not ideal...

Nick Minutello added a comment - 14/Dec/05 04:37 AM
Ouch. Not sure if you noticed, but my last test was complete shite.

Should have been

String processedComment = regexCommentHandler.splitMailBody(rawEmailbody);

(rather than regexCommentHandler.splitMailBody(expectedComment))

Not entirely surprising, when you make that change, the test no longer passes.
You need to change the regex to the following

params.put(KEY_REGEX, "/Extranet\\s*jira.london.echonet/FMB/UK/EUROPE/GROUP@CRAPPYLOTUSNOTES/");

Nick Minutello added a comment - 14/Dec/05 04:19 PM
Its only the test thats borked - the actual implementation is fine....
(this unit testing .... will never catch on....)

Daniel Hannum added a comment - 15/May/06 03:05 PM
This is a great handler for commenting, but it would be even better if it could create issues too. Can it be combined with the vanilla "create or comment" handler but retain the regex for commenting?

Anton Mazkovoi [Atlassian] added a comment - 15/May/06 10:06 PM
Daniel,

This is not currently possible. You will need to customise JIRA's CreateOrCommentHandler to do this.