mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-17 07:14 am

[dw-free] The Add Relationships part of the Manage Circle page unsubscribes/removes access enthusias

[commit: http://hg.dwscoalition.org/dw-free/rev/9b8101ab1705]

http://bugs.dwscoalition.org/show_bug.cgi?id=433

Don't remove WTF edges if you are just trying to change the color.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/manage/circle/edit.bml
--------------------------------------------------------------------------------
diff -r 066bb683477a -r 9b8101ab1705 htdocs/manage/circle/edit.bml
--- a/htdocs/manage/circle/edit.bml	Tue Mar 17 06:51:28 2009 +0000
+++ b/htdocs/manage/circle/edit.bml	Tue Mar 17 07:14:02 2009 +0000
@@ -257,16 +257,21 @@ body<=
                 my $watched_nonotify = $u->watches( $other_u ) ? 1 : 0;
                 $userid_processed{$other_u->id} = 1;
 
+                # only modify relationship if at least one of the checkboxes is checked
+                # otherwise, assume that the user was editing colors
+                # and do not remove the existing edges
+                my $edit_color_only = ! ( $POST{"editfriend_add_${num}_trust"} || $POST{"editfriend_add_${num}_watch"} );
+
                 if ( $POST{"editfriend_add_${num}_trust"} ) {
                     $u->add_edge( $other_u, trust => {
                         nonotify => $trusted_nonotify ? 1 : 0,
                     } );
-                } else {
+                } elsif( ! $edit_color_only ) {
                     $u->remove_edge( $other_u, trust => {
                         nonotify => $trusted_nonotify ? 0 : 1,
                     } );
                 }
-                if ( $POST{"editfriend_add_${num}_watch"} ) {
+                if ( $POST{"editfriend_add_${num}_watch"} || $edit_color_only ) {
                     my $fg = LJ::color_todb( $POST{"editfriend_add_${num}_fg"} );
                     my $bg = LJ::color_todb( $POST{"editfriend_add_${num}_bg"} );
                     $u->add_edge( $other_u, watch => {
@@ -274,7 +279,7 @@ body<=
                         bgcolor => $bg,
                         nonotify => $watched_nonotify ? 1 : 0,
                     } );
-                } else {
+                } elsif( ! $edit_color_only ) {
                     $u->remove_edge( $other_u, watch => {
                         nonotify => $watched_nonotify ? 0 : 1,
                     } );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org