diff --git a/app/serializers/collection_serializer.rb b/app/serializers/collection_serializer.rb index 8ab0f80edb6d089a03d4cbf6aac4041ac7336cdd..94f6bf6ce48c750ca922f5861f90359671b4ff15 100644 --- a/app/serializers/collection_serializer.rb +++ b/app/serializers/collection_serializer.rb @@ -28,7 +28,7 @@ class CollectionSerializer < ActiveModel::Serializer thumbs end - attributes :id, :name, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :liked, :reviewed, :complained, :review_average, :thumbnail, :items_thumbnails + attributes :id, :name, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :liked, :followed, :reviewed, :complained, :review_average, :thumbnail, :items_thumbnails belongs_to :owner has_many :tags diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 4fa94f9131c6935872331ea7a582c4f83bf7a4f4..088bb773648fdb2cd2d6b14c336fa8b3b529784c 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -1,9 +1,13 @@ class UserSerializer < ActiveModel::Serializer - cache key: 'user', expires_in: 4.hours, except: [ :complained ] + cache key: 'user', expires_in: 4.hours, except: [ :complained, :followed ] def complained object.complained? current_user end - attributes :id, :email, :provider, :name, :description, :role_ids, :institution_ids, :avatar, :likes_count, :complained, :follows_count, :learning_objects_count, :collections_count, :created_at, :updated_at + def followed + object.followed? current_user + end + + attributes :id, :email, :provider, :name, :description, :role_ids, :institution_ids, :avatar, :likes_count, :followed, :complained, :follows_count, :learning_objects_count, :collections_count, :created_at, :updated_at end diff --git a/app/services/learning_object_publisher.rb b/app/services/learning_object_publisher.rb index d302bf29b0b9f3c9b4d366d433f94c3ccaca8c82..a2ba1089ea51d7e405dafa32e0330e21e0727aa9 100644 --- a/app/services/learning_object_publisher.rb +++ b/app/services/learning_object_publisher.rb @@ -29,6 +29,7 @@ class LearningObjectPublisher return true if learning_object.published? learning_object.state = LearningObject.states[:published] + learning_object.published_at = Time.now ThumbnailGenerateWorker.perform_async learning_object.id, learning_object.link if learning_object.link? learning_object.save end