the browser-facing portion of osu!

Update forum auto notification to include replies

nanaya cefe2fce 9586cde7

+23 -11
+19 -8
app/Http/Controllers/Forum/TopicsController.php
··· 252 253 priv_check('ForumTopicReply', $topic)->ensureCan(); 254 255 - $post = Post::createNew($topic, auth()->user(), get_string(request('body'))); 256 257 - $post->markRead(Auth::user()); 258 - (new ForumTopicReply($post, auth()->user()))->dispatch(); 259 260 if (is_api_request()) { 261 return json_item($post, 'Forum\Post', ['body']); 262 } else { 263 - return ext_view('forum.topics._posts', [ 264 - 'firstPostPosition' => $topic->postPosition($post->post_id), 265 - 'posts' => collect([$post]), 266 - 'topic' => $topic, 267 - ]); 268 } 269 } 270
··· 252 253 priv_check('ForumTopicReply', $topic)->ensureCan(); 254 255 + $user = \Auth::user(); 256 + $post = Post::createNew($topic, $user, get_string(request('body'))); 257 258 + $post->markRead($user); 259 + (new ForumTopicReply($post, $user))->dispatch(); 260 + 261 + $watch = $user->user_notify 262 + ? TopicWatch::setState($topic, $user, 'watching_mail') 263 + : TopicWatch::lookup($topic, $user); 264 265 if (is_api_request()) { 266 return json_item($post, 'Forum\Post', ['body']); 267 } else { 268 + return [ 269 + 'posts' => view('forum.topics._posts', [ 270 + 'firstPostPosition' => $topic->postPosition($post->post_id), 271 + 'posts' => collect([$post]), 272 + 'topic' => $topic, 273 + ])->render(), 274 + 'watch' => view('forum.topics._watch', [ 275 + 'state' => $watch, 276 + 'topic' => $topic, 277 + ])->render(), 278 + ]; 279 } 280 } 281
+3 -2
resources/js/core-legacy/forum-topic-reply.coffee
··· 102 input.value = '' 103 @bbcodePreview.hidePreview(target: input) 104 105 - $newPost = $(data) 106 107 needReload = (@forum.postPosition($newPost[0]) - 1) != @forum.postPosition(@forum.endPost()) || 108 e.target.dataset.forceReload == '1' ··· 110 if needReload 111 navigate $newPost.find('.js-post-url').attr('href') 112 else 113 @forum.setTotalPosts(@forum.totalPosts() + 1) 114 - @forum.endPost().insertAdjacentHTML 'afterend', data 115 116 @forum.endPost().scrollIntoView() 117
··· 102 input.value = '' 103 @bbcodePreview.hidePreview(target: input) 104 105 + $newPost = $(data.posts) 106 107 needReload = (@forum.postPosition($newPost[0]) - 1) != @forum.postPosition(@forum.endPost()) || 108 e.target.dataset.forceReload == '1' ··· 110 if needReload 111 navigate $newPost.find('.js-post-url').attr('href') 112 else 113 + $('.js-forum-topic-watch').replaceWith(data.watch) 114 @forum.setTotalPosts(@forum.totalPosts() + 1) 115 + @forum.endPost().insertAdjacentHTML 'afterend', data.posts 116 117 @forum.endPost().scrollIntoView() 118
+1 -1
resources/lang/en/accounts.php
··· 81 'beatmapset_disqualify' => 'receive notifications for when beatmaps of the following modes are disqualified', 82 'comment_reply' => 'receive notifications for replies to your comments', 83 'title' => 'Notifications', 84 - 'topic_auto_subscribe' => 'automatically enable notifications on new forum topics that you create', 85 86 'options' => [ 87 '_' => 'delivery options',
··· 81 'beatmapset_disqualify' => 'receive notifications for when beatmaps of the following modes are disqualified', 82 'comment_reply' => 'receive notifications for replies to your comments', 83 'title' => 'Notifications', 84 + 'topic_auto_subscribe' => 'automatically enable notifications on new forum topics that you create or replied to', 85 86 'options' => [ 87 '_' => 'delivery options',