mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
init project
This commit is contained in:
28
app/controllers/users/watches_controller.rb
Normal file
28
app/controllers/users/watches_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class Users::WatchesController < Users::BaseController
|
||||
before_action :require_login, :check_auth
|
||||
|
||||
def create
|
||||
if observed_logged_user?
|
||||
render_error('不能关注自己')
|
||||
return
|
||||
end
|
||||
|
||||
if current_user.watched?(observed_user)
|
||||
render_ok
|
||||
return
|
||||
end
|
||||
|
||||
current_user.watch!(observed_user)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
unless current_user.watched?(observed_user)
|
||||
render_ok
|
||||
return
|
||||
end
|
||||
|
||||
current_user.unwatch!(observed_user)
|
||||
render_ok
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user