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-9248: Don't show artist name in hover if same as sort name #458

Closed
wants to merge 1 commit into from

Conversation

reosarevok
Copy link
Member

@reosarevok reosarevok commented Feb 11, 2017

Should solve MBS-9248 by checking if the sortname is the same as the name and not printing the name if so.

@brainzbot
Copy link
Member

Can one of the admins verify this patch?

@@ -350,8 +350,12 @@ END -%]
IF namevar AND action == 'show' AND content != ''
AND (noescape ? html_unescape(content.remove('</?span\b[^>]*>')) : content) != entity.name;
options.unshift('name_variation');
hover = hover != '' ? l('{name} – {additional_info}', { name => entity.name, additional_info => hover })
: entity.name;
IF (entity.sort_name && entity.sort_name == entity.name);
Copy link
Member Author

Choose a reason for hiding this comment

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

Not 100% sure if entity.sort_name is needed, let me know if I should just get rid?

Copy link
Contributor

Choose a reason for hiding this comment

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

Depends on what you want. As it is, it checks whether the sort name is "0" or something else.

Copy link
Member

Choose a reason for hiding this comment

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

Meaning if entity.sort_name is literally the string "0", it'll be "false" because perl. I think the intent here is to guard against entities that don't have a sort_name field at all, so it should be no longer needed if the check is moved as suggested below.

@gentlecat
Copy link
Contributor

@brainzbot, add to whitelist.

@chirlu
Copy link
Contributor

chirlu commented Feb 11, 2017

I’m against this “improvement”; see the ticket for rationale.

Furthermore, how it is implemented in this PR is broken in several ways, but I would prefer not to waste time on writing review comments unless I actually have to.

@Freso
Copy link
Member

Freso commented Feb 12, 2017

If you mention it, you have to. Even if the PR is dropped, @reosarevok (or other people watching along) cannot learn and improve from the mistakes they're not told about. So either don't mention that it is flawed, or back it up by arguing why.

Copy link
Contributor

@chirlu chirlu left a comment

Choose a reason for hiding this comment

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

In addition to the specific issues mentioned, changes to the corresponding JS functions are missing completely.

@@ -350,8 +350,12 @@ END -%]
IF namevar AND action == 'show' AND content != ''
AND (noescape ? html_unescape(content.remove('</?span\b[^>]*>')) : content) != entity.name;
options.unshift('name_variation');
hover = hover != '' ? l('{name} – {additional_info}', { name => entity.name, additional_info => hover })
: entity.name;
IF (entity.sort_name && entity.sort_name == entity.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the wrong place to do changes specific for artists, as this is a generic macro that is used for all main entities.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I follow the reasoning there. The main part of this is already in the generic macro, despite only applying to entities with name variations (so, right now, artists, unless I'm forgetting some). How is it any different to also put here the code that applies to entities with name variations which happen to have a sort name equal to their name?

Copy link
Member

Choose a reason for hiding this comment

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

We also use namevar when recordings are linked to using a track name. So I think it's correct to do the change in link_artist instead, because artists are the only entities with sort names (well, non-alias ones).

@@ -350,8 +350,12 @@ END -%]
IF namevar AND action == 'show' AND content != ''
AND (noescape ? html_unescape(content.remove('</?span\b[^>]*>')) : content) != entity.name;
options.unshift('name_variation');
hover = hover != '' ? l('{name} – {additional_info}', { name => entity.name, additional_info => hover })
: entity.name;
IF (entity.sort_name && entity.sort_name == entity.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Depends on what you want. As it is, it checks whether the sort name is "0" or something else.

ELSE;
hoverprint = l('{name} – {additional_info}', { name => entity.name, additional_info => hover });
END;
hover = hover != '' ? hoverprint : entity.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

I refrain from commenting on this for the moment since it will have to look different when moved to its proper place.

@@ -350,8 +350,12 @@ END -%]
IF namevar AND action == 'show' AND content != ''
AND (noescape ? html_unescape(content.remove('</?span\b[^>]*>')) : content) != entity.name;
options.unshift('name_variation');
hover = hover != '' ? l('{name} – {additional_info}', { name => entity.name, additional_info => hover })
: entity.name;
IF (entity.sort_name && entity.sort_name == entity.name);
Copy link
Member

Choose a reason for hiding this comment

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

Meaning if entity.sort_name is literally the string "0", it'll be "false" because perl. I think the intent here is to guard against entities that don't have a sort_name field at all, so it should be no longer needed if the check is moved as suggested below.

@@ -350,8 +350,12 @@ END -%]
IF namevar AND action == 'show' AND content != ''
AND (noescape ? html_unescape(content.remove('</?span\b[^>]*>')) : content) != entity.name;
options.unshift('name_variation');
hover = hover != '' ? l('{name} – {additional_info}', { name => entity.name, additional_info => hover })
: entity.name;
IF (entity.sort_name && entity.sort_name == entity.name);
Copy link
Member

Choose a reason for hiding this comment

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

We also use namevar when recordings are linked to using a track name. So I think it's correct to do the change in link_artist instead, because artists are the only entities with sort names (well, non-alias ones).

@@ -145,7 +145,9 @@ const EntityLink = (props = {}) => {

if (nameVariation) {
if (hover) {
hover = l('{name} – {additional_info}', {name: entity.name, additional_info: hover});
if !(entity.name == entity.sortname) {
Copy link
Member

Choose a reason for hiding this comment

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

A ! outside the parens is not valid JavaScript. :P

Try (entity.name !== entity.sortname) instead.

Copy link
Member

Choose a reason for hiding this comment

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

Also, sortname should be sortName.

@reosarevok
Copy link
Member Author

We agreed during the meeting to close this and talk about the issue in Jira further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants