User interface for watching first post

This commit is contained in:
Robin Ward
2016-07-05 15:16:32 -04:00
parent 323efcab71
commit 1eb64151f6
9 changed files with 91 additions and 41 deletions

View File

@ -29,8 +29,8 @@ class EmailController < ApplicationController
@watched_count = nil
if @topic && @topic.category_id
if CategoryUser.exists?(user_id: @user.id,
notification_level: CategoryUser.notification_levels[:watching],
category_id: @topic.category_id)
notification_level: CategoryUser.watching_levels,
category_id: @topic.category_id)
@watched_count = TopicUser.joins(:topic)
.where(:user => @user,
:notification_level => TopicUser.notification_levels[:watching],
@ -74,7 +74,7 @@ class EmailController < ApplicationController
CategoryUser.where(user_id: user.id,
category_id: topic.category_id,
notification_level: CategoryUser.notification_levels[:watching]
notification_level: CategoryUser.watching_levels
)
.destroy_all
updated = true