]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fix subscriptions a bit
authorEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 18:56:02 +0000 (14:56 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 18:56:02 +0000 (14:56 -0400)
darcs-hash:20080521185602-84dde-9e058c34c251d96cf557c1dd459523aa434bed79.gz

actions/showstream.php
actions/subscribe.php
actions/unsubscribe.php

index 42f1f04cd32360ed3af19e4bb2fb7b5abf6e0e11..bf9df04a3488fdf66a2168e4b24c36485ca6738e 100644 (file)
@@ -136,7 +136,9 @@ class ShowstreamAction extends StreamAction {
                                                                          'name' => 'subscribeto',
                                                                          'type' => 'hidden',
                                                                          'value' => $profile->nickname));
-               common_element('input', array('type' => 'submit', 'value' => _t('Subscribe')));
+               common_element('input', array('type' => 'submit',
+                                                                         'class' => 'button',
+                                                                         'value' => _t('Subscribe')));
                common_element_end('form');
        }
 
@@ -147,7 +149,9 @@ class ShowstreamAction extends StreamAction {
                                                                          'name' => 'unsubscribeto',
                                                                          'type' => 'hidden',
                                                                          'value' => $profile->nickname));
-               common_element('input', array('type' => 'submit'), _t('Unsubscribe'));
+               common_element('input', array('type' => 'submit',
+                                                                         'class' => 'button',
+                                                                         'value' => _t('Unsubscribe')));
                common_element_end('form');
        }
 
index 1ca57a43ba0ccdff6e5a0e1bd75a5ff939d98391..522c315935a1ca46e184e82a3c8171b64c5768d7 100644 (file)
@@ -50,20 +50,12 @@ class SubscribeAction extends Action {
 
                $sub->created = DB_DataObject_Cast::dateTime(); # current time
 
-               $val = $sub->validate();
-
-               if ($val !== TRUE) {
-                       # XXX: give some error notice
-                       common_server_error(_t('Subscription did not validate.'));
-                       return;
-               }
-
                if (!$sub->insert()) {
                        common_server_error(_t('Couldn\'t create subscription.'));
                        return;
                }
 
-               common_redirect(common_local_url('all', array('nickname' =>
-                                                                                                         $user->nickname)));
+               common_redirect(common_local_url('subscriptions', array('nickname' =>
+                                                                                                                               $user->nickname)));
        }
 }
\ No newline at end of file
index bac7523932e4e92e3eda81832f915c8430b5ea6a..fabb7148e1404a27a65b60740afced403d58bf0c 100644 (file)
@@ -37,16 +37,21 @@ class UnsubscribeAction extends Action {
                        common_server_error(_t('Not subscribed!.'));
                }
 
-               $sub = new Subscription();
+               $sub = DB_DataObject::factory('subscription');
+               
                $sub->subscriber = $user->id;
                $sub->subscribed = $other->id;
 
+               $sub->find(true);
+
+               // note we checked for existence above
+               
                if (!$sub->delete()) {
                        common_server_error(_t('Couldn\'t delete subscription.'));
                        return;
                }
 
-               common_redirect(common_local_url('all', array('nickname' =>
-                                                                                                         $user->nickname)));
+               common_redirect(common_local_url('subscriptions', array('nickname' =>
+                                                                                                                               $user->nickname)));
        }
 }