@@ -41,21 +41,20 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
41
41
with { :ok , category } <- FavoriteCategory |> ORM . find_by ( ~m( id user_id) a ) do
42
42
Multi . new ( )
43
43
|> Multi . run ( :downgrade_achievement , fn _ , _ ->
44
- # find user favvoried-contents(posts & jobs & videos ) 's author,
44
+ # find user favvoried-contents(posts & jobs) 's author,
45
45
# and downgrade their's acieveents
46
46
# NOTE: this is too fucking violent and should be refactor later
47
- # we find favroted posts/jobs/videos author_ids then doengrade their achievement
47
+ # we find favroted posts/jobs author_ids then doengrade their achievement
48
48
# this implentment is limited, if the user have lots contents in a favoreted-category
49
49
# ant those contents have diffenert author each, it may be fucked
50
50
# should be in a queue job or sth
51
51
{ :ok , post_author_ids } = affected_author_ids ( :post , CMS.PostFavorite , category )
52
52
{ :ok , job_author_ids } = affected_author_ids ( :job , CMS.JobFavorite , category )
53
- { :ok , video_author_ids } = affected_author_ids ( :video , CMS.VideoFavorite , category )
54
53
{ :ok , repo_author_ids } = affected_author_ids ( :repo , CMS.RepoFavorite , category )
55
54
56
55
# author_ids_list = count_words(total_author_ids) |> Map.to_list
57
56
author_ids_list =
58
- ( post_author_ids ++ job_author_ids ++ video_author_ids ++ repo_author_ids )
57
+ ( post_author_ids ++ job_author_ids ++ repo_author_ids )
59
58
|> count_words
60
59
|> Map . to_list ( )
61
60
@@ -76,7 +75,7 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
76
75
end
77
76
78
77
# NOTE: this is too fucking violent and should be refactor later
79
- # we find favroted posts/jobs/videos author_ids then doengrade their achievement
78
+ # we find favroted posts/jobs author_ids then doengrade their achievement
80
79
# this implentment is limited, if the user have lots contents in a favoreted-category
81
80
# ant those contents have diffenert author each, it may be fucked
82
81
defp affected_author_ids ( thread , queryable , category ) do
@@ -136,7 +135,7 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
136
135
end
137
136
138
137
@ doc """
139
- set category for favorited content (post, job, video ...)
138
+ set category for favorited content (post, job ...)
140
139
"""
141
140
def set_favorites ( % User { } = user , thread , content_id , category_id ) do
142
141
with { :ok , favorite_category } <-
@@ -238,9 +237,6 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
238
237
defp find_content_favorite ( :job , content_id , user_id ) ,
239
238
do: JobFavorite |> ORM . find_by ( % { job_id: content_id , user_id: user_id } )
240
239
241
- defp find_content_favorite ( :video , content_id , user_id ) ,
242
- do: VideoFavorite |> ORM . find_by ( % { video_id: content_id , user_id: user_id } )
243
-
244
240
defp find_content_favorite ( :repo , content_id , user_id ) ,
245
241
do: RepoFavorite |> ORM . find_by ( % { repo_id: content_id , user_id: user_id } )
246
242