New extension to pin a comment in a ticket

Hello, here is a new RT extension RT::Extension::PinComment, which adds the facility to pin a comment on a ticket, so it is highlighted and always comes first in the transaction history.

As well as adding a “Pin” action to ticket transactions, this extension also provides a format field “PinComment” in the query builder for showing the contents of a ticket’s pinned comment, and a search option "Has a pinned comment " to find tickets with pinned comments.

Only people with ModifyTicket rights on a ticket can pin or unpin a comment on that ticket.

It seems to work OK on RT 4.2.16, 4.4.0, and 5.0.1.

4 Likes

Hi Andrew,

That sounds nifty. Unfortunately, it definitely does not install properly in RT 5.0.4 into the local/plugins directory so something is not quite right with the installation scripts. Maybe version 0.02 will fix that.

Regards,
Ken

I’ve upgraded my test RT from 5.0.1 to 5.0.4, removed this extension, and reinstalled it. It seems to install fine for me (see below). What do you see, when you run through the installation steps in the README, and what type of system are you doing this on?

# make install
Manifying 1 pod document
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/lib/RT/Extension/PinComment.pm
Appending installation info to /opt/rt5/local/plugins/RT-Extension-PinComment/lib/perllocal.pod
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Elements/RT__Ticket/ColumnMap/Once
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Elements/ShowTransaction/Default
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Search/Elements/BuildFormatString/Default
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Search/Elements/PickBasics/Default
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/SelfService/Display.html/BeforeShowHistory
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Ticket/Display.html/BeforeDisplay
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Ticket/Display.html/BeforeShowHistory
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Elements/PickPinCommentSearchAttribute
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/html/Elements/PinCommentBeforeShowHistory
Installing /opt/rt5/local/plugins/RT-Extension-PinComment/static/css/PinComment.css

It does not look like the install script locates my instance in /opt/rt5. If I specify the location using PREFIX=/opt/rt5, it finds it but then puts it in the wrong location in the filesystem:

root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> perl Makefile.PL
Use of uninitialized value $prefix in concatenation (.) or string at inc/Module/Install/RTx.pm line 53.
Use of uninitialized value $prefix in concatenation (.) or string at inc/Module/Install/RTx.pm line 59.
Using RT configuration from /opt/rt5/lib/RT.pm:
html => $(DESTDIR)/plugins/RT-Extension-PinComment/html
lib => $(DESTDIR)/plugins/RT-Extension-PinComment/lib
static => $(DESTDIR)/plugins/RT-Extension-PinComment/static
Checking if your kit is complete…
Looks good
Generating a Unix-style Makefile
Writing Makefile for RT::Extension::PinComment
Writing MYMETA.yml and MYMETA.json
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> less inc/Module/Install/RTx.pm
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> vim +53 inc/Module/Install/RTx.pm
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> PREFIX=/opt/rt5 perl Makefile.PL
Using RT configuration from /opt/rt5/lib/RT.pm:
html => $(DESTDIR)/opt/rt5/plugins/RT-Extension-PinComment/html
lib => $(DESTDIR)/opt/rt5/plugins/RT-Extension-PinComment/lib
static => $(DESTDIR)/opt/rt5/plugins/RT-Extension-PinComment/static
Generating a Unix-style Makefile
Writing Makefile for RT::Extension::PinComment
Writing MYMETA.yml and MYMETA.json
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> make
cp lib/RT/Extension/PinComment.pm blib/lib/RT/Extension/PinComment.pm
Manifying 1 pod document
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> make -n install
true
true
true
true
true
true
true
true
true
“/usr/bin/perl” “-Iinc” “-MExtUtils::Command::MM” -e pod2man “–” --section=3 --perm_rw=644 -u
lib/RT/Extension/PinComment.pm blib/man3/RT::Extension::PinComment.3pm
true
“/usr/bin/perl” “-Iinc” -MExtUtils::Install -e ‘install([ from_to => {@ARGV}, verbose => ‘'‘0’'’, uninstall_shadows => ‘'‘0’'’, dir_mode => ‘'‘755’'’ ]);’ –
read “/usr/local/lib64/perl5/auto/RT/Extension/PinComment/.packlist”
write “/opt/rt504/local/man/auto/RT/Extension/PinComment/.packlist”
“blib/lib” “/opt/rt5/plugins/RT-Extension-PinComment/lib”
“blib/arch” “/opt/rt504/local/man”
“blib/bin” “/usr/local/bin”
“blib/script” “/usr/local/bin”
“blib/man1” “/opt/rt504/local/man/man1”
“blib/man3” “/opt/rt504/local/man/man3”
“/usr/bin/perl” “-Iinc” -MExtUtils::Command::MM -e ‘warn_if_old_packlist’ –
“/usr/lib64/perl5/auto/RT/Extension/PinComment”
true
echo Appending installation info to “/opt/rt5/plugins/RT-Extension-PinComment/lib/perllocal.pod”
“/usr/bin/perl” “-Iinc” -MExtUtils::Command -e ‘mkpath’ – “/opt/rt5/plugins/RT-Extension-PinComment/lib”
“/usr/bin/perl” “-Iinc” -MExtUtils::Command::MM -e ‘perllocal_install’ –
“Module” “RT::Extension::PinComment”
“installed into” “/opt/rt5/plugins/RT-Extension-PinComment/lib”
LINKTYPE “dynamic”
VERSION “0.01”
EXE_FILES “”
>> “/opt/rt5/plugins/RT-Extension-PinComment/lib/perllocal.pod”
true
true
“/usr/bin/perl” “-Iinc” -Ilib -I"/opt/rt504/local/lib" -I"/opt/rt5/lib" -Iinc -MModule::Install::RTx::Runtime -e"RTxPlugin()"
“/usr/bin/perl” “-Iinc” -MExtUtils::Install -e “install({q(html), q(/opt/rt5/plugins/RT-Extension-PinComment/html), q(lib), q(/opt/rt5/plugins/RT-Extension-PinComment/lib), q(static), q(/opt/rt5/plugins/RT-Extension-PinComment/static)})”
root@rt1a:/opt/rt5/src/extensions/RT-Extension-PinComment-0.01> make install
Manifying 1 pod document
Installing /opt/rt5/plugins/RT-Extension-PinComment/lib/RT/Extension/PinComment.pm
Appending installation info to /opt/rt5/plugins/RT-Extension-PinComment/lib/perllocal.pod
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Search/Elements/PickBasics/Default
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Search/Elements/BuildFormatString/Default
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Ticket/Display.html/BeforeDisplay
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Ticket/Display.html/BeforeShowHistory
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/SelfService/Display.html/BeforeShowHistory
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Elements/RT__Ticket/ColumnMap/Once
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Elements/ShowTransaction/Default
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Elements/PickPinCommentSearchAttribute
Installing /opt/rt5/plugins/RT-Extension-PinComment/html/Elements/PinCommentBeforeShowHistory
Installing /opt/rt5/plugins/RT-Extension-PinComment/static/css/PinComment.css

I tried moving the directory to the correct local/plugins location but then I get this error when trying to use the Pin function:

Sep 6 13:20:11 rt1a RT: [94437] no value sent for required parameter ‘EmailRecordPath’#012Stack:#012 [/opt/rt504/share/html/Elements/ShowTransaction:332]#012 [/opt/rt504/local/plugins/RT-Extension-PinComment/html/Elements/PinCommentBeforeShowHistory:66]#012 [/opt/rt504/share/html/Widgets/TitleBox:61]#012 [/opt/rt504/local/plugins/RT-Extension-PinComment/html/Elements/PinCommentBeforeShowHistory:78]#012 [/opt/rt504/local/plugins/RT-Extension-PinComment/html/Callbacks/PinComment/Ticket/Display.html/BeforeShowHistory:2]#012 [/opt/rt504/share/html/Ticket/Display.html:68]#012 [/opt/rt504/share/html/Ticket/autohandler:66]#012 [/opt/rt504/sbin/…/lib/RT/Interface/Web.pm:751]#012 [/opt/rt504/sbin/…/lib/RT/Interface/Web.pm:428]#012 [/opt/rt504/share/html/autohandler:53]

Regards,
Ken

Odd. I don’t know what’s changed, or why - the “Makefile.PL” came from Dist::Zilla and is unchanged.
It looks like PREFIX is needed. It seems to work for me when I do this:

tar xzf RT-Extension-PinComment-0.01.tar.gz
cd RT-Extension-PinComment-0.01
PREFIX="/opt/rt5/local" perl Makefile.PL
make
make install

Does that make it work for you (with PREFIX adjusted as necessary)? If so, I’ll update the instructions in the README and make that 0.02.