Skip to content

Commit

Permalink
Merge branch 'recent'
Browse files Browse the repository at this point in the history
  • Loading branch information
ethn committed Sep 14, 2016
2 parents ea02a1a + c9f1603 commit 0f13328
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion card/lib/card/format/error.rb
Expand Up @@ -9,7 +9,7 @@ def rescue_view e, view
end

def debug_error e, view
Rails.logger.info "\nError rendering #{error_cardname} / #{view}: "\
Rails.logger.info "#{rendering_error e, view}:\n" \
"#{e.class} : #{e.message}"
debug = Card[:debugger]
raise e if debug && debug.content == "on"
Expand Down
4 changes: 2 additions & 2 deletions card/mod/admin/set/self/admin.rb
Expand Up @@ -51,11 +51,11 @@ def cache_stats
stats = [
{ title: "solid cache",
count: solid_cache_count, unit: " cards",
link_text: "clear cache",
link_text: "clear solid cache",
task: "clear_solid_cache" },
{ title: "machine cache",
count: machine_cache_count, unit: " cards",
link_text: "clear cache",
link_text: "clear machine cache",
task: "clear_machine_cache" }
]
return stats unless Card.config.view_cache
Expand Down
15 changes: 8 additions & 7 deletions card/mod/history/lib/card/act.rb
Expand Up @@ -53,16 +53,17 @@ def find_all_with_actions_on card_ids, args={}
# all actions that current user has permission to view
# @return [Array of Actions]
def all_viewable
joins = "JOIN card_actions ON card_acts.id = card_act_id " \
"JOIN cards ON cards.id = card_actions.card_id"
where = [
"card_actions.id is not null", # data check. should not be needed
"cards.id is not null", # ditto
card_join = "JOIN cards ON cards.id = card_actions.card_id"
action_conditions = [
"card_acts.id = card_act_id",
"card_actions.card_id is not null",
"draft is not true",
Card::Query::SqlStatement.new.permission_conditions("cards")
Query::SqlStatement.new.permission_conditions("cards")
].compact.join " AND "

joins(joins).where(where).uniq
viewable_actions =
Action.joins(card_join).where(action_conditions).to_sql
where("card_id is not null AND EXISTS (#{viewable_actions})")
end
end

Expand Down
4 changes: 2 additions & 2 deletions card/mod/standard/set/self/recent.rb
Expand Up @@ -16,8 +16,8 @@
acts = Act.all_viewable.order(id: :desc).page(page).per(ACTS_PER_PAGE)
acts.map do |act|
if (act_card = act.card)
format = act_card.format :html
format.render_act args.merge(act: act, act_context: :absolute)
act_view_args = args.merge(act: act, act_context: :absolute)
act_card.format(:html).render_act act_view_args
else
Rails.logger.info "bad data, act: #{act}"
""
Expand Down

0 comments on commit 0f13328

Please sign in to comment.