关注接口限制不能关注自己
This commit is contained in:
parent
199ef4ebe6
commit
d01aa5f15c
|
@ -1,7 +1,12 @@
|
||||||
|
#coding=utf-8
|
||||||
class WatchesService
|
class WatchesService
|
||||||
def watch params
|
def watch params
|
||||||
@current_user = User.find(params[:current_user_id])
|
@current_user = User.find(params[:current_user_id])
|
||||||
|
if params[:object_type] == 'user' && params[:current_user_id] == params[:object_id]
|
||||||
|
raise '不能关注自己!'
|
||||||
|
end
|
||||||
@watchables = find_watchables params
|
@watchables = find_watchables params
|
||||||
|
|
||||||
if @watchables.nil?
|
if @watchables.nil?
|
||||||
raise '404'
|
raise '404'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue