diff --git a/app/controllers/forum_posts_controller.rb b/app/controllers/forum_posts_controller.rb index ba0e20af3..ac186993c 100644 --- a/app/controllers/forum_posts_controller.rb +++ b/app/controllers/forum_posts_controller.rb @@ -58,7 +58,7 @@ class ForumPostsController < ApplicationController @forum_post.update_attribute(:is_deleted, false) respond_with(@forum_post) end - + private def check_privilege(forum_post) if !forum_post.editable_by?(CurrentUser.user) diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index 2bfe1090e..01ea84765 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -55,6 +55,11 @@ class ForumTopicsController < ApplicationController respond_with(@forum_topic) end + def mark_all_as_read + CurrentUser.user.update_attribute(:last_forum_read_at, Time.now) + redirect_to forum_topics_path, :notice => "All topics marked as read" + end + private def update_last_forum_read_at return if CurrentUser.is_anonymous? diff --git a/app/views/forum_topics/_secondary_links.html.erb b/app/views/forum_topics/_secondary_links.html.erb index 636c1329a..bd5c52087 100644 --- a/app/views/forum_topics/_secondary_links.html.erb +++ b/app/views/forum_topics/_secondary_links.html.erb @@ -3,6 +3,7 @@
  • <%= link_to "Listing", forum_topics_path %>
  • <%= link_to "New", new_forum_topic_path %>
  • <%= link_to "Search", search_forum_posts_path %>
  • +
  • <%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %>
  • <%= link_to "Help", wiki_pages_path(:title => "help:forum") %>
  • <% if @forum_topic %>
  • |
  • diff --git a/config/routes.rb b/config/routes.rb index 53ae16002..2fc2d2559 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,6 +91,9 @@ Danbooru::Application.routes.draw do member do post :undelete end + collection do + post :mark_all_as_read + end end resources :ip_bans resources :janitor_trials do