diff --git a/app/authorizers/document_authorizer.rb b/app/authorizers/document_authorizer.rb index 79cc9dfd..f0a10aa6 100644 --- a/app/authorizers/document_authorizer.rb +++ b/app/authorizers/document_authorizer.rb @@ -6,7 +6,8 @@ class DocumentAuthorizer < ApplicationAuthorizer def readable_by?(user) [ resource.user_id == user.id, - resource.privacy == 'public' + resource.privacy == 'public', + resource.universe.present? && resource.universe.privacy == 'public' ].any? end diff --git a/app/views/content/_share.html.erb b/app/views/content/_share.html.erb index c45c020d..51276c63 100644 --- a/app/views/content/_share.html.erb +++ b/app/views/content/_share.html.erb @@ -44,9 +44,21 @@
Page-specific sharing
- <%= + <%= + # Big oof here. + content_obj = if shared_content.is_a?(Document) + { + id: shared_content.id, + name: shared_content.title, + page_type: 'Document', + privacy: shared_content.privacy + } + else + shared_content.attributes.slice('id', 'name', 'page_type', 'privacy') + end + react_component("PrivacyToggle", { - content: shared_content.attributes.slice('id', 'name', 'page_type', 'privacy'), + content: content_obj, content_icon: shared_content.class.icon, content_color: shared_content.class.color, submit_path: polymorphic_path(shared_content), diff --git a/app/views/content/display/_contributors.html.erb b/app/views/content/display/_contributors.html.erb index d3da8deb..3f74be6e 100644 --- a/app/views/content/display/_contributors.html.erb +++ b/app/views/content/display/_contributors.html.erb @@ -1,9 +1,13 @@ <%# Usage: render partial: 'content/display/contributors', locals: { content: content } %> -<% if content.contributors.any? %> +<% + raw_model = content.is_a?(Universe) ? content : content.raw_model +%> + +<% if raw_model.contributors.any? %>
    - <% content.contributors.each do |contributor| %> + <% raw_model.contributors.each do |contributor| %> <% next if contributor.user.nil? && (current_user != content.user) %>
  • person @@ -27,6 +31,6 @@ <% end %>
- <%= render partial: 'content/form/contributors/leave', locals: { content: content } %> + <%= render partial: 'content/form/contributors/leave', locals: { content: raw_model } %>
<% end %> \ No newline at end of file