docbrown/app/controllers/article_mutes_controller.rb
Andy Zhao 9f6d00118f Mute notifications for your own article (#1594)
* Use a slightly faster call for user_id

* Remove unused file

* Test receive notifications functionality

* Notify when receive_notifications is true

* Test receiving reaction notifications

* Do not notify if receive_notifications is false

* Fix test for parent comment notification

* Add article mute notifications feature

* Remove deprecated specs

* Prevent email when receive_notification is false

* Update button messaging

* Use RESTful /article_mutes patch request

* Use parent or root article instead
2019-01-22 13:12:48 -05:00

10 lines
313 B
Ruby

class ArticleMutesController < ApplicationController
after_action :verify_authorized
def update
@article = Article.find_by(id: params[:id], user_id: current_user.id)
authorize @article
@article.update(receive_notifications: !@article.receive_notifications)
redirect_to "/dashboard"
end
end