FlexibleSignature

From Request Tracker Wiki
Revision as of 06:49, 21 October 2015 by Cris70 (talk | contribs)
Jump to navigation Jump to search

Changing the way the signature works in RT

I was having some issues with the way RT works regarding user signatures.

First of all, RT will always put a "--" before your signature, so you are limited in the way your signature looks.

Second, RT will always put your signature at the top of an empty message, so I always have to put the cursor at the top, hit "Enter" to make space for my text, then put again the cursor at the top and start writing.

This is all quite tedious.

So I wrote a small patch to change the behaviour.

Here are the instructions for RT 4.2.12:

  • copy /opt/rt4/share/html/Elements/MessageBox to /opt/rt4/local/html/Elements/MessageBox
  • modify /opt/rt4/local/html/Elements/MessageBox so that line 68 changes from:
    $signature = "-- \n". $text;

to:

    if ($text =~ m/^--$/m) {
        $signature = "\n". $text;
    } else {
        $signature = "\n-- \n". $text;
    }
  • clear your mason cache
  • restart your web server

Now, if you do not have "--" on a line by its own in your signature, RT will put it at the top of your signature BUT it will also leave a blank line before your signature.

If you already have a "--" on a line by its own in your signature, RT will leave it alone and will NOT put another one on top of your signature. Also RT will leave a blank line before your signature.