[dw-free] remove LJ::add_friend and LJ::remove_friend
[commit: http://hg.dwscoalition.org/dw-free/rev/4894aa8bbd98]
http://bugs.dwscoalition.org/show_bug.cgi?id=2891
Remove unused friends-related code (WTF cleanup).
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2891
Remove unused friends-related code (WTF cleanup).
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/User/Edges/WatchTrust.pm
- cgi-bin/LJ/Poll.pm
- cgi-bin/LJ/User.pm
- t/directorysearch-extra.t
- t/esn-journalnewcomment.t
-------------------------------------------------------------------------------- diff -r 180727e19540 -r 4894aa8bbd98 cgi-bin/DW/User/Edges/WatchTrust.pm --- a/cgi-bin/DW/User/Edges/WatchTrust.pm Thu Aug 19 13:16:13 2010 -0500 +++ b/cgi-bin/DW/User/Edges/WatchTrust.pm Thu Aug 19 19:52:24 2010 -0500 @@ -1109,7 +1109,8 @@ sub _can_add_wt_edge { $fr_user = LJ::want_user($fr_user); } - return 1 if $fr_user && $fr_user->is_friend($u); + return 1 if $fr_user && + ( $fr_user->watches( $u ) || $fr_user->trusts( $u ) ); } unless ($u->rate_log('addfriend', 1)) { diff -r 180727e19540 -r 4894aa8bbd98 cgi-bin/LJ/Poll.pm --- a/cgi-bin/LJ/Poll.pm Thu Aug 19 13:16:13 2010 -0500 +++ b/cgi-bin/LJ/Poll.pm Thu Aug 19 19:52:24 2010 -0500 @@ -1171,8 +1171,8 @@ sub can_view { return 0 if $self->whoview eq 'none'; # okay if everyone can view or if trusted can view and remote is a friend - my $is_friend = $remote && $self->journal->trusts_or_has_member( $remote ); - return 1 if $self->whoview eq "all" || ($self->whoview eq "trusted" && $is_friend); + my $has_access = $remote && $self->journal->trusts_or_has_member( $remote ); + return 1 if $self->whoview eq "all" || ( $self->whoview eq "trusted" && $has_access ); return 0; } diff -r 180727e19540 -r 4894aa8bbd98 cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Thu Aug 19 13:16:13 2010 -0500 +++ b/cgi-bin/LJ/User.pm Thu Aug 19 19:52:24 2010 -0500 @@ -6169,22 +6169,6 @@ sub email { } -*has_friend = \&is_friend; -sub is_friend { - confess 'LJ::User->is_friend is deprecated'; -} - - -sub add_friend { - confess 'LJ::User->add_friend deprecated.'; -} - - -sub remove_friend { - confess 'LJ::User->remove_friend has been deprecated.'; -} - - # FIXME: Needs updating for WTF sub opt_showmutualfriends { my $u = shift; @@ -6222,7 +6206,7 @@ use Carp; ######################################################################## ### Please keep these categorized and alphabetized for ease of use. -### If you need a new category, add it at the end, BEFORE category 99. +### If you need a new category, add it at the end. ### Categories kinda fuzzy, but better than nothing. Weird numbers are ### to match the sections above -- please check up there if adding. ### @@ -6243,7 +6227,6 @@ use Carp; ### 21. Password Functions ### 24. Styles and S2-Related Functions ### 28. Userpic-Related Functions -### 99. Miscellaneous Legacy Items ######################################################################## ### 1. Creating and Deleting Accounts @@ -8748,11 +8731,4 @@ sub userpic_count { } -######################################################################## -### 99. Miscellaneous Legacy Items - -# FIXME: these are deprecated and no longer used; check what calls them and kill it. -sub add_friend { confess 'LJ::add_friend has been deprecated.'; } -sub remove_friend { confess 'LJ::remove_friend has been deprecated.'; } - 1; diff -r 180727e19540 -r 4894aa8bbd98 t/directorysearch-extra.t --- a/t/directorysearch-extra.t Thu Aug 19 13:16:13 2010 -0500 +++ b/t/directorysearch-extra.t Thu Aug 19 19:52:24 2010 -0500 @@ -51,10 +51,10 @@ memcache_stress(sub { # test friend/friendof searching { - $u1->add_friend($u2); - $u2->add_friend($u1); - $u1->remove_friend($u1); - $u2->remove_friend($u2); + $u1->add_edge( $u2, watch => { nonotify => 1 } ); + $u2->add_edge( $u1, watch => { nonotify => 1 } ); + $u1->remove_edge( $u1, watch => { nonotify => 1 } ); + $u2->remove_edge( $u2, watch => { nonotify => 1 } ); $search = LJ::Directory::Search->new; $search->add_constraint(LJ::Directory::Constraint::HasFriend->new(userid => $u2->userid)); diff -r 180727e19540 -r 4894aa8bbd98 t/esn-journalnewcomment.t --- a/t/esn-journalnewcomment.t Thu Aug 19 13:16:13 2010 -0500 +++ b/t/esn-journalnewcomment.t Thu Aug 19 19:52:24 2010 -0500 @@ -200,7 +200,7 @@ test_esn_flow(sub { ok(! $email, "Non-subscribed user did not get notification"); # remove the friend - LJ::remove_friend($u1, $u2); + $u1->remove_edge( $u2, watch => { nonotify => 1 } ); } elsif ($pass == 2) { $email = $got_email{$u1->{userid}}; --------------------------------------------------------------------------------