Skip to content

Commit

Permalink
Merge branch 'beta' into production
Browse files Browse the repository at this point in the history
* beta:
  Update POT files using the production database
  Revert "MBS-11268: Show "Set track durations" on release/discids"
  Update translations from Transifex
  Update POT files using the production database
  Update translations from Transifex
  Simplify bottom links to avoid translation parameters (#1884)
  MBS-11353: Allow empty row in multiple select (#1883)
  Update POT files using the production database
  Update translations from Transifex
  Make component and file names consistent
  Remove no longer used error TT components
  MBS-11112: Convert 500 error page to React
  MBS-11112: Convert timeout error page to React
  MBS-11112: Convert 403 mirror error page to React
  MBS-11112: Convert 404 mirror error page to React
  Allow className for AnchorProps
  Change the stash assignment method for consistency
  MBS-11112: Convert 403 error page to React
  MBS-11112: Convert 503 error page to React
  MBS-11112: Convert 401 error page to React
  MBS-11112: Convert 400 error page to React
  MBS-11112: Convert ErrorInfo to React
  MBS-11112: Convert ErrorEnvironment to React
  Make description optional in bugTrackerURL
  Convert forward to detach for always-detaching errors
  Generalize error layout
  MBS-11351: Sort instrument reports by name before type (#1880)
  Show message if no added entities rather than empty table
  Prevent linking release to Wikidata/Wikipedia
  Add missing comma
  MBS-11288: Drop decoda.com from lyrics whitelist (#1837)
  MBS-11123: Hide empty rows of the 'Added entities' table
  MBS-10187: "Merge artists" edit is stuck
  Avoid hardcoding group artist types
  s/existant/existent/g
  Factor out conditional_merge_column_query
  MBS-11348: improve report description text
  MBS-11344: Validate rateyourmusic URLs
  MBS-11123: Add new entities type to editor statistics
  MBS-11123: Add message about the editor statistics not being real-time
  Improve flow typing for recordings and ACs
  MBS-10872: Add missing colSpan on Edit Medium
  MBS-11045: Convert Edit medium edit to React
  MBS-11123: Restrict 'Added entities' edits counted to applied edits
  MBS-11348: Add link to specific release on the cdtoc page from the report
  Add anchor in cdtoc table of attached releases
  MBS-11348: New report about discIDs attached to a medium but not applied
  MBS-11346: Use medium_format ids in SQL query
  Update POT files using the production database
  Update translations from Transifex
  MBS-11310: Clarify when discid would cause subsecond changes (#1844)
  Use artist name for empty AC name in /ws/js/edit
  MBS-11332: Don't double-bracket ended in track rels view (#1864)
  MBS-11327: Show CAA icons on release search results (#1866)
  MBS-4782 / MBS-11333: Pass original MBID to AddCoverArt if no release (#1867)
  MBS-11336: Don't show ended rels in DeprecatedRelationshipURL (#1870)
  MBS-11328: Approving an edit redirects to home page (#1861)
  Add runReducer to FormRowSortNameWithGuessCase
  Add runReducer to FormRowNameWithGuessCase
  MBS-11168: Convert Delete Alias form to React
  Better UI for disabling fields for search hints
  MBS-11168: Convert add/edit alias form to React
  Convert date_range_fieldset to React
  Allow PartialDate form files to work with state
  Avoid tests breaking on move to React
  Refactor subfieldErrors / FieldErrors
  Port form_row_sortname_with_guesscase to React
  Preparing chooseLayoutComponent for AliasEditForm
  Preparing EnterEdit for AliasEditForm
  Preparing FormRowText for AliasEditForm
  Preparing FormRowPartialDate for AliasEditForm
  Preparing FormRowSelect for AliasEditForm
  Preparing FormRowCheckbox for AliasEditForm
  MBS-11344: Use HTTPS for rateyourmusic URLs
  More specific entry in dependencies array
  MBS-11277: Convert Other Lookups results to React
  Move release language block to reusable component
  Remove (seemingly unused) generic otherlookups results page
  MBS-11279: Make ISWC otherlookups go to ISWC page
  Remove now unused taglookup/form
  MBS-10996: Convert search index to React
  MBS-10995: Convert Other Lookups form to React
  MBS-11346: Add 8cm CDs to the report
  MBS-11346: Exclude CD-R from report
  MBS-11346: Lower duration threshold on dubious duration discID report
  MBS-11289: Stop autocleaning YouTube Music -> YouTube (#1835)
  MBS-11111: Set edit_pendings on recordings merged with release (#1774)
  MBS-11256: Make adding tracklist to empty medium an autoedit (#1815)
  Remove seemingly unneeded & from regex
  MBS-11324: Trim input in the barcode otherlookups field (#1855)
  MBS-11340: Allow more characters on Spotify user URLs
  Remove extra spaces
  MBS-11268: Show "Set track durations" on release/discids (#1822)
  MBS-10999: Make adding first IPI/ISNI an auto-edit
  Support other gettext functions in localized_note
  MBS-11322: Recognise old RA links and ask to follow the redirect
  MBS-11322: Update Resident Advisor favicon
  MBS-11322: Add validation to Resident Advisor URLs
  MBS-9840: Add Overture by Doremus to the otherdbs whitelist (#1810)
  Add `deleted` to sanitizedEditorProps check
  MBS-11292: Do not use UN flag for [Worldwide] (#1836)
  MBS-11317: Avoid breaking annotation formatting in RE (#1852)
  MBS-8028: Allow editing series type to any with same entity type (#1825)
  MBS-10830: Only show Remove link if entity can be removed (#1843)
  MBS-10915: Show "Remove track" button for data tracks even with discid (#1841)
  Add focusin/focusout polyfill for Firefox
  MBS-11322: Update Resident Advisor to new ra.co domain
  Split BBC and Resident Advisor review sections
  MBS-11297: Block adding Wikipedia/Wikidata as license to releases
  MBS-11297: Block adding Wikipedia/Wikidata as show notes to releases
  MBS-11296: Block adding Wikidata as discography entry to releases
  Use formatCount for tag and artist credit usage counts
  MBS-4548: Allow seeing all uses of an artist credit
  MBS-1459: Only display artist overview nav links when relevant
  Remove useless sub deflate
  MBS-9674: Support internationalized domains in URL forms
  MBS-1459: Add checks for different RG queries
  Eslint fixes: react/jsx-boolean-value (auto)
  Eslint fixes: import/newline-after-import (auto)
  Eslint fixes:  multiline-comment-style
  Eslint fixes: no-multiple-empty-lines (autofixes)
  Eslint fixes: no-trailing-spaces (autofixes)
  Eslint fixes: function-paren-newline
  Eslint fixes: comma-dangle (autofixed)
  Eslint fixes: array-element-newline
  Eslint fixes: no-multi-spaces
  Eslint fixes: no-extra-semi
  Ignore eslint issues in flow-typed he file
  • Loading branch information
reosarevok committed Feb 1, 2021
2 parents 9c937d4 + 45eb798 commit 41f115f
Show file tree
Hide file tree
Showing 277 changed files with 17,496 additions and 11,818 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,5 +1,6 @@
.cpanm/**/*.js
flow-typed/npm/@sentry/*.js
flow-typed/npm/he_*.js
flow-typed/npm/react-dom_*.js
flow-typed/npm/redux_*.js
perl_modules/**/*.js
Expand Down
14 changes: 0 additions & 14 deletions .eslintrc.unfixed.yaml
@@ -1,13 +1,10 @@
rules:
no-await-in-loop: error
no-extra-semi: warn
no-unused-vars: error
consistent-return: error
eqeqeq: [warn, smart]
no-else-return: warn
no-multi-spaces: [error, {ignoreEOLComments: true}]
wrap-iife: warn
array-element-newline: [warn, consistent]
camelcase: [warn, {properties: never,
allow: [
"l_attributes",
Expand Down Expand Up @@ -38,22 +35,13 @@ rules:
"N_ln",
"N_lp",
]}]
comma-dangle: [warn, {arrays: always-multiline,
objects: always-multiline,
imports: always-multiline,
exports: always-multiline,
functions: always-multiline}]
comma-spacing: [warn, {before: false, after: true}]
computed-property-spacing: [warn, never, {"enforceForClassMembers": true}]
consistent-this: [warn, self]
function-paren-newline: [warn, consistent]
jsx-quotes: [warn, prefer-double]
key-spacing: [warn, {mode: minimum}]
multiline-comment-style: [warn, starred-block]
newline-per-chained-call: [warn, {ignoreChainWithDepth: 3}]
no-lonely-if: warn
no-multiple-empty-lines: [warn, {max: 2, maxBOF: 0, maxEOF: 0}]
no-trailing-spaces: warn
object-curly-newline: [warn, {multiline: true, consistent: true}]
object-curly-spacing: [warn, never]
operator-assignment: [warn, always]
Expand All @@ -72,7 +60,6 @@ rules:
no-var: warn
prefer-const: warn
import/first: warn
import/newline-after-import: [warn, {count: 1}]
import/no-commonjs: error
import/order: [warn, {newlines-between: always}]
react/no-access-state-in-setstate: error
Expand All @@ -85,7 +72,6 @@ rules:
lifecycle,
everything-else,
render]}]
react/jsx-boolean-value: [warn, never]
react/jsx-closing-bracket-location: [error, tag-aligned]
react/jsx-first-prop-new-line: [error, multiline-multiprop]
react/jsx-key: warn
Expand Down
14 changes: 14 additions & 0 deletions .eslintrc.yaml
Expand Up @@ -81,6 +81,7 @@ rules:
no-duplicate-case: error
no-empty-character-class: error
no-empty: [error, {allowEmptyCatch: true}]
no-extra-semi: warn
no-irregular-whitespace: warn
no-misleading-character-class: error
no-obj-calls: error
Expand All @@ -107,6 +108,7 @@ rules:
no-eq-null: off
no-floating-decimal: warn
no-global-assign: error
no-multi-spaces: [error, {ignoreEOLComments: true}]
no-useless-catch: warn
radix: warn

Expand All @@ -120,11 +122,18 @@ rules:
# Stylistic Issues
array-bracket-newline: [warn, consistent]
array-bracket-spacing: [warn, never]
array-element-newline: [warn, consistent]
block-spacing: [warn, always]
brace-style: [warn, 1tbs]
comma-dangle: [warn, {arrays: always-multiline,
objects: always-multiline,
imports: always-multiline,
exports: always-multiline,
functions: always-multiline}]
comma-style: [warn, last]
eol-last: [warn, always]
func-call-spacing: [warn, never]
function-paren-newline: [warn, consistent]
implicit-arrow-linebreak: [warn, beside]
indent: [warn, 2, {CallExpression: {arguments: first}, SwitchCase: 1, ignoredNodes: ["JSXElement", "ArrowFunctionExpression"]}]
keyword-spacing: [warn, {before: true, after: true}]
Expand All @@ -136,16 +145,19 @@ rules:
ignoreTemplateLiterals: false,
ignoreRegExpLiterals: true}]
max-statements-per-line: [warn, {max: 1}]
multiline-comment-style: [warn, starred-block]
multiline-ternary: off
new-cap: off
new-parens: warn
no-mixed-spaces-and-tabs: warn
no-multi-assign: off
no-multiple-empty-lines: [warn, {max: 2, maxBOF: 0, maxEOF: 0}]
no-negated-condition: warn
no-nested-ternary: off
no-plusplus: off
no-tabs: warn
no-ternary: off
no-trailing-spaces: warn
no-underscore-dangle: off
no-unneeded-ternary: warn
no-whitespace-before-property: warn
Expand Down Expand Up @@ -185,6 +197,7 @@ rules:

import/export: error
import/extensions: [warn, never]
import/newline-after-import: [warn, {count: 1}]
import/no-duplicates: warn
import/no-dynamic-require: error
import/no-unresolved: error
Expand Down Expand Up @@ -238,6 +251,7 @@ rules:
react/void-dom-elements-no-children: error

# JSX-specific rules
react/jsx-boolean-value: [warn, never]
react/jsx-closing-tag-location: error
react/jsx-curly-spacing: [error, {when: never, children: true}]
react/jsx-equals-spacing: [error, never]
Expand Down
30 changes: 20 additions & 10 deletions lib/MusicBrainz/Server.pm
Expand Up @@ -257,9 +257,12 @@ sub redirect_back {

if (
$returnto eq '' ||
# Check that we weren't given an external URL. Only relative
# URLs are allowed.
$returnto->authority
# Check that we weren't given an external URL. Only URLs relative to
# the current domain are allowed.
(
$returnto->authority &&
$returnto->authority ne $c->req->uri->authority
)
) {
$returnto->path_query('/');
$returnto->fragment(undef);
Expand Down Expand Up @@ -500,19 +503,24 @@ around 'finalize_error' => sub {
$c->$orig(@args);

if (!$c->debug && scalar @{ $c->error }) {
$c->stash->{errors} = $errors;
$c->stash->{template} = $timed_out ?
'main/timeout.tt' : 'main/500.tt';
try { $c->stash->{hostname} = hostname; } catch {};
$c->stash(
component_path => $timed_out
? 'main/error/TimeoutError'
: 'main/error/Error500',
component_props => {
$c->stash->{edit} ? (edits => [ $c->stash->{edit} ]) : (),
formattedErrors => $c->stash->{formatted_errors},
hostname => $c->stash->{hostname},
useLanguages => boolean_to_json($c->stash->{use_languages}),
},
current_view => 'Node',
);
$c->clear_errors;
if ($c->stash->{error_body_in_stash}) {
$c->res->{body} = $c->stash->{body};
$c->res->{status} = $c->stash->{status};
} else {
if (($c->stash->{current_view} // '') eq 'Node') {
# Remove once error pages are converted to React.
$c->stash(current_view => 'Default');
}
$c->view->process($c);
# Catalyst::Engine::finalize_error unsets $c->encoding. [1]
# We're rendering our own error page here, not using theirs,
Expand Down Expand Up @@ -741,6 +749,7 @@ sub TO_JSON {

# Whitelist of keys that we use in the templates.
my @stash_keys = qw(
can_delete
collaborative_collections
commons_image
containment
Expand Down Expand Up @@ -830,6 +839,7 @@ sub TO_JSON {
debug => boolean_to_json($self->debug),
relative_uri => $self->relative_uri,
req => {
body_params => $req->body_params,
headers => \%headers,
query_params => $req->query_params,
secure => boolean_to_json($req->secure),
Expand Down
3 changes: 3 additions & 0 deletions lib/MusicBrainz/Server/Controller.pm
Expand Up @@ -153,6 +153,9 @@ sub edit_action
$form_args{init_object} = $opts{item} if exists $opts{item};
my $form = $c->form( form => $opts{form}, ctx => $c, %form_args );

$c->stash->{component_props}{form} = $form;
$opts{pre_validation}->($form) if exists $opts{pre_validation};

if ($c->form_posted_and_valid($form, $c->req->body_params)) {
return if exists $opts{pre_creation} && !$opts{pre_creation}->($form);

Expand Down
67 changes: 43 additions & 24 deletions lib/MusicBrainz/Server/Controller/Artist.pm
Expand Up @@ -179,41 +179,58 @@ sub show : PathPart('') Chained('load')
}) };
my $has_filter = %filter ? 1 : 0;

my $has_default = $c->model('ReleaseGroup')->has_by_artist($artist->id, 0);
my $has_extra = $c->model('ReleaseGroup')->has_by_artist($artist->id, 1);
my $has_va = $c->model('ReleaseGroup')->has_by_track_artist($artist->id, 0);
my $has_va_extra = $c->model('ReleaseGroup')->has_by_track_artist($artist->id, 1);

my $want_va_only = $c->req->query_params->{va};
my $want_all_statuses = $c->req->query_params->{all};
my $including_all_statuses;
my $showing_va_only;

my $has_release_groups = $has_default || $has_extra || $has_va || $has_va_extra;
my $force_release_groups = $want_va_only || $want_all_statuses || %filter;

my $make_attempt = sub {
my ($all, $va) = @_;
my $method = $va ? 'find_by_track_artist' : 'find_by_artist';
return $self->_load_paged($c, sub {
$c->model('ReleaseGroup')->$method($c->stash->{artist}->id, $all, shift, shift, filter => \%filter);
if (!$all && !$va) {
return ([], 0) unless $has_default;
} elsif ($all && !$va) {
return ([], 0) unless ($has_default || $has_extra);
} elsif (!$all && $va) {
return ([], 0) unless $has_va;
} elsif ($all && $va) {
return ([], 0) unless ($has_va || $has_va_extra);
}
return $c->model('ReleaseGroup')->$method($c->stash->{artist}->id, $all, shift, shift, filter => \%filter);
});
};

# Attempt from official non-va, to all non-va, to official va, to all va;
# filter out any attempt that contradicts a preference from a query param
my @attempts = grep {
($_->[0] || !$want_all_statuses) &&
($_->[1] || !$want_va_only)
} ([0,0], [1,0], [0,1], [1,1]);

for my $attempt (@attempts) {
my $all = $attempt->[0];
my $va = $attempt->[1];
$release_groups = $make_attempt->($all, $va);
# If filtering, only make one attempt
# otherwise, attempt until we find RGs or exhaust the possibilities
if (scalar @$release_groups || %filter) {
if ($has_release_groups || $force_release_groups) {
# Attempt from official non-va, to all non-va, to official va, to all va;
# filter out any attempt that contradicts a preference from a query param
my @attempts = grep {
($_->[0] || !$want_all_statuses) &&
($_->[1] || !$want_va_only)
} ([0,0], [1,0], [0,1], [1,1]);

for my $attempt (@attempts) {
my $all = $attempt->[0];
my $va = $attempt->[1];
$release_groups = $make_attempt->($all, $va);
$including_all_statuses = $all;
$showing_va_only = $va;
last;
# If filtering, only make one attempt
# otherwise, attempt until we find RGs or exhaust the possibilities
if (scalar @$release_groups || %filter) {
last;
}
}
}

# If there is no expressed preference (va, filter) and no RGs, find recordings
if (!$showing_va_only && !%filter && scalar @$release_groups == 0) {
} else {
# If there is no expressed preference (va, filter) and no RGs, find recordings
$recordings = $self->_load_paged($c, sub {
$c->model('Recording')->find_standalone($artist->id, shift, shift);
});
Expand Down Expand Up @@ -289,8 +306,12 @@ sub show : PathPart('') Chained('load')
ajaxFilterFormUrl => $c->uri_for_action('/ajax/filter_artist_release_groups_form', { artist_id => $artist->id }),
artist => $artist,
filterForm => $c->stash->{filter_form},
hasDefault => boolean_to_json($has_default),
hasExtra => boolean_to_json($has_extra),
hasFilter => boolean_to_json($has_filter),
includingAllStatuses => $including_all_statuses,
hasVariousArtists => boolean_to_json($has_va),
hasVariousArtistsExtra => boolean_to_json($has_va_extra),
includingAllStatuses => boolean_to_json($including_all_statuses),
legalName => $legal_name,
legalNameAliases => $legal_name_aliases,
legalNameArtistAliases => $legal_name_artist_aliases,
Expand All @@ -299,9 +320,7 @@ sub show : PathPart('') Chained('load')
pager => serialize_pager($c->stash->{pager}),
recordings => $recordings,
releaseGroups => $release_groups,
showingVariousArtistsOnly => $showing_va_only,
wantAllStatuses => boolean_to_json($want_all_statuses),
wantVariousArtistsOnly => boolean_to_json($want_va_only),
showingVariousArtistsOnly => boolean_to_json($showing_va_only),
wikipediaExtract => $c->stash->{wikipedia_extract},
},
);
Expand Down

0 comments on commit 41f115f

Please sign in to comment.