public function watch($id)
{
$topic = Topic::findOrFail($id);
$state = get_bool(Request::input('watch'));
$privName = 'ForumTopicWatch' . ($state ? 'Add' : 'Remove');
$type = 'watch';
priv_check($privName, $topic)->ensureCan();
TopicWatch::toggle($topic, Auth::user(), $state);
switch (Request::input('page')) {
case 'manage':
$topics = Topic::watchedByUser(Auth::user())->get();
$topicReadStatus = TopicTrack::readStatus(Auth::user(), $topics);
// there's currently only destroy action from watch index
return js_view('forum.topic_watches.destroy', compact('topic', 'topics', 'topicReadStatus'));
default:
return js_view('forum.topics.replace_button', compact('topic', 'type', 'state'));
}
}