]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
move fave notification to mail library
authorEvan Prodromou <evan@controlyourself.ca>
Sat, 4 Oct 2008 15:44:54 +0000 (11:44 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sat, 4 Oct 2008 15:44:54 +0000 (11:44 -0400)
darcs-hash:20081004154454-5ed1f-6b5b66945d415690f4cac5e66c1edad71ec031a5.gz

actions/favor.php
lib/mail.php

index 7718f84d2db0dfe11b835611e83e416b30bf48ff..dd61899e4b3b3a29b7624e37d9d491e3cc2012f4 100644 (file)
@@ -83,30 +83,11 @@ class FavorAction extends Action {
            $other = User::staticGet('id', $notice->profile_id);
                if ($other && $other->id != $user->id) {
                        if ($other->email && $other->emailnotifyfav) {
-                               $this->notify_mail($other, $user, $notice);
+                               mail_notify_fave($other, $user, $notice);
                        }
                        # XXX: notify by IM
                        # XXX: notify by SMS
                }
        }
 
-       function notify_mail($other, $user, $notice) {
-               $profile = $user->getProfile();
-               $bestname = $profile->getBestName();
-               $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
-               $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" .
-                                                 "In case you forgot, you can see the text of your notice here:\n\n" .
-                                                 "%3\$s\n\n" .
-                                                 "You can see the list of %1\$s's favorites here:\n\n" .
-                                                 "%4\$s\n\n" .
-                                                 "Faithfully yours,\n" .
-                                                 "%5\$s\n"),
-                                               $bestname,
-                                               common_exact_date($notice->created),
-                                               common_local_url('shownotice', array('notice' => $notice->id)),
-                                               common_local_url('showfavorites', array('nickname' => $user->nickname)),
-                                               common_config('site', 'name'));
-
-               mail_to_user($other, $subject, $body);
-       }
 }
\ No newline at end of file
index 827e48e811b80c223a2684cfb3e9f894d41dd283..b6ce1fe22cf6e53567f761820e5b46edecb7d7e7 100644 (file)
@@ -267,3 +267,24 @@ function mail_notify_message($message, $from=NULL, $to=NULL) {
        
        return mail_to_user($to, $subject, $body);
 }
+
+function mail_notify_fave($other, $user, $notice) {
+       $profile = $user->getProfile();
+       $bestname = $profile->getBestName();
+       $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
+       $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" .
+                                         "In case you forgot, you can see the text of your notice here:\n\n" .
+                                         "%3\$s\n\n" .
+                                         "You can see the list of %1\$s's favorites here:\n\n" .
+                                         "%4\$s\n\n" .
+                                         "Faithfully yours,\n" .
+                                         "%5\$s\n"),
+                                       $bestname,
+                                       common_exact_date($notice->created),
+                                       common_local_url('shownotice', array('notice' => $notice->id)),
+                                       common_local_url('showfavorites', array('nickname' => $user->nickname)),
+                                       common_config('site', 'name'));
+       
+       mail_to_user($other, $subject, $body);
+}
+  
\ No newline at end of file