Skip to content
Snippets Groups Projects
Commit 1fa3a191 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'master' of gitlab.c3sl.ufpr.br:portalmec/portalmec

parents 7a90003d 009a3019
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,9 @@ class CollectionsController < ApplicationController
@collection = nil if @collection == 'all'
@collections = current_user.associated_collections
@collections.select! { |c| c.id != @collection.id } unless @collection.blank?
@collections.select! do |c|
(!@collection.blank? && c.id != @collection.id) || !include_learning_objects?(c)
end
@type = params[:type]
unless @type.blank?
......@@ -138,7 +140,7 @@ class CollectionsController < ApplicationController
next unless collection.user_own?(current_user)
@learning_objects.each do |learning_object|
collection.learning_objects << learning_object
collection.learning_objects << learning_object unless collection.learning_objects.include? learning_object
end
collection.save
end
......@@ -171,6 +173,13 @@ class CollectionsController < ApplicationController
private
def include_learning_objects?(collection)
@learning_objects.each do |lo|
return true if collection.learning_objects.include? lo
end
false
end
def check_collection_privacy!(collection)
if collection.private? && !collection.user_own?(current_user)
redirect_to :root, notice: 'Está é uma coleção privada.'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment