]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/newnotice.php
more twiddling
[quix0rs-gnu-social.git] / actions / newnotice.php
index bbfa3285d7f9178bf9905694ec4da342fab582d9..40a196a23642bbd14b1d59e4fbc3e0f5ff567983 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/* 
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1) }
 
 class NewnoticeAction extends Action {
        
@@ -9,15 +28,12 @@ class NewnoticeAction extends Action {
                if (!common_logged_in()) {
                        common_user_error(_t('Not logged in.'));
                } else if ($this->arg('METHOD') == 'POST') {
-                       if ($this->save_new_notice()) {
-                               # XXX: smarter redirects
-                               $user = common_current_user();
-                               assert(!is_null($user)); # see if... above
-                               # XXX: redirect to source
-                               # XXX: use Ajax instead of a redirect
-                               common_redirect(common_local_url('all',
-                                                                                                array('nickname' =>
-                                                                                                          $user->nickname)));
+                       $id = $this->save_new_notice();
+
+                       if ($id) {
+                               common_broadcast_notices($id);
+                               common_redirect(common_local_url('shownotice',
+                                                                                                array('notice' => $id)), 303);
                        } else {
                                common_server_error(_t('Problem saving notice.'));
                        }