-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beta: Add missing space Update POT files using the production database Update translations from Transifex MBS-11781: Add class to the "load all tracks" link on large mediums (#2172) Fix alignment of loading icon for media (#2171) Fix syntax error Update POT files using the production database Update translations from Transifex MBS-11679: Wish editors a happy MB anniversary (#2116) MBS-10367: Allow requesting copy of sent report when reporting (#1965) MBS-11747: Hide release details on edit preview (#2158) MBS-8371: Add searching in edit notes to the edit search (#1820) MBS-11443: Add option to sort edits by edit note date (#1980) MBS-11578: Link tracks in RecordingTrackDifferentName report (#2097) MBS-11711: Show informative error if no relationships in group (#2143) MBS-11782: Hide more irrelevant work rels from release's bottom credits (#2169) MBS-11335: Report for reused Wikidata items (#1871) MBS-11774: Add fullwidth feat / featuring to the featuring reports MBS-11772: Add Greek version to featured artist reports MBS-10844: Report for same URL linked to many entities MBS-11335: Report for reused Wikidata items MBS-11757: CD Japan -> CDJapan (#2157) MBS-11776: Readd "loading-message" class to the medium loading message (#2166) MBS-11767: Show track-level artists on loaded mediums (#2168) MBS-11778: Convert edit header to React (#2167) MBS-11773: Make "featuring in title" reports case insensitive (#2163) Bump Flow to 0.155.0 Bump Flow to 0.154.0 Replace last remaining `__proto__: empty` hack Return a Map from groupBy/keyBy Upgrade Flow to 0.153.0 Rename toJS argument to entity MBS-11775: Do not break if relatedArtists is undefined MBS-11765: Add standalone recording statistics Corrected plural MBS-11769: Display # of recordings w ISRCs / works w ISWCs Fix sort MBS-11761: Properly display ratings on release lists MBS-11753: Fix selectors for RangeSelect in ArtistEdit (#2155) MBS-11744: Make it easier to mouse-select release dates in tables (#2154) MBS-11726: Add missing space to Set Cover Art display (#2153) Fix warning about \1 being better written as $1 MBS-11381: Add forms for admins to add and update timeline events Deflate field values in Form::Role::ToJSON Correct track_count for INSERT INTO medium MBS-11614: Allow merging releases when a medium is empty MBS-11666: Report for releases that have disc IDs but shouldn't MBS-11664: Enable discID tabs when release (wrongly) has discIDs
- Loading branch information
Showing
158 changed files
with
15,623 additions
and
11,975 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
lib/MusicBrainz/Server/Controller/Admin/StatisticsEvent.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package MusicBrainz::Server::Controller::Admin::StatisticsEvent; | ||
use Moose; | ||
use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array ); | ||
|
||
BEGIN { extends 'MusicBrainz::Server::Controller' }; | ||
|
||
sub _form_to_hash { | ||
my ($self, $form) = @_; | ||
return map { $form->field($_)->name => $form->field($_)->value } $form->edit_field_names; | ||
} | ||
|
||
sub index : Path('/admin/statistics-events') Args(0) RequireAuth(account_admin) { | ||
my ($self, $c) = @_; | ||
|
||
$c->stash( | ||
current_view => 'Node', | ||
component_path => 'admin/statistics-events/StatisticsEventIndex', | ||
component_props => { | ||
events => to_json_array($c->model('Statistics')->all_events), | ||
}, | ||
); | ||
} | ||
|
||
sub create : Path('/admin/statistics-events/create') RequireAuth(account_admin) SecureForm { | ||
my ($self, $c) = @_; | ||
|
||
my $form = $c->form( form => 'Admin::StatisticsEvent' ); | ||
|
||
if ($c->form_posted_and_valid($form)) { | ||
my %insert = $self->_form_to_hash($form); | ||
$c->model('MB')->with_transaction(sub { | ||
$c->model('StatisticsEvent')->insert(\%insert); | ||
}); | ||
|
||
$c->response->redirect($c->uri_for('/admin/statistics-events')); | ||
} | ||
|
||
$c->stash( | ||
component_path => 'admin/statistics-events/CreateStatisticsEvent', | ||
component_props => {form => $form->TO_JSON}, | ||
current_view => 'Node', | ||
); | ||
} | ||
|
||
sub edit : Path('/admin/statistics-events/edit') Args(1) RequireAuth(account_admin) SecureForm { | ||
my ($self, $c, $date) = @_; | ||
|
||
my $event = $c->model('StatisticsEvent')->get_by_date($date); | ||
|
||
my $form = $c->form( form => 'Admin::StatisticsEvent', init_object => $event); | ||
|
||
if ($c->form_posted_and_valid($form)) { | ||
$c->model('MB')->with_transaction(sub { | ||
$c->model('StatisticsEvent')->update($date, { map { $_->name => $_->value } $form->edit_fields }); | ||
}); | ||
|
||
$c->response->redirect($c->uri_for('/admin/statistics-events')); | ||
$c->detach; | ||
} | ||
|
||
$c->stash( | ||
component_path => 'admin/statistics-events/EditStatisticsEvent', | ||
component_props => {form => $form->TO_JSON}, | ||
current_view => 'Node', | ||
); | ||
} | ||
|
||
sub delete : Path('/admin/statistics-events/delete') Args(1) RequireAuth(account_admin) SecureForm { | ||
my ($self, $c, $date) = @_; | ||
|
||
my $event = $c->model('StatisticsEvent')->get_by_date($date); | ||
|
||
if ($c->form_posted) { | ||
$c->model('MB')->with_transaction(sub { | ||
$c->model('StatisticsEvent')->delete($date); | ||
}); | ||
|
||
$c->response->redirect($c->uri_for('/admin/statistics-events')); | ||
} | ||
|
||
$c->stash( | ||
component_path => 'admin/statistics-events/DeleteStatisticsEvent', | ||
component_props => {event => $event->TO_JSON}, | ||
current_view => 'Node', | ||
); | ||
} | ||
|
||
1; | ||
|
||
=head1 COPYRIGHT AND LICENSE | ||
Copyright (C) 2021 MetaBrainz Foundation | ||
This file is part of MusicBrainz, the open internet music database, | ||
and is licensed under the GPL version 2, or (at your option) any | ||
later version: http://www.gnu.org/licenses/gpl-2.0.txt | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package MusicBrainz::Server::Data::StatisticsEvent; | ||
use Moose; | ||
use namespace::autoclean; | ||
|
||
use MusicBrainz::Server::Entity::StatisticsEvent; | ||
|
||
extends 'MusicBrainz::Server::Data::Entity'; | ||
with 'MusicBrainz::Server::Data::Role::EntityCache'; | ||
with 'MusicBrainz::Server::Data::Role::SelectAll'; | ||
with 'MusicBrainz::Server::Data::Role::InsertUpdateDelete'; | ||
|
||
sub _type { 'statistics_event' } | ||
|
||
sub _table | ||
{ | ||
return 'statistics.statistic_event'; | ||
} | ||
|
||
sub _id_column | ||
{ | ||
return 'statistic_event.date'; | ||
} | ||
|
||
sub _columns { | ||
return 'date, title, description, link'; | ||
} | ||
|
||
sub _column_mapping { | ||
return { | ||
date => 'date', | ||
title => 'title', | ||
description => 'description', | ||
link => 'link', | ||
}; | ||
} | ||
|
||
sub _entity_class | ||
{ | ||
return 'MusicBrainz::Server::Entity::StatisticsEvent'; | ||
} | ||
|
||
sub get_by_date { | ||
my ($self, $date) = @_; | ||
|
||
my @events = $self->_get_by_keys('date', $date); | ||
return $events[0]; | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; | ||
no Moose; | ||
1; | ||
|
||
=head1 COPYRIGHT AND LICENSE | ||
Copyright (C) 2021 MetaBrainz Foundation | ||
This file is part of MusicBrainz, the open internet music database, | ||
and is licensed under the GPL version 2, or (at your option) any | ||
later version: http://www.gnu.org/licenses/gpl-2.0.txt | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
lib/MusicBrainz/Server/EditSearch/Predicate/EditNoteContent.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package MusicBrainz::Server::EditSearch::Predicate::EditNoteContent; | ||
use Moose; | ||
|
||
with 'MusicBrainz::Server::EditSearch::Predicate'; | ||
|
||
sub operator_cardinality_map { | ||
return ( | ||
'includes' => undef, | ||
) | ||
} | ||
|
||
sub combine_with_query { | ||
my ($self, $query) = @_; | ||
|
||
my @patterns = map { | ||
$_ =~ s/\\/\\\\/g; | ||
$_ =~ s/_/\\_/g; | ||
$_ =~ s/%/\\%/g; | ||
'%' . $_ . '%' | ||
} @{ $self->sql_arguments }; | ||
|
||
$query->add_where([ | ||
'EXISTS ( | ||
SELECT TRUE FROM edit_note | ||
WHERE edit_note.text ILIKE ? | ||
AND edit_note.edit = edit.id | ||
)', | ||
\@patterns, | ||
]); | ||
}; | ||
|
||
1; | ||
|
||
=head1 COPYRIGHT AND LICENSE | ||
Copyright (C) 2015-2017 MetaBrainz Foundation | ||
This file is part of MusicBrainz, the open internet music database, | ||
and is licensed under the GPL version 2, or (at your option) any | ||
later version: http://www.gnu.org/licenses/gpl-2.0.txt | ||
=cut |
Oops, something went wrong.