znuny / znuny-feature-requests

This repository tracks feature requests as issues.
7 stars 1 forks source link

FR - Recognize more prefixes (Re, AW, SV, …) when cleaning subjects #19

Open uschwarz opened 3 years ago

uschwarz commented 3 years ago

Environment

Expected behaviour

When cleaning subjects (i.e., removing all errant Re:, Fwd:, etc. before replying), Outlook's non-standard prefixes like AW:, WG: should be removed as well, i.e. a reply to a message with subject "AW: [Ticket#...] Re: AW: Re: test" should be "Re: [Ticket#] test".

Actual behaviour

Only the prefixes that Znuny would use itself, i.e. as configured in Ticket::SubjectRe and Ticket::SubjectFwd are removed, leaving all others behind. In above example, the reply would be something like "Re: [Ticket#] AW: AW: test" or "AW: [Ticket#] Re: Re: test"

How to reproduce

Steps to reproduce the behavior:

  1. Create an outgoing email ticket.
  2. Reply, in mail client, to ticket. Add a couple of Re: and AW: to the subject to pretend you've been mailing back and forth between a German Outlook installation using "AW:" and a RFC-compliant client using "Re:".
  3. Reply to this reply in OTRS
  4. See what the subject line is like.

Additional information

I've tried a local patch: in Kernel/System/Ticket.pm, function TicketSubjectClean, I've changed to:

    # remove leading number with configured "RE:\s" or "RE[\d+]:\s" e. g. "RE: " or "RE[4]: "
    #$Subject =~ s/^($TicketSubjectRe(\[\d+\])?:\s)+//i;
    # hotpatch 20210414 ums: Outlook generates language variations.
    $Subject =~ s/^((Re|SV|Antw|VS|REF|AW|RIF|SV|BLS|RES|Odp|YNT|ATB)(\[\d+\])?:\s)+//i;

    # remove leading number with configured "Fwd:\s" or "Fwd[\d+]:\s" e. g. "Fwd: " or "Fwd[4]: "
    #$Subject =~ s/^($TicketSubjectFwd(\[\d+\])?:\s)+//i;
    # hotpatch 20210414 ums: Outlook generates language variations.
    $Subject =~ s/^((Fwd|VS|Doorst|VL|TR|WG|FS|TRS|VB|RV|ENC|PD|ILT|YML)(\[\d+\])?:\s)+//i;

going on a list from https://en.wikipedia.org/wiki/List_of_email_subject_abbreviations#Abbreviations_in_other_languages (though I couldn't be bothered to include and test the more UTF8y prefixes). I don't have enough Znuny-fu to figure out if this could be put into an extension. Maybe it should be user-configurable? The hard-coded values above are just a "works-for-me".

rkaldung commented 3 years ago

Hi @uschwarz,

Thank you for this idea. Since the 6.0.x branch is marked as a long term branch I'd like to keep this for the upcoming feature branch. And of course, this setting should be a configuration.

Implementing this for 6.0 as an add-on might be possible by overloading the TicketSubjectClean() of Ticket.pm, but we have our hands full. Maybe someone in the community like to volunteer for this?

ikedas commented 1 year ago

I submitted a PR: Centuran/OTRS-Community-Edition#20 that is applicable to Znuny & OTOBO. Should I submit it also here?