Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-9246: Load extra data for Artist Credit field #467

Merged
merged 1 commit into from Feb 20, 2017

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented Feb 16, 2017

Fix MBS-9246 Tool-tips displaying "undefined" text.

Previously, only artist name, id, gid, and type were loaded for preview in the Artist Credit editor. Consequently, tool-tips did not contain sort name or disambiguation comment (but undefined instead), and artists with pending edits were not highlighted. It affects Artist Credit field editor of editing forms for recording, release-group, artist credit, and artist split. Only Artist Credit field of release editor is unaffected, because it is initialized in a different way using React.

This patch loads all JSON-serialized artist fields including sort name, disambiguation comment, and status regarding pending edits to the Artist Credit form field. All of the above mentioned bugs are fixed, ensuring consistency with release editor.

$name->{artist}->{gid} = $artists->{$name->{artist}->{id}}->gid if $artists->{$name->{artist}->{id}};
my $artist = $artists->{$name->{artist}->{id}};
if ($artist)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: we prefer opening brackets to always be on the same line as the control statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meta Nitpick: “Curly braces are always on their own line” according to Server Coding Style 😆

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whooops...at least the heading on that page is accurate: "Status: This page is work in progress and has very questionable content." :)

I'll fix it to be less questionable.

$name->{artist}->{gid} = $artist->{gid};
$name->{artist}->{sortName} = $artist->{sort_name};
$name->{artist}->{comment} = $artist->{comment};
$name->{artist}->{editsPending} = $artist->{edits_pending};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there's already an $artist->TO_JSON method which should encode things in the same format as here—probably with additional fields that aren't needed, but using it could prevent future issues if the format changes.

As an aside, for blessed Moose objects we always use the accessor methods ($artist->gid vs. $artist->{gid}). Both will work, but the accessors make it easier to see it's a blessed instance, not a hash reference (and are also easier to type).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. At first glance Artist JSON seemed to output a lot more details than what is useful to display Artists Credit, but I will look into it again. Thanks for the blessed tip!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed reasonable to use full JSON export. Done in 3cd70df.

Previously, only artist name, id, gid, and type were loaded for
preview in the Artist Credit editor.  Consequently, tool-tips did
not contain sort name or disambiguation comment (but 'undefined'
instead), and artists with pending edits were not highlighted.

It affects Artist Credit field editor of editing forms for
recording, release-group, artist credit, and artist split.

Only Artist Credit field of release editor is unaffected,
because it is initialized in a different way from React.

This patch loads all JSON-encoded artist fields including sort name,
disambiguation comment, and status regarding pending edits to the
Artist Credit form field. All of the above mentioned bugs are fixed,
ensuring consistency with release editor.
@mwiencek mwiencek merged commit 61027d0 into metabrainz:master Feb 20, 2017
@yvanzo yvanzo deleted the mbs-9246-ac-editor-tooltips branch April 2, 2017 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants