mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
safety around empty content
This commit is contained in:
parent
8ce85f6eda
commit
b5612eddda
@ -93,7 +93,7 @@
|
||||
@universe_scope.send(pluralized_name).count
|
||||
else
|
||||
(
|
||||
@current_user_content[content_type] +
|
||||
@current_user_content[content_type] || [] +
|
||||
current_user.send("contributable_#{pluralized_name}") +
|
||||
(content_type_klass == Universe ? [] : content_type_klass.where(universe_id: current_user.universes.pluck(:id)))
|
||||
).uniq.count
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
if @universe_scope.present? && content_type != 'Universe'
|
||||
content_list = @universe_scope.send(pluralized_content_name)
|
||||
else
|
||||
content_list = @current_user_content[content_type] +
|
||||
content_list = @current_user_content[content_type] || [] +
|
||||
current_user.send("contributable_#{pluralized_content_name}")
|
||||
|
||||
# todo I don't think this is actually necessary anymore, but leaving around for a few days just in case
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<li><%= link_to "All universes", "?universe=all" %></li>
|
||||
<% if current_user %>
|
||||
<li class="divider"></li>
|
||||
<% (@current_user_content['Universe'] + current_user.contributable_universes).sort_by(&:name).each do |universe| %>
|
||||
<% ((@current_user_content['Universe'] || []) + current_user.contributable_universes).sort_by(&:name).each do |universe| %>
|
||||
<li><%= link_to universe.name + (universe.user_id == current_user.id ? '' : ' (contributor)'), "?universe=#{universe.id}" %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user