1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

[bug] projects drafts are shown on public profiles

This commit is contained in:
Sylvain 2016-06-01 10:38:42 +02:00
parent 70ff027792
commit 31356a02f5

View File

@ -1,3 +1,5 @@
requested_current = (current_user and current_user.id == @member.id)
json.extract! @member, :id, :username, :email, :group_id, :slug, :invoicing_disabled, :is_allow_contact
json.role @member.roles.first.name
json.name @member.profile.full_name
@ -62,33 +64,35 @@ json.machine_credits @member.machine_credits do |mc|
end
json.last_sign_in_at @member.last_sign_in_at.iso8601 if @member.last_sign_in_at
json.all_projects @member.all_projects do |project|
json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug
json.url project_url(project, format: :json)
json.project_image project.project_image.attachment.large.url if project.project_image
json.machine_ids project.machine_ids
json.machines project.machines do |m|
json.id m.id
json.name m.name
end
json.author_id project.author_id
json.user_ids project.user_ids
json.component_ids project.component_ids
json.components project.components do |c|
json.id c.id
json.name c.name
end
json.project_users project.project_users do |pu|
json.id pu.user.id
json.first_name pu.user.profile.first_name
json.last_name pu.user.profile.last_name
json.full_name pu.user.profile.full_name
json.user_avatar do
json.id pu.user.profile.user_avatar.id
json.attachment_url pu.user.profile.user_avatar.attachment_url
end if pu.user.profile.user_avatar
json.username pu.user.username
json.is_valid pu.is_valid
json.valid_token pu.valid_token if !pu.is_valid and @member == pu.user
if requested_current || project.state == 'published'
json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug
json.url project_url(project, format: :json)
json.project_image project.project_image.attachment.large.url if project.project_image
json.machine_ids project.machine_ids
json.machines project.machines do |m|
json.id m.id
json.name m.name
end
json.author_id project.author_id
json.user_ids project.user_ids
json.component_ids project.component_ids
json.components project.components do |c|
json.id c.id
json.name c.name
end
json.project_users project.project_users do |pu|
json.id pu.user.id
json.first_name pu.user.profile.first_name
json.last_name pu.user.profile.last_name
json.full_name pu.user.profile.full_name
json.user_avatar do
json.id pu.user.profile.user_avatar.id
json.attachment_url pu.user.profile.user_avatar.attachment_url
end if pu.user.profile.user_avatar
json.username pu.user.username
json.is_valid pu.is_valid
json.valid_token pu.valid_token if !pu.is_valid and @member == pu.user
end
end
end
json.events_reservations @member.reservations.where(reservable_type: 'Event').joins(:slots).order('slots.start_at asc') do |r|