File tree 15 files changed +280
-17
lines changed
static/scripts/common/components
15 files changed +280
-17
lines changed Original file line number Diff line number Diff line change
1
+ package MusicBrainz::Server::Report::ArtistCreditReport ;
2
+ use Moose::Role;
3
+ use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object ) ;
4
+
5
+ with ' MusicBrainz::Server::Report::QueryReport' ;
6
+
7
+ around inflate_rows => sub {
8
+ my $orig = shift ;
9
+ my $self = shift ;
10
+
11
+ my $items = $self -> $orig (@_ );
12
+
13
+ my $artist_credits = $self -> c-> model(' ArtistCredit' )-> get_by_ids(
14
+ map { $_ -> {artist_credit_id } } @$items
15
+ );
16
+
17
+ return [
18
+ map +{
19
+ %$_ ,
20
+ artist_credit => to_json_object($artist_credits -> { $_ -> {artist_credit_id } }),
21
+ }, @$items
22
+ ];
23
+ };
24
+
25
+ 1;
26
+
27
+ =head1 COPYRIGHT AND LICENSE
28
+
29
+ Copyright (C) 2021 MetaBrainz Foundation
30
+
31
+ This file is part of MusicBrainz, the open internet music database,
32
+ and is licensed under the GPL version 2, or (at your option) any
33
+ later version: http://www.gnu.org/licenses/gpl-2.0.txt
34
+
35
+ =cut
Original file line number Diff line number Diff line change
1
+ package MusicBrainz::Server::Report::ArtistCreditsWithDubiousTrailingPhrases ;
2
+ use Moose;
3
+
4
+ with ' MusicBrainz::Server::Report::ArtistCreditReport' ,
5
+ ' MusicBrainz::Server::Report::FilterForEditor::ArtistCreditID' ;
6
+
7
+ sub query {<<~'EOSQL' }
8
+ SELECT ac.id AS artist_credit_id, ac.name,
9
+ row_number() OVER (ORDER BY ac.id)
10
+ FROM artist_credit ac
11
+ JOIN artist_credit_name acn ON acn.artist_credit = ac.id
12
+ WHERE acn.position = (ac.artist_count - 1)
13
+ AND acn.join_phrase ~* '(?:ft\.?|feat\.?|[;:,])\s*$'
14
+ EOSQL
15
+
16
+ __PACKAGE__ -> meta-> make_immutable;
17
+ no Moose;
18
+ 1;
19
+
20
+ =head1 COPYRIGHT AND LICENSE
21
+
22
+ Copyright (C) 2021 MetaBrainz Foundation
23
+
24
+ This file is part of MusicBrainz, the open internet music database,
25
+ and is licensed under the GPL version 2, or (at your option) any
26
+ later version: http://www.gnu.org/licenses/gpl-2.0.txt
27
+
28
+ =cut
Original file line number Diff line number Diff line change
1
+ package MusicBrainz::Server::Report::FilterForEditor::ArtistCreditID ;
2
+ use Moose::Role;
3
+
4
+ with ' MusicBrainz::Server::Report::FilterForEditor' ;
5
+
6
+ sub filter_sql {
7
+ my ($self , $editor_id ) = @_ ;
8
+
9
+ my $filter_query = <<~'EOSQL' ;
10
+ JOIN artist_credit_name ON artist_credit_id = artist_credit_name.artist_credit
11
+ JOIN editor_subscribe_artist esa ON esa.artist = artist_credit_name.artist
12
+ WHERE esa.editor = ?
13
+ EOSQL
14
+
15
+ return ($filter_query , $editor_id );
16
+ }
17
+
18
+ 1;
19
+
20
+ =head1 COPYRIGHT AND LICENSE
21
+
22
+ Copyright (C) 2021 MetaBrainz Foundation
23
+
24
+ This file is part of MusicBrainz, the open internet music database,
25
+ and is licensed under the GPL version 2, or (at your option) any
26
+ later version: http://www.gnu.org/licenses/gpl-2.0.txt
27
+
28
+ =cut
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use MusicBrainz::Server::PagedReport;
13
13
AnnotationsReleaseGroups
14
14
AnnotationsSeries
15
15
AnnotationsWorks
16
+ ArtistCreditsWithDubiousTrailingPhrases
16
17
ArtistsContainingDisambiguationComments
17
18
ArtistsDisambiguationSameName
18
19
ArtistsWithMultipleOccurrencesInArtistCredits
@@ -102,6 +103,7 @@ use MusicBrainz::Server::PagedReport;
102
103
103
104
use MusicBrainz::Server::Report::ASINsWithMultipleReleases;
104
105
use MusicBrainz::Server::Report::AnnotationReports;
106
+ use MusicBrainz::Server::Report::ArtistCreditsWithDubiousTrailingPhrases;
105
107
use MusicBrainz::Server::Report::ArtistsContainingDisambiguationComments;
106
108
use MusicBrainz::Server::Report::ArtistsDisambiguationSameName;
107
109
use MusicBrainz::Server::Report::ArtistsThatMayBeGroups;
Original file line number Diff line number Diff line change 10
10
import * as React from 'react' ;
11
11
12
12
import ENTITIES from '../../entities' ;
13
+ import ArtistCreditUsageLink
14
+ from '../static/scripts/common/components/ArtistCreditUsageLink' ;
13
15
import DescriptiveLink
14
16
from '../static/scripts/common/components/DescriptiveLink' ;
15
17
import EntityLink
@@ -43,8 +45,6 @@ function buildSection(
43
45
}
44
46
45
47
const entityUrlFragment = ENTITIES [ entityType ] . url ;
46
- const url = '/artist-credit/' + props . artistCredit . id +
47
- '/' + entityUrlFragment ;
48
48
49
49
return (
50
50
< React . Fragment key = { entityType } >
@@ -62,12 +62,14 @@ function buildSection(
62
62
{ entities . count > entities . entities . length ? (
63
63
< li key = "see-all" >
64
64
< em >
65
- < a href = { url } >
66
- { expand2text (
65
+ < ArtistCreditUsageLink
66
+ artistCredit = { props . artistCredit }
67
+ content = { expand2text (
67
68
seeAllMessage ( entities . count ) ,
68
69
{ num : formatCount ( props . $c , entities . count ) } ,
69
70
) }
70
- </ a >
71
+ subPath = { entityUrlFragment }
72
+ />
71
73
</ em >
72
74
</ li >
73
75
) : null }
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import * as React from 'react';
11
11
12
12
import Tabs from '../components/Tabs' ;
13
13
import Layout from '../layout' ;
14
+ import ArtistCreditUsageLink
15
+ from '../static/scripts/common/components/ArtistCreditUsageLink' ;
14
16
import { reduceArtistCredit }
15
17
from '../static/scripts/common/immutable-entities' ;
16
18
@@ -54,19 +56,22 @@ const ArtistCreditLayout = ({
54
56
>
55
57
< div id = "content" >
56
58
< h1 >
57
- < a href = { '/artist-credit/' + artistCredit . id } >
58
- { texp . l (
59
+ < ArtistCreditUsageLink
60
+ artistCredit = { artistCredit }
61
+ content = { texp . l (
59
62
'Artist credit “{artist_credit}”' ,
60
63
{ artist_credit : reduceArtistCredit ( artistCredit ) } ,
61
64
) }
62
- </ a >
65
+ / >
63
66
</ h1 >
64
67
< Tabs >
65
68
{ tabLinks . map ( link => (
66
69
< li className = { page === link [ 0 ] ? 'sel' : '' } key = { link [ 0 ] } >
67
- < a href = { '/artist-credit/' + artistCredit . id + link [ 0 ] } >
68
- { link [ 1 ] ( ) }
69
- </ a >
70
+ < ArtistCreditUsageLink
71
+ artistCredit = { artistCredit }
72
+ content = { link [ 1 ] ( ) }
73
+ subPath = { link [ 0 ] . replace ( / ^ \/ / , '' ) }
74
+ />
70
75
</ li >
71
76
) ) }
72
77
</ Tabs >
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import * as React from 'react';
11
11
12
12
import ArtistCreditLink
13
13
from '../../static/scripts/common/components/ArtistCreditLink' ;
14
+ import ArtistCreditUsageLink
15
+ from '../../static/scripts/common/components/ArtistCreditUsageLink' ;
14
16
import EntityLink from '../../static/scripts/common/components/EntityLink' ;
15
17
import bracketed from '../../static/scripts/common/utility/bracketed' ;
16
18
import loopParity from '../../utility/loopParity' ;
@@ -62,9 +64,10 @@ const ArtistCreditList = ({
62
64
{ ' ' }
63
65
< span className = "small" >
64
66
{ bracketed (
65
- < a href = { `/artist-credit/${ credit . id } ` } >
66
- { l ( 'see uses' ) }
67
- </ a > ,
67
+ < ArtistCreditUsageLink
68
+ artistCredit = { credit }
69
+ content = { l ( 'see uses' ) }
70
+ /> ,
68
71
) }
69
72
</ span >
70
73
</ td >
Original file line number Diff line number Diff line change 9
9
10
10
import * as React from 'react' ;
11
11
12
+ import ArtistCreditUsageLink
13
+ from '../../static/scripts/common/components/ArtistCreditUsageLink' ;
12
14
import ExpandedArtistCredit from
13
15
'../../static/scripts/common/components/ExpandedArtistCredit' ;
14
16
@@ -42,9 +44,12 @@ const EditArtistCredit = ({edit}: Props): React.Element<'table'> => {
42
44
< tr >
43
45
< th />
44
46
< td colSpan = "2" >
45
- < a href = { `/artist-credit/${ display . artist_credit . old . id } ` } >
46
- { l ( 'See all uses of the artist credit being changed.' ) }
47
- </ a >
47
+ < ArtistCreditUsageLink
48
+ artistCredit = { display . artist_credit . old }
49
+ content = { l (
50
+ 'See all uses of the artist credit being changed.' ,
51
+ ) }
52
+ />
48
53
</ td >
49
54
</ tr >
50
55
) : null }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @flow strict-local
3
+ * Copyright (C) 2021 MetaBrainz Foundation
4
+ *
5
+ * This file is part of MusicBrainz, the open internet music database,
6
+ * and is licensed under the GPL version 2, or (at your option) any
7
+ * later version: http://www.gnu.org/licenses/gpl-2.0.txt
8
+ */
9
+
10
+ import * as React from 'react' ;
11
+
12
+ import ArtistCreditList from './components/ArtistCreditList' ;
13
+ import ReportLayout from './components/ReportLayout' ;
14
+ import type { ReportArtistCreditT , ReportDataT } from './types' ;
15
+
16
+ const ArtistCreditsWithDubiousTrailingPhrases = ( {
17
+ canBeFiltered,
18
+ filtered,
19
+ generated,
20
+ items,
21
+ pager,
22
+ } : ReportDataT < ReportArtistCreditT > ): React.Element< typeof ReportLayout > => (
23
+ < ReportLayout
24
+ canBeFiltered = { canBeFiltered }
25
+ description = { l (
26
+ `This report lists artist credits that have a trailing join phrase
27
+ that looks like it might have been left behind in error, such as
28
+ a trailing comma or “feat.”.` ,
29
+ ) }
30
+ entityType = "artist_credit"
31
+ filtered = { filtered }
32
+ generated = { generated }
33
+ title = { l ( 'Artist credits with dubious trailing join phrases' ) }
34
+ totalEntries = { pager . total_entries }
35
+ >
36
+ < ArtistCreditList items = { items } pager = { pager } />
37
+ </ ReportLayout >
38
+ ) ;
39
+
40
+ export default ArtistCreditsWithDubiousTrailingPhrases ;
Original file line number Diff line number Diff line change @@ -113,6 +113,15 @@ const ReportsIndex = ({$c}: Props): React.Element<typeof Layout> => (
113
113
/>
114
114
</ ul >
115
115
116
+ < h2 > { l ( 'Artist credits' ) } </ h2 >
117
+
118
+ < ul >
119
+ < ReportsIndexEntry
120
+ content = { l ( 'Artist credits with dubious trailing join phrases' ) }
121
+ reportName = "ArtistCreditsWithDubiousTrailingPhrases"
122
+ />
123
+ </ ul >
124
+
116
125
{ isAccountAdmin ( $c . user ) ? (
117
126
< >
118
127
< h2 > { l ( 'Editors' ) } </ h2 >
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @flow strict-local
3
+ * Copyright (C) 2021 MetaBrainz Foundation
4
+ *
5
+ * This file is part of MusicBrainz, the open internet music database,
6
+ * and is licensed under the GPL version 2, or (at your option) any
7
+ * later version: http://www.gnu.org/licenses/gpl-2.0.txt
8
+ */
9
+
10
+ import * as React from 'react' ;
11
+
12
+ import PaginatedResults from '../../components/PaginatedResults' ;
13
+ import ArtistCreditUsageLink
14
+ from '../../static/scripts/common/components/ArtistCreditUsageLink' ;
15
+ import loopParity from '../../utility/loopParity' ;
16
+ import type { ReportArtistCreditT } from '../types' ;
17
+
18
+ type Props = {
19
+ + items : $ReadOnlyArray < ReportArtistCreditT > ,
20
+ + pager : PagerT ,
21
+ } ;
22
+
23
+ const ArtistCreditList = ( {
24
+ items,
25
+ pager,
26
+ } : Props ) : React . Element < typeof PaginatedResults > => (
27
+ < PaginatedResults pager = { pager } >
28
+ < table className = "tbl" >
29
+ < thead >
30
+ < tr >
31
+ < th > { l ( 'Artist Credit' ) } </ th >
32
+ </ tr >
33
+ </ thead >
34
+ < tbody >
35
+ { items . map ( ( item , index ) => (
36
+ < tr className = { loopParity ( index ) } key = { item . artist_credit_id } >
37
+ { item . artist_credit ? (
38
+ < >
39
+ < td >
40
+ < ArtistCreditUsageLink artistCredit = { item . artist_credit } />
41
+ </ td >
42
+ </ >
43
+ ) : (
44
+ < td >
45
+ { l ( 'This artist credit no longer exists.' ) }
46
+ </ td >
47
+ ) }
48
+ </ tr >
49
+ ) ) }
50
+ </ tbody >
51
+ </ table >
52
+ </ PaginatedResults >
53
+ ) ;
54
+
55
+ export default ArtistCreditList ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import FilterLink from '../FilterLink';
17
17
18
18
const countTextPicker = {
19
19
artist : N_l ( 'Total artists found: {count}' ) ,
20
+ artist_credit : N_l ( 'Total artist credits found: {count}' ) ,
20
21
discId : N_l ( 'Total discIDs found: {count}' ) ,
21
22
editor : N_l ( 'Total editors found: {count}' ) ,
22
23
event : N_l ( 'Total events found: {count}' ) ,
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ export type ReportArtistAnnotationT = {
16
16
+ text : string ,
17
17
} ;
18
18
19
+ export type ReportArtistCreditT = {
20
+ + artist_credit : ?ArtistCreditT ,
21
+ + artist_credit_id : number ,
22
+ + key ? : string ,
23
+ + row_number : number ,
24
+ } ;
25
+
19
26
export type ReportArtistRelationshipT = {
20
27
+ artist : ?ArtistT ,
21
28
+ artist_id : number ,
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ module.exports = {
150
150
'report/AnnotationsReleases' : require ( '../report/AnnotationsReleases' ) ,
151
151
'report/AnnotationsSeries' : require ( '../report/AnnotationsSeries' ) ,
152
152
'report/AnnotationsWorks' : require ( '../report/AnnotationsWorks' ) ,
153
+ 'report/ArtistCreditsWithDubiousTrailingPhrases' : require ( '../report/ArtistCreditsWithDubiousTrailingPhrases' ) ,
153
154
'report/ArtistsContainingDisambiguationComments' : require ( '../report/ArtistsContainingDisambiguationComments' ) ,
154
155
'report/ArtistsDisambiguationSameName' : require ( '../report/ArtistsDisambiguationSameName' ) ,
155
156
'report/ArtistsThatMayBeGroups' : require ( '../report/ArtistsThatMayBeGroups' ) ,
You can’t perform that action at this time.
0 commit comments