Closed Bug 236779 Opened 20 years ago Closed 20 years ago

Add UI for changing "linkinfooter" flag for saved searches

Categories

(Bugzilla :: User Accounts, defect, P2)

2.17.7
defect

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: gerv, Assigned: bugreport)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

We need to add linkinfooter UI to the new Saved Searches prefs panel.

Gerv
And perhaps allow people to edit the names - bug 156662.

Gerv
Flags: blocking2.18+
Keywords: regression
Target Milestone: --- → Bugzilla 2.18
Gerv, did you have a plan for this, or want someone else to take it?
Anyone who has time could do it, I guess. It's not hard - just add an extra
column of checkboxes to the UI, get the data to populate them in
DoSavedSearches(), and write SaveSavedSearches() to write the results to the
database. I'd forget name editing at this stage - there are issues there, and
it's not a blocker.

One catch: you may also have to mess with Bugzilla->user or somesuch to make
sure the footer on the results page shows the right thing.

Gerv
Attached patch The patch (obsolete) — Splinter Review
Priority: -- → P2
Attachment #147859 - Flags: review?
Comment on attachment 147859 [details] [diff] [review]
The patch

>-# No SaveSavedSearches() because this panel has no changeable fields (yet).
>+sub SaveSavedSearches() {
>+    my $cgi = Bugzilla->cgi;
>+    my $dbh = Bugzilla->dbh;
>+    my @queries = @{Bugzilla->user->queries};
>+    my $sth = $dbh->prepare("UPDATE namedqueries SET linkinfooter = ?
>+                          WHERE userid = ?
>+                          AND name = ?");

AIUI, you shouldn't use a placeholder for userid because it doesn't change.

>+    foreach my $q (@queries) {
>+        if ($q->{linkinfooter} 
>+            && !defined($cgi->param("linkinfooter_" . $q->{name}))) {

This logic is hard to read immediately - why not simplify, and just UPDATE
whatever the current state is?

Nit: I believe most Bugzilla code quotes hash references in single quotes.

>+            $sth->execute(0, $userid, $q->{name});
>+        } elsif (!$q->{linkinfooter} 
>+            && defined($cgi->param("linkinfooter_" . $q->{name}))) {
>+            $sth->execute(1, $userid, $q->{name});
>+        }
>+    }
>+    Bugzilla->user->flush_queries_cache;

Nit: we tend to put blank lines after closing quotes, unless they are followed
by another closing quote.

>Index: template/en/default/account/prefs/saved-searches.html.tmpl
>===================================================================
> <blockquote>
>+  Show query in page footer
>   <table cellpadding="3">  
>+    <tr>
>+      <th>
>+        |
>+      </th>
>+    </tr>

Ooh, ick. Now that it needs it, can we convert this table to have proper
headings?

>     [% FOREACH q = queries %]
>       <tr>
>+        <td>
>+          <input type="checkbox" 
>+                 name="linkinfooter_[% q.name FILTER html %]"

Are you certain this (and the corresponding Perl) works whatever nasty
characters you put in the query name?

Gerv
Attachment #147859 - Flags: review? → review-
It does work with eascaped characters like "%" in the name.

I'll de-nit this and submit a revised patch.
Great :-) Thanks for doing this, by the way. Feel free to take the bug.

Gerv
(In reply to comment #5)
> (From update of attachment 147859 [details] [diff] [review])
> >+    my $sth = $dbh->prepare("UPDATE namedqueries SET linkinfooter = ?
> >+                          WHERE userid = ?
> >+                          AND name = ?");
> 
> AIUI, you shouldn't use a placeholder for userid because it doesn't change.

But it does change between invocations, when different users connect, and using
a placeholder for it allows MySQL 4's server-side query caching to work.  (not
that it's a terribly intensive query anyway)
Attached patch Patch v2Splinter Review
Changed format to use a table and cleaned up SaveSavedSearches code.
Assignee: gerv → bugreport
Attachment #147859 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #147949 - Flags: review?(gerv)
Comment on attachment 147949 [details] [diff] [review]
Patch v2

>+            defined($cgi->param("linkinfooter_$q->{name}")) ? 1 : 0;
>+            $sth->execute($linkinfooter, $userid, $q->{name});

Aestheticallly, this should be $q->{'name'}.

Other than that, r=preed.
Attachment #147949 - Flags: review+
Flags: approval?
Comment on attachment 147949 [details] [diff] [review]
Patch v2

r=gerv too. Sorry for the delay.

Gerv
Attachment #147949 - Flags: review?(gerv)
Flags: approval? → approval+

Checking in userprefs.cgi;
/cvsroot/mozilla/webtools/bugzilla/userprefs.cgi,v  <--  userprefs.cgi
new revision: 1.58; previous revision: 1.57
done
Checking in template/en/default/account/prefs/prefs.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/account/prefs/prefs.html.tmpl,v
 <--  prefs.html.tmpl
new revision: 1.15; previous revision: 1.14
done
Checking in template/en/default/account/prefs/saved-searches.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/account/prefs/saved-searches.html.tmpl,v
 <--  saved-searches.html.tmpl
new revision: 1.2; previous revision: 1.1
done
Checking in template/en/default/global/useful-links.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/global/useful-links.html.tmpl,v
 <--  useful-links.html.tmpl
new revision: 1.25; previous revision: 1.24
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: