From 0cf2e4a48162c2a251d6d4b37d084b4eef7f0e36 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Tue, 31 Dec 2013 10:20:27 -0500 Subject: [PATCH] Changed ApplicationController#notice I realized that the notice cookie was being sent right when calling the notice method, while in Moebooru the cookie is actually sent on the next request. --- app/controllers/ApplicationController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/ApplicationController.php b/app/controllers/ApplicationController.php index 52bd94e..a4f282a 100755 --- a/app/controllers/ApplicationController.php +++ b/app/controllers/ApplicationController.php @@ -280,8 +280,9 @@ class ApplicationController extends Rails\ActionController\Base protected function init_cookies() { - if ($this->request()->format() == "xml" || $this->request()->format() == "json") + if ($this->request()->format() == "xml" || $this->request()->format() == "json") { return; + } $forum_posts = ForumPost::where("parent_id IS NULL")->order("updated_at DESC")->limit(10)->take(); $this->cookies()->current_forum_posts = json_encode(array_map(function($fp) { @@ -330,6 +331,11 @@ class ApplicationController extends Rails\ActionController\Base $this->cookies()->delete('login'); $this->cookies()->blacklisted_tags = json_encode(CONFIG()->default_blacklists); } + + if ($this->session()->notice) { + $this->cookies()->notice = $this->session()->notice; + $this->session()->delete('notice'); + } } protected function set_title($title = null) @@ -343,7 +349,7 @@ class ApplicationController extends Rails\ActionController\Base protected function notice($str) { - $this->cookies()->notice = $str; + $this->session()->notice = $str; } protected function set_locale()