mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
Add rubocop to our build. (#5004)
This commit is contained in:
@ -31,8 +31,8 @@ class EmailController < ApplicationController
|
||||
if @topic.category_id
|
||||
if CategoryUser.exists?(user_id: @user.id, notification_level: CategoryUser.watching_levels, category_id: @topic.category_id)
|
||||
@watched_count = TopicUser.joins(:topic)
|
||||
.where(user: @user, notification_level: watching, "topics.category_id" => @topic.category_id)
|
||||
.count
|
||||
.where(user: @user, notification_level: watching, "topics.category_id" => @topic.category_id)
|
||||
.count
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -52,28 +52,28 @@ class EmailController < ApplicationController
|
||||
if topic
|
||||
if params["unwatch_topic"]
|
||||
TopicUser.where(topic_id: topic.id, user_id: user.id)
|
||||
.update_all(notification_level: TopicUser.notification_levels[:tracking])
|
||||
.update_all(notification_level: TopicUser.notification_levels[:tracking])
|
||||
updated = true
|
||||
end
|
||||
|
||||
if params["unwatch_category"] && topic.category_id
|
||||
TopicUser.joins(:topic)
|
||||
.where(:user => user,
|
||||
:notification_level => TopicUser.notification_levels[:watching],
|
||||
"topics.category_id" => topic.category_id)
|
||||
.update_all(notification_level: TopicUser.notification_levels[:tracking])
|
||||
.where(:user => user,
|
||||
:notification_level => TopicUser.notification_levels[:watching],
|
||||
"topics.category_id" => topic.category_id)
|
||||
.update_all(notification_level: TopicUser.notification_levels[:tracking])
|
||||
|
||||
CategoryUser.where(user_id: user.id,
|
||||
category_id: topic.category_id,
|
||||
notification_level: CategoryUser.watching_levels
|
||||
category_id: topic.category_id,
|
||||
notification_level: CategoryUser.watching_levels
|
||||
)
|
||||
.destroy_all
|
||||
.destroy_all
|
||||
updated = true
|
||||
end
|
||||
|
||||
if params["mute_topic"]
|
||||
TopicUser.where(topic_id: topic.id, user_id: user.id)
|
||||
.update_all(notification_level: TopicUser.notification_levels[:muted])
|
||||
.update_all(notification_level: TopicUser.notification_levels[:muted])
|
||||
updated = true
|
||||
end
|
||||
end
|
||||
@ -90,9 +90,9 @@ class EmailController < ApplicationController
|
||||
|
||||
if params["unsubscribe_all"]
|
||||
user.user_option.update_columns(email_always: false,
|
||||
email_digests: false,
|
||||
email_direct: false,
|
||||
email_private_messages: false)
|
||||
email_digests: false,
|
||||
email_direct: false,
|
||||
email_private_messages: false)
|
||||
updated = true
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user