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-02-20 10:08 am

[dw-free] Pass subscribe/grant access to add.bml for quick usability fix

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

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

Usability improvement on adding edges from various points.

Patch by [personal profile] janinedog.

--------------------------------------------------------------------------------
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/DW/Logic/ProfilePage.pm
--- a/cgi-bin/DW/Logic/ProfilePage.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/DW/Logic/ProfilePage.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -112,7 +112,7 @@ sub action_links {
         my $remote_trusts = $remote && $remote->trusts( $u ) ? 1 : 0;
         $link->{text_ml} = $remote_trusts ? '.optionlinks.modifytrust' : '.optionlinks.addtrust';
         if ( $remote && ( $remote_trusts || $u->is_visible ) ) {
-            $link->{url} = "manage/circle/add.bml?user=$user";
+            $link->{url} = "manage/circle/add.bml?user=$user&action=access";
             $link->{title_ml} = $remote_trusts ? '.optionlinks.modifytrust.title.other' : '.optionlinks.addtrust.title.other';
             $link->{class} = 'profile_addtrust';
             $link->{image} = 'add-friend.gif';
@@ -133,7 +133,7 @@ sub action_links {
         my $remote_watches = $remote && $remote->watches( $u ) ? 1 : 0;
         $link->{text_ml} = $remote_watches ? '.optionlinks.modifysub' : '.optionlinks.addsub';
         if ( $remote && ( $remote_watches || $u->is_visible ) ) {
-            $link->{url} = "manage/circle/add.bml?user=$user";
+            $link->{url} = "manage/circle/add.bml?user=$user&action=subscribe";
 
             if ( $remote->equals( $u ) ) {
                 $link->{title_ml} = $remote_watches ? '.optionlinks.modifysub.title.self' : '.optionlinks.addsub.title.self';
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/CommunityInvite.pm
--- a/cgi-bin/LJ/Event/CommunityInvite.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/CommunityInvite.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -68,7 +68,7 @@ sub _as_email {
             'esn.read_last_comm_entries'    => [ 2, $community_url ],
             'esn.view_profile'              => [ 3, $community_profile ],
             'esn.add_friend'                => [ $u->watches( $self->comm ) ? 0 : 4,
-                                                "$LJ::SITEROOT/manage/circle/add.bml?user=$community_user" ],
+                                                "$LJ::SITEROOT/manage/circle/add.bml?user=$community_user&action=subscribe" ],
         }
     );
 }
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/CommunityJoinApprove.pm
--- a/cgi-bin/LJ/Event/CommunityJoinApprove.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/CommunityJoinApprove.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -63,7 +63,7 @@ sub _as_email {
     $vars->{'options'} =
         $self->format_options($is_html, $lang, $vars,
             {
-                'esn.add_friend_community'  => [ 1, "$LJ::SITEROOT/manage/circle/add.bml?user=" . $cu->{user} ],
+                'esn.add_friend_community'  => [ 1, "$LJ::SITEROOT/manage/circle/add.bml?user=" . $cu->{user} . "&action=subscribe" ],
             });
 
     return LJ::Lang::get_text($lang, 'esn.comm_join_approve.email_text', undef, $vars);
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/InvitedFriendJoins.pm
--- a/cgi-bin/LJ/Event/InvitedFriendJoins.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/InvitedFriendJoins.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -61,7 +61,7 @@ sub _as_email {
     return LJ::Lang::get_text($lang, 'esn.invited_friend_joins.email', undef, $vars) .
         $self->format_options($is_html, $lang, $vars,
         {
-            'esn.add_friend'            => [ 1, "$LJ::SITEROOT/manage/circle/add.bml?user=$newusername" ], # Why not $self->friend->addfriend_url ?
+            'esn.add_friend'            => [ 1, "$LJ::SITEROOT/manage/circle/add.bml?user=$newusername&action=subscribe" ], # Why not $self->friend->addfriend_url ?
             'esn.read_journal'          => [ 2, $newuser_url ],
             'esn.view_profile'          => [ 3, $newuser_profile ],
             'esn.invite_another_friend' => [ 4, "$LJ::SITEROOT/manage/circle/invite.bml" ],
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/JournalNewEntry.pm
--- a/cgi-bin/LJ/Event/JournalNewEntry.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/JournalNewEntry.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -222,7 +222,7 @@ sub _as_email {
                 'esn.read_user_entries'     => [ ($self->entry->journal->is_comm) ? 0 : 4,
                                                     $journal_url ],
                 'esn.add_friend'            => [ $u->watches( $self->entry->journal ) ? 0 : 5,
-                                                    "$LJ::SITEROOT/manage/circle/add.bml?user=$journal_user" ],
+                                                    "$LJ::SITEROOT/manage/circle/add.bml?user=$journal_user&action=subscribe" ],
             });
 
     return $email;
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/NewUserpic.pm
--- a/cgi-bin/LJ/Event/NewUserpic.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/NewUserpic.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -55,7 +55,7 @@ You can:
     unless ( $u->watches( $self->userpic->owner ) ) {
         $email .= "
   - Add $poster to your reading list:
-    $LJ::SITEROOT/manage/circle/add.bml?user=$poster";
+    $LJ::SITEROOT/manage/circle/add.bml?user=$poster&action=subscribe";
     }
 
 $email .= "
@@ -86,7 +86,7 @@ You can:<ul>";
 You can:<ul>";
 
     $email .= "<li><a href=\"$LJ::SITEROOT/allpics.bml?user=$postername\">View all of $postername\'s userpics</a></li>";
-    $email .= "<li><a href=\"$LJ::SITEROOT/manage/circle/add.bml?user=$postername\">Add $postername to your reading list</a></li>"
+    $email .= "<li><a href=\"$LJ::SITEROOT/manage/circle/add.bml?user=$postername&action=subscribe\">Add $postername to your reading list</a></li>"
         unless $u->watches( $self->userpic->owner );
     $email .= "<li><a href=\"$journal_url\">View their journal</a></li>";
     $email .= "<li><a href=\"$profile\">View their profile</a></li></ul>";
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/Event/UserMessageRecvd.pm
--- a/cgi-bin/LJ/Event/UserMessageRecvd.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/Event/UserMessageRecvd.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -54,7 +54,7 @@ sub _as_email {
             'esn.view_profile'    => [ 1, $other_u->profile_url ],
             'esn.read_journal'    => [ 2, $other_u->journal_base ],
             'esn.add_friend'      => [ $u->watches( $other_u ) ? 0 : 3,
-                                            "$LJ::SITEROOT/manage/circle/add.bml?user=$sender" ],
+                                            "$LJ::SITEROOT/manage/circle/add.bml?user=$sender&action=subscribe" ],
         }
     );
 
@@ -109,7 +109,7 @@ sub as_html_actions {
 
     my $ret = "<div class='actions'>";
     $ret .= " <a href='$LJ::SITEROOT/inbox/compose.bml?mode=reply&msgid=$msgid'>Reply</a>";
-    $ret .= " | <a href='$LJ::SITEROOT/manage/circle/add.bml?user=". $msg->other_u->user ."'>Add to reading list</a>"
+    $ret .= " | <a href='$LJ::SITEROOT/manage/circle/add.bml?user=". $msg->other_u->user ."&action=subscribe'>Add to reading list</a>"
         unless $u->watches( $msg->other_u );
     $ret .= " | <a href='$LJ::SITEROOT/inbox/markspam.bml?msgid=". $msg->msgid ."'>Mark as Spam</a>";
     $ret .= "</div>";
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Fri Feb 20 10:08:15 2009 +0000
@@ -3867,7 +3867,7 @@ sub render_promo_of_community {
     my $blurb = $comm->prop('comm_promo_blurb') || '';
 
     my $join_link = "$LJ::SITEROOT/community/join.bml?comm=$comm->{user}";
-    my $watch_link = "$LJ::SITEROOT/manage/circle/add.bml?user=$comm->{user}";
+    my $watch_link = "$LJ::SITEROOT/manage/circle/add.bml?user=$comm->{user}&action=subscribe";
     my $read_link = $comm->journal_base;
 
     LJ::need_res("stc/lj_base.css");
diff -r 3db4b56af107 -r c4fdb12e764d cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Fri Feb 20 10:00:14 2009 +0000
+++ b/cgi-bin/weblib.pl	Fri Feb 20 10:08:15 2009 +0000
@@ -2928,13 +2928,13 @@ sub control_strip
         $links{'view_friends_page'} = "<a href='" . $remote->journal_base . "/read/'>$BML::ML{'web.controlstrip.links.viewreadingpage'}</a>";
         $links{'add_friend'} = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}'>$BML::ML{'web.controlstrip.links.addtocircle'}</a>";
         if ($journal->is_syndicated || $journal->is_news) {
-            $links{'add_friend'} = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}'>$BML::ML{'web.controlstrip.links.addfeed'}</a>";
+            $links{'add_friend'} = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}&action=subscribe'>$BML::ML{'web.controlstrip.links.addfeed'}</a>";
             $links{'remove_friend'} = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}'>$BML::ML{'web.controlstrip.links.removefeed'}</a>";
         }
         if ($journal->is_community) {
             $links{'join_community'}   = "<a href='$LJ::SITEROOT/community/join.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.joincomm'}</a>";
             $links{'leave_community'}  = "<a href='$LJ::SITEROOT/community/leave.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.leavecomm'}</a>";
-            $links{'watch_community'}  = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}'>$BML::ML{'web.controlstrip.links.watchcomm'}</a>";
+            $links{'watch_community'}  = "<a href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}&action=subscribe'>$BML::ML{'web.controlstrip.links.watchcomm'}</a>";
             $links{'unwatch_community'}   = "<a href='$LJ::SITEROOT/community/leave.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.removecomm'}</a>";
             $links{'post_to_community'}   = "<a href='$LJ::SITEROOT/update.bml?usejournal=$journal->{user}'>$BML::ML{'web.controlstrip.links.postcomm'}</a>";
             $links{'edit_community_profile'} = "<a href='$LJ::SITEROOT/manage/profile/?authas=$journal->{user}'>$BML::ML{'web.controlstrip.links.editcommprofile'}</a>";
diff -r 3db4b56af107 -r c4fdb12e764d htdocs/approve.bml
--- a/htdocs/approve.bml	Fri Feb 20 10:00:14 2009 +0000
+++ b/htdocs/approve.bml	Fri Feb 20 10:08:15 2009 +0000
@@ -56,7 +56,7 @@ body<=
         return "<?h1 $ML{'.comm.success'} h1?>".
                '<?p '.BML::ml('.comm.text',
                {'comm'=>LJ::ljuser($username),
-                'aopts'=>'href="'.$LJ::SITEROOT.'/manage/circle/add.bml?user='.$username.'"'}).
+                'aopts'=>'href="'.$LJ::SITEROOT.'/manage/circle/add.bml?user='.$username.'&action=subscribe"'}).
                ' p?>';
     }
 
@@ -76,7 +76,7 @@ body<=
         return "<?h1 $ML{'.shared.success'} h1?>".
                '<?p '.BML::ml('.shared.text',
                {'shared'=>LJ::ljuser($username),
-                'aopts'=>'href="'.$LJ::SITEROOT.'/manage/circle/add.bml?user='.$username.'"'}).
+                'aopts'=>'href="'.$LJ::SITEROOT.'/manage/circle/add.bml?user='.$username.'&action=subscribe"'}).
                ' p?>';
     }
 
diff -r 3db4b56af107 -r c4fdb12e764d htdocs/community/join.bml
--- a/htdocs/community/join.bml	Fri Feb 20 10:00:14 2009 +0000
+++ b/htdocs/community/join.bml	Fri Feb 20 10:08:15 2009 +0000
@@ -112,7 +112,7 @@ body<=
 
         # add community as a friend if selected
         if ($POST{addfriend}) {
-            BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$cu->{user}");
+            BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$cu->{user}&action=subscribe");
         }
 
         # success message -- only shows if user didn't add the community as a friend
diff -r 3db4b56af107 -r c4fdb12e764d htdocs/manage/circle/add.bml
--- a/htdocs/manage/circle/add.bml	Fri Feb 20 10:00:14 2009 +0000
+++ b/htdocs/manage/circle/add.bml	Fri Feb 20 10:08:15 2009 +0000
@@ -12,6 +12,9 @@
     };
 
     my $head     = \$_[1]->{'head'};
+
+    my $action = $GET{action};
+    $action = '' unless $action eq 'access' || $action eq 'subscribe';
 
     my $remote = LJ::get_remote();
     my $user = $POST{'user'} || $GET{'user'};
@@ -161,7 +164,7 @@
         $body .= LJ::html_check({
             name => "add_trust",
             id => "add_trust",
-            selected => $trusted ? 1 : 0,
+            selected => $trusted || $action eq 'access' ? 1 : 0,
             label => $ML{'.add.trust'},
         }) . "<br />";
     }
@@ -169,7 +172,7 @@
     $body .= LJ::html_check({
         name => "add_watch",
         id => "add_watch",
-        selected => $watched ? 1 : 0,
+        selected => $watched || $action eq 'subscribe' ? 1 : 0,
         label => $ML{'.add.watch'},
     });
 
diff -r 3db4b56af107 -r c4fdb12e764d htdocs/syn/index.bml
--- a/htdocs/syn/index.bml	Fri Feb 20 10:00:14 2009 +0000
+++ b/htdocs/syn/index.bml	Fri Feb 20 10:08:15 2009 +0000
@@ -124,7 +124,7 @@ body<=
                                                       "WHERE s.synurl=? AND s.userid=u.userid",
                                                       undef, $syn_url);
                     if ($adu) {
-                        return BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$adu->{user}");
+                        return BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$adu->{user}&action=subscribe");
                     } else {
                         $res = $ua->get($syn_url);
                         $content = $res && $res->is_success ? $res->content : "";
@@ -168,7 +168,7 @@ body<=
 
         # at this point, we have a new account, or an old account, but we have an account, so
         # let's redirect them to the add page
-        return BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$su->{user}");
+        return BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=$su->{user}&action=subscribe");
     }
 
     # get most popular feeds from memcache
--------------------------------------------------------------------------------