From 3fecb5fbc0e8f4305bb626d58de6e0c47a862d05 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 12 Feb 2014 13:12:17 +0800 Subject: Bug 967910: "IO request failed : undefined" on My Dashboard --- extensions/MyDashboard/lib/WebService.pm | 14 +++++++++++--- extensions/MyDashboard/web/js/flags.js | 25 +++++++++++++++++++++++-- extensions/MyDashboard/web/js/query.js | 17 +++++++++++++++-- 3 files changed, 49 insertions(+), 7 deletions(-) (limited to 'extensions') diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm index 29abbb3a3..806976372 100644 --- a/extensions/MyDashboard/lib/WebService.pm +++ b/extensions/MyDashboard/lib/WebService.pm @@ -38,6 +38,15 @@ sub run_bug_query { next if $qdef->{name} ne $params->{query}; my ($bugs, $query_string) = query_bugs($qdef); + my $last_comment_sql = " + SELECT comment_id + FROM longdescs + WHERE bug_id = ? AND bug_when > ?"; + if (!$user->is_insider) { + $last_comment_sql .= " AND isprivate = 0"; + } + my $last_comment_sth = $dbh->prepare($last_comment_sql); + # Add last changes to each bug foreach my $b (@$bugs) { my $last_changes = {}; @@ -57,9 +66,8 @@ sub run_bug_query { $last_changes->{email} = $change_set->{who}; $last_changes->{when} = $self->datetime_format_inbound($change_set->{when}); } - my $last_comment_id = $dbh->selectrow_array(" - SELECT comment_id FROM longdescs - WHERE bug_id = ? AND bug_when > ?", + my $last_comment_id = $dbh->selectrow_array( + $last_comment_sth, undef, $b->{bug_id}, $changed_date); if ($last_comment_id) { my $comments = $self->comments({ comment_ids => [ $last_comment_id ] }); diff --git a/extensions/MyDashboard/web/js/flags.js b/extensions/MyDashboard/web/js/flags.js index 283a16434..0fcf75618 100644 --- a/extensions/MyDashboard/web/js/flags.js +++ b/extensions/MyDashboard/web/js/flags.js @@ -38,8 +38,11 @@ YUI({ } }, failure: function(o) { - var resp = o.responseText; - alert("IO request failed : " + resp); + if (o.error) { + alert("Failed to load flag list from Bugzilla:\n\n" + o.error.message); + } else { + alert("Failed to load flag list from Bugzilla."); + } } }; @@ -120,6 +123,15 @@ YUI({ // Requestee dataSource.requestee = new Y.DataSource.IO({ source: 'jsonrpc.cgi' }); + dataSource.requestee.on('error', function(e) { + try { + var response = Y.JSON.parse(e.data.responseText); + if (response.error) + e.error.message = response.error.message; + } catch(ex) { + // ignore + } + }); dataTable.requestee = new Y.DataTable({ columns: [ { key: "requester", label: "Requester", sortable: true }, @@ -160,6 +172,15 @@ YUI({ // Requester dataSource.requester = new Y.DataSource.IO({ source: 'jsonrpc.cgi' }); + dataSource.requester.on('error', function(e) { + try { + var response = Y.JSON.parse(e.data.responseText); + if (response.error) + e.error.message = response.error.message; + } catch(ex) { + // ignore + } + }); dataTable.requester = new Y.DataTable({ columns: [ { key:"requestee", label:"Requestee", sortable:true, diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js index cf716fbe3..fe7c00b17 100644 --- a/extensions/MyDashboard/web/js/query.js +++ b/extensions/MyDashboard/web/js/query.js @@ -63,8 +63,11 @@ YUI({ } }, failure: function(o) { - var resp = o.responseText; - alert("IO request failed : " + resp); + if (o.error) { + alert("Failed to load bug list from Bugzilla:\n\n" + o.error.message); + } else { + alert("Failed to load bug list from Bugzilla."); + } } }; @@ -113,6 +116,16 @@ YUI({ } }); + dataSource.on('error', function(e) { + try { + var response = Y.JSON.parse(e.data.responseText); + if (response.error) + e.error.message = response.error.message; + } catch(ex) { + // ignore + } + }); + dataTable = new Y.DataTable({ columns: [ { key: Y.Plugin.DataTableRowExpansion.column_key, label: ' ', sortable: false }, -- cgit v1.2.3-24-g4f1b