Bug 406271

Summary: 3.17: Comment customization for the EIT product for Intel.
Product: [Community] Bugzilla Reporter: David Lawrence <dkl>
Component: Bugzilla GeneralAssignee: Noura El hawary <nelhawar>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 3.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: 2 hours for selenium testing
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 520436 (view as bug list) Environment:
Last Closed: 2008-05-22 06:37:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 406071, 427057    
Attachments:
Description Flags
v1 for customizing bug entry comment
dkl: review-
v2 for customizing bug entry comment
none
v3 for customizing bug entry comment
dkl: review-
v4 for customizing bug entry comment none

Description David Lawrence 2007-11-30 16:58:28 UTC
Description:
Intel requested of Red Hat to have a different boilerplate comment display for the EIT product in Bugzilla specific to the details they need in the report.

Function Requirements:
template/en/default/bug/create/comment.html.tmpl

Comment 1 Noura El hawary 2007-12-19 17:28:17 UTC
LOC estimation:

in 3.2 there is still the template
template/en/default/bug/create/comment.txt.tmpl as how it is in 2_18 we just
have to add IF ELSE to include the comment customization for the EIT product ,,
which is about 25 LOC 


Unit Test:

Would be a selenium test to verify that for creating new bugs under the EIT
product the customized comment text is the one that will appear in the
description text box.

Basically every action in the web ui is selenium line so the test for this case
would be about 25 LOC

TOTAL LOC = 25 + 25 = 50 LOC

Comment 2 Noura El hawary 2007-12-20 13:43:09 UTC
Please Note changed selenium test estimation from LOC to time estimation

Comment 3 Noura El hawary 2008-03-27 03:29:23 UTC
Created attachment 299257 [details]
v1 for customizing bug entry comment

This patch include new hook 'defaultcontent' added to template
template/en/default/bug/create/create.html.tmpl that connects to the template
hook under new extension :
extensions/enter_bug_comment/template/en/bug/create/create-defaultcontent.html.tmpl


and it will add the defaultcomment that is usually in all bug reports as we
have it in 2.18 and for the EIT product it will add its customized comment to
the bug entry report.

Please review when you can and let me know what you think.

Thanks,
Noura

Comment 4 Noura El hawary 2008-03-27 03:40:08 UTC
spent alot of time trying to figure out how the template hook works

Comment 5 Noura El hawary 2008-03-27 03:42:05 UTC
I have the patch applied to bugdev.devel.redhat.com if you would like to test it
there 

Comment 6 David Lawrence 2008-03-27 04:15:12 UTC
Comment on attachment 299257 [details]
v1 for customizing bug entry comment

>+[% USE Bugzilla %]
>+[% Bugzilla.cgi.param("comment") %]
>+[% IF Bugzilla.cgi.param("comment") %]
>+  [% Bugzilla.cgi.param("comment") %]

Why are you printing Bugzilla.cgi.param('comment') twice?

[% IF Bugzilla.cgi.param("comment") %]
  [% Bugzilla.cgi.param("comment") %]

should be enough.

Also there is already a $vars->{comment} being passed in from enter_bug.cgi
line 456 so you could just do:

[% IF comment %]
  [% comment FILTER none %]

>+[% ELSE %]
>+    [% IF Bugzilla.cgi.param("product") == "EIT" %]

Also here you can just use product.name. No need to import Bugzilla.cgi.

[% ELSE %]
    [% IF product.name == "EIT" %]


>           # by global/textarea.html.tmpl. So we must not escape the comment here. %]
>         [% comment FILTER none %]
>       [%- END %]
>+  
>+      [% defaultcontent = Hook.process("defaultcontent") %]
>       [% INCLUDE global/textarea.html.tmpl
>          name           = 'comment'
>          id             = 'comment'

On line 457, the template is checking to see if the bug is being cloned by
checking for cloned_bug_id. If true defaultcontent is assigned text for the
cloned bug. You are overriding defaultcontent with
Hook.process'defaultcontent'). So you may need to move the cloned_bug_id
defaultcontent block into the extension so if bugs are being cloned they can
still get the cloned comment prepended to the text. Or if we leave the
cloned_bug_id text in create.html.tmpl you can do

% defaultcontent = defaultcontent _ Hook.process("defaultcontent") %]

Comment 7 Noura El hawary 2008-03-27 05:19:02 UTC
Created attachment 299273 [details]
v2 for customizing bug entry comment

Thanks for the review Dave,, Another patch with your suggestions.

Noura

Comment 8 Noura El hawary 2008-03-27 05:46:38 UTC
Created attachment 299281 [details]
v3 for customizing bug entry comment

Please ignore previous patch and review this one. 

Noura

Comment 9 David Lawrence 2008-03-27 15:32:42 UTC
Comment on attachment 299281 [details]
v3 for customizing bug entry comment

Actually after testing this, it doesn't work right as I originally suggested.
Notes below

>+[% IF comment %]
>+  [% comment FILTER none %]

'comment' is already included in the defaultcontent BLOCK in create.html.tmpl
so it will print
comment twice if we do this.

Change this to 

[% IF defaultcontent %]
  [% defaultcontent FILTER none %]

The rest of create-defaultcontent.html.tmpl looks fine.

>+[% ELSE %]
>+  [% IF product.name == "EIT" %]
>+Environment:
>+------------
>+BIOS Version:
>+BIOS Type (EFI or Legacy):
[snip]

>           # by global/textarea.html.tmpl. So we must not escape the comment here. %]
>         [% comment FILTER none %]
>       [%- END %]
>+  
>+      [% defaultcontent = defaultcontent _ Hook.process("defaultcontent") %]

Since 'comment' var is already included in the defaultcontent BLOCK above we
can just print defaultcontent value in the extension template as stated above.
So you can change the above to only be:

	[% defaultcontent = Hook.process("defaultcontent") %]

Also make sure to add the [%# REDHAT EXTENSION START <bugid> %] tags around the
Hook.process() part.

After these changes then r=dkl and go ahead and checkin.

Dave

Comment 10 Noura El hawary 2008-03-28 01:40:10 UTC
Created attachment 299421 [details]
v4 for customizing bug entry comment

Thanks for the review Dave ,, I have made the fixes and committed the attached
patch to cvs.

Noura