aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-13 09:16:48 -0700
committerLouise Crow <louise.crow@gmail.com>2013-03-13 09:16:48 -0700
commitd5045bf83cff620545b93c185e411216f814ffdd (patch)
tree04f9a953cbfcdeba9c3d1affd6cd40dc6b61dd33 /lib
parentbf6fc976fb29adbc8d46336d3d010c99effcaef0 (diff)
parent20ec9b49f3407223b7cbcb25a636ba44a4b6967c (diff)
Merge remote-tracking branch 'openaustralia_github/one_support_email_on_admin_attention_state' into develop
Conflicts: Gemfile.lock app/controllers/request_controller.rb app/models/request_mailer.rb app/views/admin_general/index.rhtml spec/models/request_mailer_spec.rb
Diffstat (limited to 'lib')
-rw-r--r--lib/ability.rb5
-rw-r--r--lib/cookie_store_with_line_break_fix.rb19
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/ability.rb b/lib/ability.rb
new file mode 100644
index 000000000..2865ccb1c
--- /dev/null
+++ b/lib/ability.rb
@@ -0,0 +1,5 @@
+module Ability
+ def self.can_update_request_state?(user, request)
+ (user && request.is_old_unclassified?) || request.is_owning_user?(user)
+ end
+end \ No newline at end of file
diff --git a/lib/cookie_store_with_line_break_fix.rb b/lib/cookie_store_with_line_break_fix.rb
new file mode 100644
index 000000000..dc623fbd0
--- /dev/null
+++ b/lib/cookie_store_with_line_break_fix.rb
@@ -0,0 +1,19 @@
+# See https://makandracards.com/makandra/9443-rails-2-s-cookiestore-produces-invalid-cookie-data-causing-tests-to-break
+
+# Should be able to remove this when we upgrade to Rails 3
+
+module ActionController
+ module Session
+ CookieStore.class_eval do
+
+ def call_with_line_break_fix(*args)
+ status, headers, body = call_without_line_break_fix(*args)
+ headers['Set-Cookie'].gsub! "\n\n", "\n" if headers['Set-Cookie'].present?
+ [ status, headers, body ]
+ end
+
+ alias_method_chain :call, :line_break_fix
+
+ end
+ end
+end \ No newline at end of file