From ffb13d2d20343c9f3279b95e3106159551eab559 Mon Sep 17 00:00:00 2001 From: Emma Humphries Date: Thu, 15 Mar 2018 10:26:34 -0700 Subject: Bug 1446042 - Please remove the IPC request form in Bugzilla --- .../en/default/bug/create/comment-ipc.txt.tmpl | 47 ---- .../en/default/bug/create/create-ipc.html.tmpl | 259 --------------------- extensions/BMO/web/images/ipc_form_buildscreen.png | Bin 102103 -> 0 bytes 3 files changed, 306 deletions(-) delete mode 100644 extensions/BMO/template/en/default/bug/create/comment-ipc.txt.tmpl delete mode 100644 extensions/BMO/template/en/default/bug/create/create-ipc.html.tmpl delete mode 100644 extensions/BMO/web/images/ipc_form_buildscreen.png (limited to 'extensions') diff --git a/extensions/BMO/template/en/default/bug/create/comment-ipc.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-ipc.txt.tmpl deleted file mode 100644 index b644ee469..000000000 --- a/extensions/BMO/template/en/default/bug/create/comment-ipc.txt.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% USE Bugzilla %] -[% cgi = Bugzilla.cgi %] - ->> What team are you are a part of? -[%+ cgi.param("team_name") %] - ->> Will your snippet need to appear in a language other than English? -[%+ cgi.param("language").join(', ') %] - ->> Does your snippet need to be targeted to a particular country? -[%+ cgi.param("target_country") %] - ->> Insert your tagged link here. -[%+ cgi.param("tagged_link") %] - -[% IF cgi.param('start_run') %] ->> When would you like your snippet to start its run? -[%+ cgi.param("start_run") %] - -[% END %] -[% IF cgi.param('complete_run') %] ->> When would you like your snippet to complete its run? -[%+ cgi.param("complete_run") %] - -[% END %] ->> Will you be able to provide the following assets for your snippet? -[%+ cgi.param("snippet_assets").join(', ') %] - ->> Your name? -[%+ cgi.param("name") %] - ->> E-mail? -[%+ cgi.param("email") %] - ->> Anything else you would like to add? -[%+ cgi.param("else") %] - ->> Who do you think is coolest? -[%+ cgi.param("bonus") %] diff --git a/extensions/BMO/template/en/default/bug/create/create-ipc.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-ipc.html.tmpl deleted file mode 100644 index e32ba62dc..000000000 --- a/extensions/BMO/template/en/default/bug/create/create-ipc.html.tmpl +++ /dev/null @@ -1,259 +0,0 @@ -[%# 1.0@bugzilla.org %] -[%# The contents of this file are subject to the Mozilla Public - # License Version 1.1 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.mozilla.org/MPL/ - - # - # Software distributed under the License is distributed on an "AS - # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - # implied. See the License for the specific language governing - # rights and limitations under the License. - # - # The Original Code is the Bugzilla Bug Tracking System. - # - # The Initial Developer of the Original Code is Mozilla Corporation. - # Portions created by Mozilla are Copyright (C) 2008 Mozilla - # Corporation. All Rights Reserved. - # - # Contributor(s): Sebastin Santy - #%] - -[% PROCESS global/variables.none.tmpl %] - -[% inline_style = BLOCK %] -#heading { - width: 98%; - font-size: 2em; - font-weight: bold; - margin: 12px; -} -.required:before { - content: "* "; - color: red; -} -.required_star { - color: red; -} -p { - max-width: 40%; -} -.row { - padding-bottom: 10px; -} -[% END %] - -[% inline_javascript = BLOCK %] -$(document).ready(function() { - $('.date_field').datetimepicker({ - format: 'Y-m-d', - datepicker: true, - timepicker: false, - scrollInput: false, - lazyInit: false, - closeOnDateSelect: true - }); - $('#langothers').on('focus', function(){ - document.getElementById("langothersradio").checked = true; - }); - $('#assetothers').on('focus', function(){ - document.getElementById("assetothersradio").checked = true; - }); - $('.date_field-img') - .click(function(event) { - var id = $(event.target).attr('id').replace(/-img$/, ''); - $('#' + id).datetimepicker('show'); - }); - $('#ipcForm').submit(function() { - $('#short_desc').val($('#short_desc').val() + ': ' + $('#team_name').val()); - }); - $('#new_email_request').on('change', function() { - if ($('#new_email_request').val() == 'Yes') { - $('#email_cadence_row').show(); - $('input[name="email_cadence"]').each(function() { - $(this).attr('required', true); - }); - } - else { - $('#email_cadence_row').hide(); - $('input[name="email_cadence"]').each(function() { - $(this).removeProp('required'); - }); - } - }); -}); -[% END %] - -[% PROCESS global/header.html.tmpl - title = "IPC Request" - generate_api_token = 1 - style_urls = [ "skins/standard/attachment.css", - "js/jquery/plugins/datetimepicker/datetimepicker.css" ] - style = inline_style - javascript = inline_javascript - javascript_urls = [ "js/field.js", "js/util.js" ] - jquery = [ "datetimepicker" ] -%] - -
IPC Requests
-
-

You’ve decided to use the snippet channel to drive attention to one of your projects, awesome! The snippet channel drives hundreds of millions of impressions a month. It’s great tool to support your marketing efforts. Complete this form and we will follow up with you soon (maybe today, but definitely within 3 days). -

-

- Tell us more: -

- -
- - - - - - - - - - - [% IF user.in_group('canconfirm') %] - - [% END %] - -
-
- -
- -
- -
-
- -
- -
- -
-
- Will your snippet need to appear in a language other than English? If so, please specify. -
- -
- -
- -
- -
- -
- -
- - - -
- -
-
- -
- -
- -

- If you would like your snippet to include a link, please tag it by using the URL builder (https://bit.ly/1JOgDr1) and following the steps below: -

-

-
-
- -
- -
- -

- Please reference the Mozilla In-Product Messaging Calendar for available dates. https://bit.ly/2aZ3w9c -

- -
-
- -
- - -
- -
-
- -
- - -
- -
-
- Will you be able to provide the following assets for your snippet? Check all that apply.
- Feel free to look at our existing icon library: - https://bit.ly/2efXaFo -
- -
- -
- -
- - - -
- - - - - -
-
- -
- -
-

Bonus Question

-
-
- Who do you think is coolest? -
- -
- -
- -
- -
-
- -

Thanks for reaching out. Click submit and we will be back with you shortly.

- - -

- [ * Required Field ] -

-
-
- -[% PROCESS global/footer.html.tmpl %] \ No newline at end of file diff --git a/extensions/BMO/web/images/ipc_form_buildscreen.png b/extensions/BMO/web/images/ipc_form_buildscreen.png deleted file mode 100644 index d98207d29..000000000 Binary files a/extensions/BMO/web/images/ipc_form_buildscreen.png and /dev/null differ -- cgit v1.2.3-24-g4f1b From 085c32acdac27c99549dfb1bef50ccb8c3949294 Mon Sep 17 00:00:00 2001 From: Israel Madueme Date: Mon, 19 Mar 2018 10:57:17 -0400 Subject: Bug 1440328 - Obfuscate mentor email for users that aren't logged in --- extensions/BMO/template/en/default/pages/user_activity.html.tmpl | 1 + .../BugModal/template/en/default/bug_modal/activity_stream.html.tmpl | 2 +- .../template/en/default/hook/bug/comments-aftercomments.html.tmpl | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl index 075c8edf9..5603b943f 100644 --- a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl +++ b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl @@ -199,6 +199,7 @@ change.fieldname == 'reporter' || change.fieldname == 'qa_contact' || change.fieldname == 'cc' || + change.fieldname == 'bug_mentor' || change.fieldname == 'flagtypes.name' %] [% display_value(change.fieldname, change_type) FILTER email FILTER html %] [% ELSE %] diff --git a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl index a8d55c137..51919ab27 100644 --- a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl @@ -365,7 +365,7 @@ ", " UNLESS loop.last; END; - CASE [ 'assigned_to', 'reporter', 'qa_contact', 'cc', 'flagtypes.name' ]; + CASE [ 'assigned_to', 'reporter', 'qa_contact', 'cc', 'bug_mentor', 'flagtypes.name' ]; value FILTER email; CASE 'reporter_accessible'; diff --git a/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl b/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl index d0a3abb5b..32e6499cb 100644 --- a/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl +++ b/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl @@ -155,6 +155,7 @@ change.fieldname == 'reporter' || change.fieldname == 'qa_contact' || change.fieldname == 'cc' || + change.fieldname == 'bug_mentor' || change.fieldname == 'flagtypes.name' %] [% value FILTER email FILTER js %] [% ELSIF change.fieldtype == constants.FIELD_TYPE_DATETIME %] -- cgit v1.2.3-24-g4f1b From 293a5bd57b3a50c5130c299b3f53b357f683a33e Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 20 Mar 2018 09:27:33 -0400 Subject: Bug 1447291 - Remove Apache2::Log from PhabBugs/Push in favor of logging framework --- extensions/PhabBugz/Extension.pm | 1 - extensions/PhabBugz/lib/Daemon.pm | 5 +-- extensions/PhabBugz/lib/Feed.pm | 80 +++++++++++++++++++-------------------- extensions/PhabBugz/lib/Logger.pm | 37 ------------------ extensions/Push/lib/Logger.pm | 52 +++++++++++-------------- 5 files changed, 63 insertions(+), 112 deletions(-) delete mode 100644 extensions/PhabBugz/lib/Logger.pm (limited to 'extensions') diff --git a/extensions/PhabBugz/Extension.pm b/extensions/PhabBugz/Extension.pm index b3ad44819..ee96901a2 100644 --- a/extensions/PhabBugz/Extension.pm +++ b/extensions/PhabBugz/Extension.pm @@ -15,7 +15,6 @@ use parent qw(Bugzilla::Extension); use Bugzilla::Constants; use Bugzilla::Extension::PhabBugz::Feed; -use Bugzilla::Extension::PhabBugz::Logger; our $VERSION = '0.01'; diff --git a/extensions/PhabBugz/lib/Daemon.pm b/extensions/PhabBugz/lib/Daemon.pm index c8b4f73af..ef4a00534 100644 --- a/extensions/PhabBugz/lib/Daemon.pm +++ b/extensions/PhabBugz/lib/Daemon.pm @@ -13,7 +13,6 @@ use warnings; use Bugzilla::Constants; use Bugzilla::Extension::PhabBugz::Feed; -use Bugzilla::Extension::PhabBugz::Logger; use Carp qw(confess); use Daemon::Generic; @@ -89,11 +88,9 @@ sub gd_setup_signals { sub gd_run { my $self = shift; - $::SIG{__DIE__} = \&Carp::confess if $self->{debug}; + $SIG{__DIE__} = \&Carp::confess if $self->{debug}; my $phabbugz = Bugzilla::Extension::PhabBugz::Feed->new(); $phabbugz->is_daemon(1); - $phabbugz->logger( - Bugzilla::Extension::PhabBugz::Logger->new(debugging => $self->{debug})); $phabbugz->start(); } diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index 9904d5090..323681ebc 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -13,6 +13,7 @@ use List::Util qw(first); use List::MoreUtils qw(any); use Moo; +use Bugzilla::Logging; use Bugzilla::Constants; use Bugzilla::Search; use Bugzilla::Util qw(diff_arrays with_writable_database with_readonly_database); @@ -36,7 +37,6 @@ use Bugzilla::Extension::PhabBugz::Util qw( ); has 'is_daemon' => ( is => 'rw', default => 0 ); -has 'logger' => ( is => 'rw' ); sub start { my ($self) = @_; @@ -48,7 +48,7 @@ sub start { } 1; }; - $self->logger->error( $@ // "unknown exception" ) unless $ok; + ERROR( $@ // "unknown exception" ) unless $ok; sleep(PHAB_POLL_SECONDS); } } @@ -59,19 +59,19 @@ sub feed_query { # Ensure Phabricator syncing is enabled if (!Bugzilla->params->{phabricator_enabled}) { - $self->logger->info("PHABRICATOR SYNC DISABLED"); + INFO("PHABRICATOR SYNC DISABLED"); return; } # PROCESS NEW FEED TRANSACTIONS - $self->logger->info("FEED: Fetching new transactions"); + INFO("FEED: Fetching new transactions"); my $story_last_id = $self->get_last_id('feed'); # Check for new transctions (stories) my $new_stories = $self->new_stories($story_last_id); - $self->logger->info("FEED: No new stories") unless @$new_stories; + INFO("FEED: No new stories") unless @$new_stories; # Process each story foreach my $story_data (@$new_stories) { @@ -81,15 +81,15 @@ sub feed_query { my $object_phid = $story_data->{objectPHID}; my $story_text = $story_data->{text}; - $self->logger->debug("STORY ID: $story_id"); - $self->logger->debug("STORY PHID: $story_phid"); - $self->logger->debug("AUTHOR PHID: $author_phid"); - $self->logger->debug("OBJECT PHID: $object_phid"); - $self->logger->info("STORY TEXT: $story_text"); + DEBUG("STORY ID: $story_id"); + DEBUG("STORY PHID: $story_phid"); + DEBUG("AUTHOR PHID: $author_phid"); + DEBUG("OBJECT PHID: $object_phid"); + INFO("STORY TEXT: $story_text"); # Only interested in changes to revisions for now. if ($object_phid !~ /^PHID-DREV/) { - $self->logger->debug("SKIPPING: Not a revision change"); + DEBUG("SKIPPING: Not a revision change"); $self->save_last_id($story_id, 'feed'); next; } @@ -99,7 +99,7 @@ sub feed_query { if (@$phab_users) { my $user = Bugzilla::User->new({ id => $phab_users->[0]->{id}, cache => 1 }); if ($user->login eq PHAB_AUTOMATION_USER) { - $self->logger->debug("SKIPPING: Change made by phabricator user"); + DEBUG("SKIPPING: Change made by phabricator user"); $self->save_last_id($story_id, 'feed'); next; } @@ -113,13 +113,13 @@ sub feed_query { # PROCESS NEW USERS - $self->logger->info("FEED: Fetching new users"); + INFO("FEED: Fetching new users"); my $user_last_id = $self->get_last_id('user'); # Check for new users my $new_users = $self->new_users($user_last_id); - $self->logger->info("FEED: No new users") unless @$new_users; + INFO("FEED: No new users") unless @$new_users; # Process each new user foreach my $user_data (@$new_users) { @@ -128,10 +128,10 @@ sub feed_query { my $user_realname = $user_data->{fields}{realName}; my $object_phid = $user_data->{phid}; - $self->logger->debug("USER ID: $user_id"); - $self->logger->debug("USER LOGIN: $user_login"); - $self->logger->debug("USER REALNAME: $user_realname"); - $self->logger->debug("OBJECT PHID: $object_phid"); + DEBUG("USER ID: $user_id"); + DEBUG("USER LOGIN: $user_login"); + DEBUG("USER REALNAME: $user_realname"); + DEBUG("OBJECT PHID: $object_phid"); with_readonly_database { $self->process_new_user($user_data); @@ -151,15 +151,15 @@ sub process_revision_change { if (!$revision->bug_id) { if ($story_text =~ /\s+created\s+D\d+/) { # If new revision and bug id was omitted, make revision public - $self->logger->debug("No bug associated with new revision. Marking public."); + DEBUG("No bug associated with new revision. Marking public."); $revision->set_policy('view', 'public'); $revision->set_policy('edit', 'users'); $revision->update(); - $self->logger->info("SUCCESS"); + INFO("SUCCESS"); return; } else { - $self->logger->debug("SKIPPING: No bug associated with revision change"); + DEBUG("SKIPPING: No bug associated with revision change"); return; } } @@ -170,7 +170,7 @@ sub process_revision_change { $revision->title, $revision->bug_id, $story_text); - $self->logger->info($log_message); + INFO($log_message); # Pre setup before making changes my $old_user = set_phab_user(); @@ -180,7 +180,7 @@ sub process_revision_change { # If bug is public then remove privacy policy if (!@{ $bug->groups_in }) { - $self->logger->debug('Bug is public so setting view/edit public'); + DEBUG('Bug is public so setting view/edit public'); $revision->set_policy('view', 'public'); $revision->set_policy('edit', 'users'); my $secure_project_phid = get_project_phid('secure-revision'); @@ -193,7 +193,7 @@ sub process_revision_change { # If bug privacy groups do not have any matching synchronized groups, # then leave revision private and it will have be dealt with manually. if (!@set_groups) { - $self->logger->debug('No matching groups. Adding comments to bug and revision'); + DEBUG('No matching groups. Adding comments to bug and revision'); add_security_sync_comments([$revision], $bug); } # Otherwise, we create a new custom policy containing the project @@ -205,23 +205,23 @@ sub process_revision_change { # we leave the current policy alone. my $current_policy; if ($revision->view_policy =~ /^PHID-PLCY/) { - $self->logger->debug("Loading current policy: " . $revision->view_policy); + DEBUG("Loading current policy: " . $revision->view_policy); $current_policy = Bugzilla::Extension::PhabBugz::Policy->new_from_query({ phids => [ $revision->view_policy ]}); my $current_projects = $current_policy->rule_projects; - $self->logger->debug("Current policy projects: " . join(", ", @$current_projects)); + DEBUG("Current policy projects: " . join(", ", @$current_projects)); my ($added, $removed) = diff_arrays($current_projects, \@set_projects); if (@$added || @$removed) { - $self->logger->debug('Project groups do not match. Need new custom policy'); + DEBUG('Project groups do not match. Need new custom policy'); $current_policy= undef; } else { - $self->logger->debug('Project groups match. Leaving current policy as-is'); + DEBUG('Project groups match. Leaving current policy as-is'); } } if (!$current_policy) { - $self->logger->debug("Creating new custom policy: " . join(", ", @set_projects)); + DEBUG("Creating new custom policy: " . join(", ", @set_projects)); my $new_policy = Bugzilla::Extension::PhabBugz::Policy->create(\@set_projects); $revision->set_policy('view', $new_policy->phid); $revision->set_policy('edit', $new_policy->phid); @@ -250,11 +250,11 @@ sub process_revision_change { next if $attach_revision_id != $revision->id; my $make_obsolete = $revision->status eq 'abandoned' ? 1 : 0; - $self->logger->debug('Updating obsolete status on attachmment ' . $attachment->id); + DEBUG('Updating obsolete status on attachmment ' . $attachment->id); $attachment->set_is_obsolete($make_obsolete); if ($revision->title ne $attachment->description) { - $self->logger->debug('Updating description on attachment ' . $attachment->id); + DEBUG('Updating description on attachment ' . $attachment->id); $attachment->set_description($revision->title); } @@ -270,7 +270,7 @@ sub process_revision_change { }); foreach my $attachment (@$other_attachments) { $other_bugs{$attachment->bug_id}++; - $self->logger->debug('Updating obsolete status on attachment ' . + DEBUG('Updating obsolete status on attachment ' . $attachment->id . " for bug " . $attachment->bug_id); $attachment->set_is_obsolete(1); $attachment->update($timestamp); @@ -362,7 +362,7 @@ sub process_revision_change { Bugzilla->set_user($old_user); - $self->logger->info('SUCCESS: Revision D' . $revision->id . ' processed'); + INFO('SUCCESS: Revision D' . $revision->id . ' processed'); } sub process_new_user { @@ -372,7 +372,7 @@ sub process_new_user { my $phab_user = Bugzilla::Extension::PhabBugz::User->new($user_data); if (!$phab_user->bugzilla_id) { - $self->logger->debug("SKIPPING: No bugzilla id associated with user"); + DEBUG("SKIPPING: No bugzilla id associated with user"); return; } @@ -425,7 +425,7 @@ sub process_new_user { my @bug_ids = map { shift @$_ } @$data; foreach my $bug_id (@bug_ids) { - $self->logger->debug("Processing bug $bug_id"); + DEBUG("Processing bug $bug_id"); my $bug = Bugzilla::Bug->new({ id => $bug_id, cache => 1 }); @@ -434,7 +434,7 @@ sub process_new_user { foreach my $attachment (@attachments) { my ($revision_id) = ($attachment->filename =~ PHAB_ATTACHMENT_PATTERN); - $self->logger->debug("Processing revision D$revision_id"); + DEBUG("Processing revision D$revision_id"); my $revision = Bugzilla::Extension::PhabBugz::Revision->new_from_query( { ids => [ int($revision_id) ] }); @@ -442,13 +442,13 @@ sub process_new_user { $revision->add_subscriber($phab_user->phid); $revision->update(); - $self->logger->debug("Revision $revision_id updated"); + DEBUG("Revision $revision_id updated"); } } Bugzilla->set_user($old_user); - $self->logger->info('SUCCESS: User ' . $phab_user->id . ' processed'); + INFO('SUCCESS: User ' . $phab_user->id . ' processed'); } ################## @@ -496,7 +496,7 @@ sub get_last_id { my $last_id = Bugzilla->dbh->selectrow_array( " SELECT value FROM phabbugz WHERE name = ?", undef, $type_full ); $last_id ||= 0; - $self->logger->debug( "QUERY " . uc($type_full) . ": $last_id" ); + DEBUG( "QUERY " . uc($type_full) . ": $last_id" ); return $last_id; } @@ -505,7 +505,7 @@ sub save_last_id { # Store the largest last key so we can start from there in the next session my $type_full = $type . "_last_id"; - $self->logger->debug( "UPDATING " . uc($type_full) . ": $last_id" ); + DEBUG( "UPDATING " . uc($type_full) . ": $last_id" ); Bugzilla->dbh->do( "REPLACE INTO phabbugz (name, value) VALUES (?, ?)", undef, $type_full, $last_id ); } diff --git a/extensions/PhabBugz/lib/Logger.pm b/extensions/PhabBugz/lib/Logger.pm deleted file mode 100644 index 3127b66db..000000000 --- a/extensions/PhabBugz/lib/Logger.pm +++ /dev/null @@ -1,37 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This Source Code Form is "Incompatible With Secondary Licenses", as -# defined by the Mozilla Public License, v. 2.0. - -package Bugzilla::Extension::PhabBugz::Logger; - -use 5.10.1; - -use Moo; - -use Bugzilla::Extension::PhabBugz::Constants; - -has 'debugging' => ( is => 'ro' ); - -sub info { shift->_log_it('INFO', @_) } -sub error { shift->_log_it('ERROR', @_) } -sub debug { shift->_log_it('DEBUG', @_) } - -sub _log_it { - my ($self, $method, $message) = @_; - - return if $method eq 'DEBUG' && !$self->debugging; - chomp $message; - if ($ENV{MOD_PERL}) { - require Apache2::Log; - Apache2::ServerRec::warn("FEED $method: $message"); - } elsif ($ENV{SCRIPT_FILENAME}) { - print STDERR "FEED $method: $message\n"; - } else { - print STDERR '[' . localtime(time) ."] $method: $message\n"; - } -} - -1; diff --git a/extensions/Push/lib/Logger.pm b/extensions/Push/lib/Logger.pm index 833cb3b19..5d92010ee 100644 --- a/extensions/Push/lib/Logger.pm +++ b/extensions/Push/lib/Logger.pm @@ -8,53 +8,43 @@ package Bugzilla::Extension::Push::Logger; use 5.10.1; -use strict; -use warnings; +use Moo; +use Bugzilla::Logging; +use Log::Log4perl; use Bugzilla::Extension::Push::Constants; use Bugzilla::Extension::Push::LogEntry; -sub new { - my ($class) = @_; - my $self = {}; - bless($self, $class); - return $self; -} +# If Log4perl then finds that it's being called from a registered wrapper, it +# will automatically step up to the next call frame. +Log::Log4perl->wrapper_register(__PACKAGE__); -sub info { shift->_log_it('INFO', @_) } -sub error { shift->_log_it('ERROR', @_) } -sub debug { shift->_log_it('DEBUG', @_) } +sub info { + my ($this, $message) = @_; + INFO($message); +} -sub debugging { - my ($self) = @_; - return $self->{debug}; +sub error { + my ($this, $message) = @_; + ERROR($message); } -sub _log_it { - require Apache2::Log; - my ($self, $method, $message) = @_; - return if $method eq 'DEBUG' && !$self->debugging; - chomp $message; - if ($ENV{MOD_PERL}) { - Apache2::ServerRec::warn("Push $method: $message"); - } elsif ($ENV{SCRIPT_FILENAME}) { - print STDERR "Push $method: $message\n"; - } else { - print STDERR '[' . localtime(time) ."] $method: $message\n"; - } +sub debug { + my ($this, $message) = @_; + DEBUG($message); } sub result { my ($self, $connector, $message, $result, $data) = @_; $data ||= ''; - $self->info(sprintf( - "%s: Message #%s: %s %s", + my $log_msg = sprintf + '%s: Message #%s: %s %s', $connector->name, $message->message_id, push_result_to_string($result), - $data - )); + $data; + $self->info($log_msg); Bugzilla::Extension::Push::LogEntry->create({ message_id => $message->message_id, @@ -68,4 +58,6 @@ sub result { }); } +sub _build_logger { Log::Log4perl->get_logger(__PACKAGE__); } + 1; -- cgit v1.2.3-24-g4f1b From 40023c4a9f7d949f623b3b6fa90c9cbf5dfc2351 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 20 Mar 2018 10:06:20 -0400 Subject: Bug 1444008 - Form action injection in Bugzilla /user_profile (leads to XSS/single-factor credential leakage) --- extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl index 27cb825ed..fd72091dc 100644 --- a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl +++ b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl @@ -27,7 +27,7 @@   Search -
+ [% INCLUDE global/userselect.html.tmpl id => "login" name => "login" -- cgit v1.2.3-24-g4f1b From 24eeb9e547d9a49838dea6c796ede1ce2bcbd5f3 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 21 Mar 2018 09:30:20 -0400 Subject: Bug 1444008 - Fix sanity tests for unfiltered urlbase --- extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl index fd72091dc..bea0d16d7 100644 --- a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl +++ b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl @@ -27,7 +27,7 @@   Search - + [% INCLUDE global/userselect.html.tmpl id => "login" name => "login" -- cgit v1.2.3-24-g4f1b From 7ed1891fb2b81514d090969aece07a8e0be894f1 Mon Sep 17 00:00:00 2001 From: dklawren Date: Fri, 23 Mar 2018 11:15:51 -0400 Subject: Bug 1446974 - Revert changes of the subscribers list on secure revisions --- extensions/PhabBugz/lib/Feed.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'extensions') diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index 323681ebc..006ab04f3 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -229,10 +229,12 @@ sub process_revision_change { my $secure_project_phid = get_project_phid('secure-revision'); $revision->add_project($secure_project_phid); - - my $subscribers = get_bug_role_phids($bug); - $revision->set_subscribers($subscribers); } + + # Subscriber list of the private revision should always match + # the bug roles such as assignee, qa contact, and cc members. + my $subscribers = get_bug_role_phids($bug); + $revision->set_subscribers($subscribers); } my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()"); -- cgit v1.2.3-24-g4f1b From 8c3378b021f646ca81a012888c5481b3f1681759 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 23 Mar 2018 15:58:17 -0400 Subject: Bug 1447410 - Make it so you can always request review from .bugs or .tld accounts --- extensions/Review/Extension.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'extensions') diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index db2b475a1..f05f2ba8b 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -93,6 +93,8 @@ sub _reviewers_objs { sub _user_is_active { my ($self) = @_; + # never consider .bugs or .tld addresses as inactive. + return 1 if $self->login =~ /bugs$/ || $self->login =~ /\.tld$/; return 1 unless Bugzilla->params->{max_reviewer_last_seen}; return 0 if !defined($self->last_seen_date); -- cgit v1.2.3-24-g4f1b From cb2c33d3bd9542a7ee3855a8551813dc8e85ce05 Mon Sep 17 00:00:00 2001 From: dklawren Date: Tue, 27 Mar 2018 15:11:05 -0400 Subject: Bug 1440829 - Bugzilla comment for Phabricator commit should include entire commit message, not just first line --- extensions/PhabBugz/lib/Feed.pm | 2 +- extensions/PhabBugz/lib/Revision.pm | 2 ++ extensions/PhabBugz/lib/Util.pm | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'extensions') diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index 006ab04f3..bfd395f51 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -239,7 +239,7 @@ sub process_revision_change { my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()"); - my $attachment = create_revision_attachment($bug, $revision->id, $revision->title, $timestamp); + my $attachment = create_revision_attachment($bug, $revision, $timestamp); # ATTACHMENT OBSOLETES diff --git a/extensions/PhabBugz/lib/Revision.pm b/extensions/PhabBugz/lib/Revision.pm index c114de78c..98c3196c2 100644 --- a/extensions/PhabBugz/lib/Revision.pm +++ b/extensions/PhabBugz/lib/Revision.pm @@ -29,6 +29,7 @@ use Bugzilla::Extension::PhabBugz::Util qw( has id => ( is => 'ro', isa => Int ); has phid => ( is => 'ro', isa => Str ); has title => ( is => 'ro', isa => Str ); +has summary => ( is => 'ro', isa => Str ); has status => ( is => 'ro', isa => Str ); has creation_ts => ( is => 'ro', isa => Str ); has modification_ts => ( is => 'ro', isa => Str ); @@ -93,6 +94,7 @@ sub BUILDARGS { my ( $class, $params ) = @_; $params->{title} = $params->{fields}->{title}; + $params->{summary} = $params->{fields}->{summary}; $params->{status} = $params->{fields}->{status}->{value}; $params->{creation_ts} = $params->{fields}->{dateCreated}; $params->{modification_ts} = $params->{fields}->{dateModified}; diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index 6c51df98c..52ea9c0d5 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -77,12 +77,12 @@ sub _get_revisions { } sub create_revision_attachment { - my ( $bug, $revision_id, $revision_title, $timestamp ) = @_; + my ( $bug, $revision, $timestamp ) = @_; my $phab_base_uri = Bugzilla->params->{phabricator_base_uri}; ThrowUserError('invalid_phabricator_uri') unless $phab_base_uri; - my $revision_uri = $phab_base_uri . "D" . $revision_id; + my $revision_uri = $phab_base_uri . "D" . $revision->id; # Check for previous attachment with same revision id. # If one matches then return it instead. This is fine as @@ -102,8 +102,8 @@ sub create_revision_attachment { bug => $bug, creation_ts => $timestamp, data => $revision_uri, - description => $revision_title, - filename => 'phabricator-D' . $revision_id . '-url.txt', + description => $revision->title, + filename => 'phabricator-D' . $revision->id . '-url.txt', ispatch => 0, isprivate => 0, mimetype => PHAB_CONTENT_TYPE, @@ -111,8 +111,8 @@ sub create_revision_attachment { ); # Insert a comment about the new attachment into the database. - $bug->add_comment('', { type => CMT_ATTACHMENT_CREATED, - extra_data => $attachment->id }); + $bug->add_comment($revision->summary, { type => CMT_ATTACHMENT_CREATED, + extra_data => $attachment->id }); return $attachment; } -- cgit v1.2.3-24-g4f1b From 8f610ecde482b38120f56fb54a83974cc335120d Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 29 Mar 2018 15:30:02 +0200 Subject: Bug 1441063: Fix the unaccepted revision comment (PhabBugz) * PhabBugz: Fix the unaccepted revision comment Summary: Currently, we're sending the "User removed from revision" comment when the Accept flag has been removed from a revision. This could happen in a number of use cases: 1. The reviewer resigned from being a reviewer. 2. The reviewer has been removed from reviewers list. 3. Someone (author, reviewer) removed acceptance of the revision by changing its status to "Needs Review". This patch is sending a "flag is deactivated" or "reviewer removed from revision" depending on the current status of the reviewer. Test Plan: Accept a revision. Change the revision to "Needs Review". Check the bug comment. Accept the revision. Remove the user from reviewers list. Check the bug comment. Reviewers: dkl Bug #: 1441063 Differential Revision: https://phabricator.services.mozilla.com/D809 * Styling fixed as requested in review. * Perl style fixes --- extensions/PhabBugz/lib/Feed.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index bfd395f51..074ecc0f9 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -293,6 +293,8 @@ sub process_revision_change { $phab_users = get_phab_bmo_ids({ phids => \@denied_phids }); @denied_user_ids = map { $_->{id} } @$phab_users; + my %reviewers_hash = map { $_->name => 1 } @{ $revision->reviewers }; + foreach my $attachment (@attachments) { my ($attach_revision_id) = ($attachment->filename =~ PHAB_ATTACHMENT_PATTERN); next if $revision->id != $attach_revision_id; @@ -333,7 +335,11 @@ sub process_revision_change { $comment .= $flag_data->{setter}->name . " has requested changes to the revision.\n"; } foreach my $flag_data (@removed_flags) { - $comment .= $flag_data->{setter}->name . " has been removed from the revision.\n"; + if ( exists $reviewers_hash{$flag_data->{setter}->name} ) { + $comment .= "Flag set by " . $flag_data->{setter}->name . " is no longer active.\n"; + } else { + $comment .= $flag_data->{setter}->name . " has been removed from the revision.\n"; + } } if ($comment) { -- cgit v1.2.3-24-g4f1b From 69bbc12dbb685210d83e6d83d2967b156517cf7a Mon Sep 17 00:00:00 2001 From: Israel Madueme Date: Thu, 29 Mar 2018 17:36:38 -0400 Subject: Bug 1441897 - Improve opengraph metadata for bug pages --- .../template/en/default/hook/global/header-start.html.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl b/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl index 9b8e0e0cc..2d7c3379f 100644 --- a/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl +++ b/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl @@ -8,6 +8,11 @@ [% USE Bugzilla %] - +[% IF bug %] + +[% ELSE %] + +[% END %] -- cgit v1.2.3-24-g4f1b