Permalink
Browse files

fixed renderer permissions optimization

  • Loading branch information...
1 parent 1294eb3 commit 7939f63c913a79846bc65a5c2c0a9db25d2f8da7 @ethn ethn committed Apr 2, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/wagn/renderer.rb
View
@@ -190,7 +190,7 @@ def initialize_subrenderer subcard, parent, mainline=false
@card = subcard
@char_count = 0
@depth += 1
- @main_content = @showname = @search = nil
+ @main_content = @showname = @search = @ok = nil
self
end
@@ -225,7 +225,7 @@ def ok_view view, args={}
# HANDLE UNKNOWN CARDS ~~~~~~~~~~~~
when !card.known? && !self.class.tagged( view, :unknown_ok )
if focal?
- if @format==:html && card.ok?(:create) ; :new
+ if @format==:html && card.ok?(:create) ; :new # this should use the @ok caching
else ; :not_found
end
else ; :missing
@@ -240,13 +240,13 @@ def ok_view view, args={}
args[:denied_task] = [perms_required].flatten.find do |task|
task = :create if task == :update && card.new_card?
@ok ||= {}
- @ok[task].nil? ? @ok[task] = !card.ok?(task) : @ok[task]
+ @ok[task] = card.ok? task if @ok[task].nil?
+ !@ok[task]
end
end
args[:denied_task] ? (@@denial_views[view] || :denial) : view
end
-
if view != original_view
args[:denied_view] = original_view
end

0 comments on commit 7939f63

Please sign in to comment.