Merge pull request #622 from indentlabs/mar-3-fixes

Mar 3 fixes
This commit is contained in:
Andrew Brown 2020-03-04 00:18:34 -06:00 committed by GitHub
commit ce31c476c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View File

@ -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

View File

@ -44,9 +44,21 @@
<div class="hoverable card <%= shared_content.class.color %> lighten-4">
<div class="card-content">
<div class="card-title">Page-specific sharing</div>
<%=
<%=
# 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),

View File

@ -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? %>
<div id="contributors_panel" class="row panel">
<ul class="collection">
<% content.contributors.each do |contributor| %>
<% raw_model.contributors.each do |contributor| %>
<% next if contributor.user.nil? && (current_user != content.user) %>
<li class="collection-item avatar">
<i class="material-icons circle white-text">person</i>
@ -27,6 +31,6 @@
<% end %>
</ul>
<%= render partial: 'content/form/contributors/leave', locals: { content: content } %>
<%= render partial: 'content/form/contributors/leave', locals: { content: raw_model } %>
</div>
<% end %>