[mb-commits] branch, mbs-5750, updated. MBS-5525: Correctly display parent changes in 'edit relationship type' edits

MusicBrainz Git Server <[email protected]> Tue, 22 Jan 2013 15:39:44 +0000
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1Txfwu-00056a-K3@wiley>
The branch, mbs-5750 has been updated
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=d4b4cbd942d8e8d02f3aa0fc634435f0f80785c6 (commit)
      from  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=ddb2d02b40e36f8cc4a5542d0c6625e4764c2c93 (commit)

Summary of changes:
 .../Server/Edit/Relationship/EditLinkType.pm       |   14 ++++++++++++--
 root/edit/details/edit_relationship_type.tt        |    6 +++---
 2 files changed, 15 insertions(+), 5 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d4b4cbd942d8e8d02f3aa0fc634435f0f80785c6
Author: Oliver Charles <[email protected]>
Date:   Tue Jan 22 15:39:12 2013 +0000

    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.

diff --git a/lib/MusicBrainz/Server/Edit/Relationship/EditLinkType.pm b/lib/MusicBrainz/Server/Edit/Relationship/EditLinkType.pm
index 976ef85..4eaf7ff 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship/EditLinkType.pm
+++ b/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 )
         }
     }
 }
diff --git a/root/edit/details/edit_relationship_type.tt b/root/edit/details/edit_relationship_type.tt
index 82289e1..af2e9fd 100644
--- a/root/edit/details/edit_relationship_type.tt
+++ b/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>

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server