changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[livejournal] r14773: LJSUP-3069: Find you Friends page (LJSUP...

Committer: ssafronova
LJSUP-3069: Find you Friends page (LJSUP-3586: Correct path #2 to match specification)

U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm
U   trunk/htdocs/tools/endpoints/multisearch.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2009-01-15 12:45:37 UTC (rev 14772)
+++ trunk/bin/upgrading/en.dat	2009-01-16 08:38:53 UTC (rev 14773)
@@ -3507,12 +3507,18 @@
 
 widget.s2propgroup.presentation.note=Note: Additional options may vary based on the layout selected.
 
-widget.search.aim=AIM
+widget.search.aim=AOL IM
 
 widget.search.email=Email
 
+widget.search.empty.query=Please enter a query
+
+widget.search.google_talk=Google Talk
+
 widget.search.icq=ICQ Number
 
+widget.search.init_text=Gathering information...
+
 widget.search.interest=Interest
 
 widget.search.interestonly=Find people and communities interested in:
@@ -3525,14 +3531,24 @@
 
 widget.search.note=If you know some information for an existing LiveJournal user you can search for it here.
 
+widget.search.query_error=Sorry, there was an internal error. Please try again shortly.
+
 widget.search.region=Region
 
+widget.search.skype=Skype
+
 widget.search.submit=Search existing users
 
 widget.search.title=Search for
 
 widget.search.existingtitle=Or search for an individual user:
 
+widget.search.not_valid.email=Sorry, it looks like email address you entered is invalid. Could you please update the address or try a different one?
+
+widget.search.not_valid.username=Sorry, it looks like username you entered is invalid. Could you please update the username or try a different one?
+
+widget.search.not_valid.IM_handle=Sorry, it looks like IM handle you entered is invalid. Could you please update the IM handle or try a different one?
+
 widget.search.username=Username
 
 widget.search.yahoo=Yahoo! ID

Modified: trunk/cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm	2009-01-15 12:45:37 UTC (rev 14772)
+++ trunk/cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm	2009-01-16 08:38:53 UTC (rev 14773)
@@ -23,6 +23,8 @@
         'jabber' => $class->ml('.widget.search.jabber'),
         'msn' => $class->ml('.widget.search.msn'),
         'yahoo' => $class->ml('.widget.search.yahoo'),
+        'skype' => $class->ml('widget.search.skype'),
+        'google_talk' => $class->ml('widget.search.google_talk'),
     );
 
     $ret .= "<div class='mailfinder exists'>";
@@ -45,11 +47,12 @@
 sub js {
     my $self = shift;
 
-    my $empty_query = $self->ml('widget.findfriendsinexistingusers.empty.query');
-    my $init_text = $self->ml('widget.findfriendsinexistingusers.init_text');
-    my $job_error = $self->ml('widget.findfriendsinexistingusers.job_error');
-    my $validate_error = 'Неправильный номер';
-    my $validate_name_error = 'Неправильное имя пользователя';
+    my $empty_query = $self->ml('widget.search.empty.query');
+    my $init_text = $self->ml('widget.search.init_text');
+    my $query_error = $self->ml('widget.search.query_error');
+    my $validate_email_error = $self->ml('widget.search.not_valid.email');
+    my $validate_name_error = $self->ml('widget.search.not_valid.username');
+    my $validate_IM_error = $self->ml('widget.search.not_valid.IM_handle');
 
     qq [
         initWidget: function() {
@@ -98,7 +101,7 @@
             }
 
             if (info.status != 'success') {
-                return this.import_error('$job_error');
+                return this.import_error('$query_error');
             }
 
             \$('Widget[FindFriendsInExistingUsers]_ajax_status').innerHTML = info.result;
@@ -108,17 +111,19 @@
             var v = this.form['Widget[FindFriendsInExistingUsers]_q'].value.trim(),
                 r,
                 select = this.form['Widget[FindFriendsInExistingUsers]_type'],
-                error_msg = '$validate_error';
+                error_msg = '$validate_IM_error';
 
             switch (select.options[select.selectedIndex].value) {
                 case 'user':
                     r = /^[0-9a-z_-]{1,15}\$/i;
                     error_msg = '$validate_name_error';
                     break;
+                case 'email':
                 case 'jabber':
-                case 'email':
                 case 'msn':
                 case 'yahoo':
+                case 'google_talk':
+                    error_msg = '$validate_email_error';
                     r = /^(("[\\w-\\s]+")|([\\w-]+(?:\\.[\\w-]+)*)|("[\\w-\\s]+")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)\$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?\$)/i;
                     break;
                 case 'skype':

Modified: trunk/htdocs/tools/endpoints/multisearch.bml
===================================================================
--- trunk/htdocs/tools/endpoints/multisearch.bml	2009-01-15 12:45:37 UTC (rev 14772)
+++ trunk/htdocs/tools/endpoints/multisearch.bml	2009-01-16 08:38:53 UTC (rev 14773)
@@ -78,7 +78,7 @@
         foreach $uid (@$uids_ref) {
             $uid = $uid->[0]; # dereference
             if (my $u = LJ::load_userid($uid)) {
-                next unless $u->opt_findbyemail =~ /Y|H/; # The user has allowed to search for it by email
+                next unless $u->opt_findbyemail =~ /Y/; # The user has allowed to search for it by email
                 if ($output eq "foaf") {
                     $ret{result} .= '<a href="' . LJ::journal_base($u) . '/data/foaf">' . $u->{user}. '</a>';
                 } else {
@@ -95,13 +95,18 @@
     if ($type eq "im" ||
         $type eq "aolim" || $type eq "icq" ||
         $type eq "yahoo" || $type eq "msn" ||
-        $type eq "jabber") {
+        $type eq "jabber" || $type eq "skype" ||
+        $type eq "google_talk") {
 
         use LJ::Directory::Constraint::ContactInfo;
         my @uids = LJ::Directory::Constraint::ContactInfo->new(screenname => $q)->matching_uids;
 
-        if (@uids == 1) {
-            my $u = LJ::load_userid(shift @uids);
+        my $us = LJ::load_userids(@uids);
+        my @us = grep { $_->opt_findbyemail =~ /Y/ and $_->opt_showcontact =~ /Y|R/ } values %$us;
+
+        if (@us == 1) {
+            my $u = shift @us;
+
             my %ret;
             $ret{status} = 'success';
             if ($output eq "foaf") {
@@ -110,13 +115,12 @@
                 $ret{result} = '<a href="' . $u->profile_url . '">' . $u->{user}. '</a>';
             }
             return LJ::js_dumper(\%ret);
-        } elsif (@uids > 1) {
-            my $us = LJ::load_userids(@uids);
+        } elsif (@us > 1) {
 
             my %ret;
             $ret{status} = 'success';
             $ret{result} = LJ::user_search_display(
-                                                    users      => [ values %$us ],
+                                                    users      => \@us,
                                                     timesort   => 1,
                                                     perpage    => 50,
                                                   );

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments