]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/disfavor.php
try to make replies point to the clicked-on notice
[quix0rs-gnu-social.git] / actions / disfavor.php
index 467a52df5d88602b7afcdbf110740c3a1d33b433..35cfd60707fc26d45f2c657043a19dcd1d00d1a1 100644 (file)
@@ -33,7 +33,7 @@ class DisfavorAction extends Action {
                $user = common_current_user();
 
                if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-                       common_redirect(common_local_url('favorites', array('nickname' => $user->nickname)));
+                       common_redirect(common_local_url('showfavorites', array('nickname' => $user->nickname)));
                        return;
                }
 
@@ -63,10 +63,21 @@ class DisfavorAction extends Action {
                        $this->server_error(_('Could not delete favorite.'));
                        return;
                }
-
-               # XXX: ajax response
-
-               common_redirect(common_local_url('favorites',
-                                                                                array('nickname' => $user->nickname)));
+               
+               $user->blowFavesCache();
+
+               if ($this->boolean('ajax')) {
+                       common_start_html('text/xml');
+                       common_element_start('head');
+                       common_element('title', _('Favor'));
+                       common_element_end('head');
+                       common_element_start('body');
+                       common_favor_form($notice);
+                       common_element_end('body');
+                       common_element_end('html');
+               } else {
+                       common_redirect(common_local_url('showfavorites',
+                                                                                        array('nickname' => $user->nickname)));
+               }
        }
 }
\ No newline at end of file