Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MBS-5525: Correctly display parent changes in 'edit relationship type…

…' edits

Previously, we didn't load the actual LinkType objects (pointed to via
parent_id). Furthermore, the test for display and the display itself was wrong,
so that's also been fixed up.
  • Loading branch information...
commit 23dafa24508e248204d9f337a8c10c392c662993 1 parent 0f609e6
@ocharles ocharles authored
View
14 lib/MusicBrainz/Server/Edit/Relationship/EditLinkType.pm
@@ -66,7 +66,11 @@ sub foreign_keys {
map { $_->{type} }
@{ $self->data->{old}{attributes} },
@{ $self->data->{new}{attributes} }
- ]
+ ],
+ LinkType => [
+ map { $self->data->{$_}{parent_id} }
+ qw( old new )
+ ],
}
}
@@ -92,12 +96,18 @@ sub build_display_data {
$self->data->{old}{attributes},
$self->data->{new}{attributes}
);
- return if Compare($old, $new);
+ return if Compare($old, $new) &&
+ $self->data->{old}{parent_id} == $self->data->{new}{parent_id};
return {
attributes => {
old => $self->_build_attributes($old, $loaded),
new => $self->_build_attributes($new, $loaded),
+ },
+ parent => {
+ map {
+ $_ => $loaded->{LinkType}{ $self->data->{$_}{parent_id} }
+ } qw( old new )
}
}
}
View
6 root/edit/details/edit_relationship_type.tt
@@ -45,11 +45,11 @@
</tr>
[% END %]
- [% IF edit.data.old.parent %]
+ [% IF edit.data.old.parent_id != edit.data.new.parent_id %]
<tr>
<th>[% l('Parent') %]</th>
- <td class="old">[% edit.data.old.parent %]</td>
- <td class="new">[% edit.data.new.parent %]</td>
+ <td class="old">[% edit.display_data.parent.old.name %]</td>
+ <td class="new">[% edit.display_data.parent.new.name %]</td>
</tr>
[% END %]
</table>

0 comments on commit 23dafa2

Please sign in to comment.
Something went wrong with that request. Please try again.