Skip to content
Snippets Groups Projects
Commit 2902abf3 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Fixed activities recipient

parent a4ea0e6a
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ class V1::ActivitiesController < ApplicationController
# Render all activities that logged user can see
def index
authorize :activity, :index?
activities = paginate ::ActivityPolicy::Scope.new(current_user, ::PublicActivity::Activity).resolve
activities = paginate current_user.activities
render json: activities
end
......
......@@ -21,8 +21,6 @@ class Bookmark < ApplicationRecord
validates_presence_of :user, :bookmarkable
validates :user_id, uniqueness: { scope: [:bookmarkable_id, :bookmarkable_type] }
private
def recipient
bookmarkable
end
......
......@@ -21,8 +21,6 @@ class CollectionItem < ApplicationRecord
validates :collection, :collectionable, presence: true
validates :order, uniqueness: true, allow_blank: true
private
def recipient
collection
end
......
......@@ -30,8 +30,6 @@ class Complaint < ApplicationRecord
complaint_reason.reason
end
private
def recipient
complainable
end
......
......@@ -19,8 +19,6 @@ class Download < ApplicationRecord
validates_presence_of :user, :downloadable
private
def recipient
downloadable
end
......
......@@ -20,8 +20,6 @@ class Follow < ApplicationRecord
validates_presence_of :user, :followable
validates :user_id, uniqueness: { scope: [:followable_id, :followable_type] }
private
def recipient
followable
end
......
......@@ -21,8 +21,6 @@ class Like < ApplicationRecord
validates_presence_of :user, :likeable
validates :user_id, uniqueness: { scope: [:likeable_id, :likeable_type] }
private
def recipient
likeable
end
......
......@@ -20,13 +20,14 @@ class Rate < ApplicationRecord
validates_uniqueness_of :user, scope: :review
validate :cannot_rate_your_own, on: :create
def recipient
review
end
private
def cannot_rate_your_own
errors.add(:user_id, "cannot rate your own review") if review.user == user
end
def recipient
review
end
end
......@@ -61,8 +61,6 @@ class Review < ApplicationRecord
nil
end
private
def recipient
reviewable
end
......
......@@ -18,9 +18,7 @@ class Share < ApplicationRecord
belongs_to :user
validates_presence_of :user, :shareable
private
def recipient
shareable
end
......
......@@ -8,8 +8,6 @@ class Tagging < ApplicationRecord
validates_presence_of :tagger, :tag, :taggable
private
def recipient
taggable
end
......
......@@ -23,6 +23,10 @@ class View < ApplicationRecord
scope :created_last, ->(user) { where(user: user).order('created_at DESC').limit(1) }
def recipient
viewable
end
private
def current_time_greater_than_last
......@@ -35,7 +39,4 @@ class View < ApplicationRecord
true
end
def recipient
viewable
end
end
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