From 1d9596d7f2f1e7f90a4ca122ee12d06697f5b5e9 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 25 Jun 2015 13:51:05 -0700 Subject: [PATCH] fixes #2417 --- app/controllers/application_controller.rb | 4 + app/controllers/forum_topics_controller.rb | 2 +- app/controllers/ip_bans_controller.rb | 2 +- .../moderator/dashboards_controller.rb | 2 +- .../moderator/ip_addrs_controller.rb | 2 +- .../moderator/post/approvals_controller.rb | 2 +- .../moderator/post/disapprovals_controller.rb | 2 +- .../moderator/post/posts_controller.rb | 2 +- .../moderator/post/queues_controller.rb | 2 +- app/controllers/pools_controller.rb | 2 +- .../tag_alias_corrections_controller.rb | 2 +- app/controllers/wiki_pages_controller.rb | 2 +- app/helpers/post_flags_helper.rb | 2 +- app/logical/anonymous_user.rb | 4 + app/models/artist.rb | 6 +- app/models/bulk_update_request.rb | 2 +- app/models/comment.rb | 2 +- app/models/forum_post.rb | 4 +- app/models/forum_topic.rb | 2 +- app/models/janitor_trial.rb | 13 ++- app/models/pool.rb | 2 +- app/models/post_flag.rb | 6 +- app/models/tag.rb | 2 +- app/models/tag_alias.rb | 2 +- app/models/tag_implication.rb | 2 +- app/models/user.rb | 3 +- app/models/wiki_page.rb | 12 +-- app/models/wiki_page_version.rb | 2 +- .../artist_commentary_versions/index.html.erb | 4 +- app/views/artist_versions/index.html.erb | 4 +- app/views/forum_posts/_forum_post.html.erb | 4 +- app/views/forum_posts/index.html.erb | 2 +- app/views/forum_topics/_form.html.erb | 2 +- .../forum_topics/_secondary_links.html.erb | 2 +- app/views/forum_topics/show.html.erb | 2 +- app/views/layouts/_main_links.html.erb | 6 +- app/views/meta_searches/tags.html.erb | 2 +- app/views/note_versions/index.html.erb | 4 +- app/views/pool_versions/index.html.erb | 4 +- app/views/post_flags/_search.html.erb | 2 +- app/views/post_flags/index.html.erb | 4 +- app/views/post_versions/_listing.html.erb | 4 +- .../partials/common/_secondary_links.html.erb | 4 +- .../posts/partials/index/_mode_menu.html.erb | 2 +- .../posts/partials/show/_notices.html.erb | 2 +- .../posts/partials/show/_options.html.erb | 2 +- app/views/static/site_map.html.erb | 4 +- app/views/tag_aliases/_listing.html.erb | 2 +- app/views/tags/edit.html.erb | 2 +- app/views/users/_statistics.html.erb | 6 +- app/views/users/index.html.erb | 4 +- app/views/wiki_page_versions/index.html.erb | 4 +- app/views/wiki_pages/_form.html.erb | 2 +- .../wiki_pages/_secondary_links.html.erb | 2 +- ...35905_remove_not_null_on_janitor_trials.rb | 5 ++ db/structure.sql | 83 +++++++++++++++++-- .../033_enable_can_approve_posts_flag.rb | 13 +++ .../user_upgrades_controller_test.rb | 48 ++++++----- test/factories/user.rb | 3 + .../janitor_trials_controller_test.rb | 4 +- test/functional/posts_controller_test.rb | 26 +++--- test/unit/janitor_trial_test.rb | 10 ++- test/unit/tag_test.rb | 4 +- test/unit/wiki_page_test.rb | 14 ++-- 64 files changed, 244 insertions(+), 140 deletions(-) create mode 100644 db/migrate/20150629235905_remove_not_null_on_janitor_trials.rb create mode 100644 script/fixes/033_enable_can_approve_posts_flag.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9ae7bc67d..f40e0c1e1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -145,4 +145,8 @@ protected Rails.application.config.session_store :cookie_store, :key => '_danbooru_session', :secure => false end end + + def post_approvers_only + CurrentUser.can_approve_posts? + end end diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index 5785b69ce..2caae332d 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -1,7 +1,7 @@ class ForumTopicsController < ApplicationController respond_to :html, :xml, :json before_filter :member_only, :except => [:index, :show] - before_filter :janitor_only, :only => [:new_merge, :create_merge] + before_filter :moderator_only, :only => [:new_merge, :create_merge] before_filter :normalize_search, :only => :index def new diff --git a/app/controllers/ip_bans_controller.rb b/app/controllers/ip_bans_controller.rb index e28b006c3..114a1d7e0 100644 --- a/app/controllers/ip_bans_controller.rb +++ b/app/controllers/ip_bans_controller.rb @@ -1,5 +1,5 @@ class IpBansController < ApplicationController - before_filter :janitor_only + before_filter :moderator_only def new @ip_ban = IpBan.new diff --git a/app/controllers/moderator/dashboards_controller.rb b/app/controllers/moderator/dashboards_controller.rb index f309de217..2afb8c83b 100644 --- a/app/controllers/moderator/dashboards_controller.rb +++ b/app/controllers/moderator/dashboards_controller.rb @@ -1,6 +1,6 @@ module Moderator class DashboardsController < ApplicationController - before_filter :janitor_only + before_filter :moderator_only helper :post_flags, :post_appeals def show diff --git a/app/controllers/moderator/ip_addrs_controller.rb b/app/controllers/moderator/ip_addrs_controller.rb index 4f923742f..979873fde 100644 --- a/app/controllers/moderator/ip_addrs_controller.rb +++ b/app/controllers/moderator/ip_addrs_controller.rb @@ -1,6 +1,6 @@ module Moderator class IpAddrsController < ApplicationController - before_filter :janitor_only + before_filter :moderator_only def index @search = IpAddrSearch.new(params[:search]) diff --git a/app/controllers/moderator/post/approvals_controller.rb b/app/controllers/moderator/post/approvals_controller.rb index eeaa6c91f..768cbf200 100644 --- a/app/controllers/moderator/post/approvals_controller.rb +++ b/app/controllers/moderator/post/approvals_controller.rb @@ -1,7 +1,7 @@ module Moderator module Post class ApprovalsController < ApplicationController - before_filter :janitor_only + before_filter :post_approvers_only def create @post = ::Post.find(params[:post_id]) diff --git a/app/controllers/moderator/post/disapprovals_controller.rb b/app/controllers/moderator/post/disapprovals_controller.rb index a7f86582f..cc23ad7d1 100644 --- a/app/controllers/moderator/post/disapprovals_controller.rb +++ b/app/controllers/moderator/post/disapprovals_controller.rb @@ -1,7 +1,7 @@ module Moderator module Post class DisapprovalsController < ApplicationController - before_filter :janitor_only + before_filter :post_approvers_only def create @post = ::Post.find(params[:post_id]) diff --git a/app/controllers/moderator/post/posts_controller.rb b/app/controllers/moderator/post/posts_controller.rb index e8367e564..c8a2e5382 100644 --- a/app/controllers/moderator/post/posts_controller.rb +++ b/app/controllers/moderator/post/posts_controller.rb @@ -1,7 +1,7 @@ module Moderator module Post class PostsController < ApplicationController - before_filter :janitor_only, :only => [:delete, :undelete, :ban, :unban, :confirm_delete, :confirm_ban] + before_filter :moderator_only, :only => [:delete, :undelete, :ban, :unban, :confirm_delete, :confirm_ban] before_filter :admin_only, :only => [:expunge] rescue_from ::PostFlag::Error, :with => :rescue_exception diff --git a/app/controllers/moderator/post/queues_controller.rb b/app/controllers/moderator/post/queues_controller.rb index 0456f570d..995a29341 100644 --- a/app/controllers/moderator/post/queues_controller.rb +++ b/app/controllers/moderator/post/queues_controller.rb @@ -2,7 +2,7 @@ module Moderator module Post class QueuesController < ApplicationController respond_to :html, :json - before_filter :janitor_only + before_filter :post_approvers_only def show ::Post.without_timeout do diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb index f5a782069..704ade631 100644 --- a/app/controllers/pools_controller.rb +++ b/app/controllers/pools_controller.rb @@ -1,7 +1,7 @@ class PoolsController < ApplicationController respond_to :html, :xml, :json, :js before_filter :member_only, :except => [:index, :show, :gallery] - before_filter :janitor_only, :only => [:destroy] + before_filter :moderator_only, :only => [:destroy] def new @pool = Pool.new diff --git a/app/controllers/tag_alias_corrections_controller.rb b/app/controllers/tag_alias_corrections_controller.rb index cdfa7d7fa..fdfb294c0 100644 --- a/app/controllers/tag_alias_corrections_controller.rb +++ b/app/controllers/tag_alias_corrections_controller.rb @@ -1,5 +1,5 @@ class TagAliasCorrectionsController < ApplicationController - before_filter :janitor_only + before_filter :builder_only def create @correction = TagAliasCorrection.new(params[:tag_alias_id]) diff --git a/app/controllers/wiki_pages_controller.rb b/app/controllers/wiki_pages_controller.rb index 1ea11ac60..894d1a98b 100644 --- a/app/controllers/wiki_pages_controller.rb +++ b/app/controllers/wiki_pages_controller.rb @@ -1,7 +1,7 @@ class WikiPagesController < ApplicationController respond_to :html, :xml, :json, :js before_filter :member_only, :except => [:index, :show, :show_or_new] - before_filter :janitor_only, :only => [:destroy] + before_filter :moderator_only, :only => [:destroy] before_filter :normalize_search_params, :only => [:index] rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception rescue_from ActiveRecord::RecordNotFound, :with => :rescue_exception diff --git a/app/helpers/post_flags_helper.rb b/app/helpers/post_flags_helper.rb index 8c9fbe3a4..f487b0de1 100644 --- a/app/helpers/post_flags_helper.rb +++ b/app/helpers/post_flags_helper.rb @@ -7,7 +7,7 @@ module PostFlagsHelper html << '
  • ' html << DText.parse_inline(flag.reason).html_safe - if CurrentUser.is_janitor? + if CurrentUser.is_moderator? html << ' - ' + link_to_user(flag.creator) end diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index 91f1d6260..8d44c5ec0 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -108,6 +108,10 @@ class AnonymousUser false end + def can_approve_posts? + false + end + def blacklisted_tags "" end diff --git a/app/models/artist.rb b/app/models/artist.rb index 9d8a69f1f..913323874 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -329,7 +329,7 @@ class Artist < ActiveRecord::Base end def other_names_match(string) - if string =~ /\*/ && CurrentUser.user.is_builder? + if string =~ /\*/ && CurrentUser.is_builder? where("other_names ILIKE ? ESCAPE E'\\\\'", string.to_escaped_for_sql_like) else where("other_names_index @@ to_tsquery('danbooru', E?)", Artist.normalize_name(string).to_escaped_for_tsquery) @@ -352,7 +352,7 @@ class Artist < ActiveRecord::Base def any_name_matches(name) stripped_name = normalize_name(name).to_escaped_for_sql_like - if name =~ /\*/ && CurrentUser.user.is_builder? + if name =~ /\*/ && CurrentUser.is_builder? where("(name LIKE ? ESCAPE E'\\\\' OR other_names LIKE ? ESCAPE E'\\\\')", stripped_name, stripped_name) else name_for_tsquery = normalize_name(name).to_escaped_for_tsquery @@ -479,6 +479,6 @@ class Artist < ActiveRecord::Base end def visible? - !is_banned? || CurrentUser.user.is_janitor? + !is_banned? || CurrentUser.is_moderator? end end diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index 3d68f4c2e..dbed01292 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -61,7 +61,7 @@ class BulkUpdateRequest < ActiveRecord::Base end def editable?(user) - user_id == user.id || user.is_janitor? + user_id == user.id || user.is_builder? end def create_forum_topic diff --git a/app/models/comment.rb b/app/models/comment.rb index f8cbc35ff..fae80c47a 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -165,7 +165,7 @@ class Comment < ActiveRecord::Base end def editable_by?(user) - creator_id == user.id || user.is_janitor? + creator_id == user.id || user.is_moderator? end def hidden_attributes diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index 2e57ec473..846f2a102 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -92,7 +92,7 @@ class ForumPost < ActiveRecord::Base end def validate_topic_is_unlocked - return if CurrentUser.user.is_janitor? + return if CurrentUser.user.is_moderator? return if topic.nil? if topic.is_locked? @@ -110,7 +110,7 @@ class ForumPost < ActiveRecord::Base end def editable_by?(user) - creator_id == user.id || user.is_janitor? + creator_id == user.id || user.is_moderator? end def update_topic_updated_at_on_create diff --git a/app/models/forum_topic.rb b/app/models/forum_topic.rb index c6f0a8b91..c6108cb3f 100644 --- a/app/models/forum_topic.rb +++ b/app/models/forum_topic.rb @@ -119,7 +119,7 @@ class ForumTopic < ActiveRecord::Base include SubscriptionMethods def editable_by?(user) - creator_id == user.id || user.is_janitor? + creator_id == user.id || user.is_moderator? end def initialize_is_deleted diff --git a/app/models/janitor_trial.rb b/app/models/janitor_trial.rb index 2b1927172..d9b3e022d 100644 --- a/app/models/janitor_trial.rb +++ b/app/models/janitor_trial.rb @@ -1,6 +1,5 @@ class JanitorTrial < ActiveRecord::Base belongs_to :user - before_create :initialize_original_level after_create :send_dmail after_create :promote_user validates_presence_of :user @@ -54,10 +53,6 @@ class JanitorTrial < ActiveRecord::Base self.creator_id = CurrentUser.id end - def initialize_original_level - self.original_level = user.level - end - def user_name user.try(:name) end @@ -67,13 +62,14 @@ class JanitorTrial < ActiveRecord::Base end def send_dmail - body = "You have been selected as a test janitor. You can now approve pending posts and have access to the moderation interface. You should reacquaint yourself with the [[howto:upload]] guide to make sure you understand the site rules.\n\nOver the next several weeks your approvals will be monitored. If the majority of them are not quality uploads you will fail the trial period and be demoted back to your original level. You will also receive a negative user record indicating you previously attempted and failed a test janitor trial.\n\nThere is a minimum quota of 1 approval a month to indicate that you are being active. Remember, the goal isn't to approve as much as possible. It's to filter out borderline-quality art.\n\nIf you have any questions please respond to this message." + body = "You have been selected as a test janitor. You can now approve pending posts and have access to the moderation interface. You should reacquaint yourself with the [[howto:upload]] guide to make sure you understand the site rules.\n\nOver the next several weeks your approvals will be monitored. If the majority of them are not quality uploads you will fail the trial period and lose your approval privileges. You will also receive a negative user record indicating you previously attempted and failed a test janitor trial.\n\nThere is a minimum quota of 1 approval a month to indicate that you are being active. Remember, the goal isn't to approve as much as possible. It's to filter out borderline-quality art.\n\nIf you have any questions please respond to this message." Dmail.create_split(:title => "Test Janitor Trial Period", :body => body, :to_id => user_id) end def promote_user - user.promote_to!(User::Levels::JANITOR, :skip_dmail => true) + user.can_approve_posts = true + user.save end def create_feedback @@ -88,8 +84,9 @@ class JanitorTrial < ActiveRecord::Base end def demote! + user.can_approve_posts = false + user.save update_attribute(:status, "inactive") - user.update_column(:level, original_level) self.create_feedback end diff --git a/app/models/pool.rb b/app/models/pool.rb index 6636b84b6..a9fde03bb 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -207,7 +207,7 @@ class Pool < ActiveRecord::Base end def deletable_by?(user) - user.is_janitor? + user.is_moderator? end def create_mod_action_for_delete diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 339b558ea..5a819d438 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -46,11 +46,11 @@ class PostFlag < ActiveRecord::Base q = q.reason_matches(params[:reason_matches]) end - if params[:creator_id].present? && (CurrentUser.user.is_janitor? || params[:creator_id].to_i == CurrentUser.user.id) + if params[:creator_id].present? && (CurrentUser.is_moderator? || params[:creator_id].to_i == CurrentUser.user.id) q = q.where("creator_id = ?", params[:creator_id].to_i) end - if params[:creator_name].present? && CurrentUser.user.is_janitor? + if params[:creator_name].present? && CurrentUser.is_moderator? q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_")) end @@ -84,7 +84,7 @@ class PostFlag < ActiveRecord::Base end def validate_creator_is_not_limited - if CurrentUser.is_janitor? + if CurrentUser.can_approve_posts? # do nothing elsif creator.created_at > 1.week.ago errors[:creator] << "cannot flag within the first week of sign up" diff --git a/app/models/tag.rb b/app/models/tag.rb index 7435c7498..78922e18a 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -2,7 +2,7 @@ class Tag < ActiveRecord::Base METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|favgroup|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv" SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm" attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin] - attr_accessible :is_locked, :as => [:moderator, :janitor, :admin] + attr_accessible :is_locked, :as => [:moderator, :admin] has_one :wiki_page, :foreign_key => "title", :primary_key => "name" module ApiMethods diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index f5f6e5bd7..64fa993df 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -224,7 +224,7 @@ class TagAlias < ActiveRecord::Base def deletable_by?(user) return true if user.is_admin? - return true if is_pending? && user.is_janitor? + return true if is_pending? && user.can_approve_posts? return true if is_pending? && user.id == creator_id return false end diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index 7acb79760..534b09763 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -207,7 +207,7 @@ class TagImplication < ActiveRecord::Base def deletable_by?(user) return true if user.is_admin? - return true if is_pending? && user.is_janitor? + return true if is_pending? && user.is_builder? return true if is_pending? && user.id == creator_id return false end diff --git a/app/models/user.rb b/app/models/user.rb index fcb9aacdf..5143e552a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -29,7 +29,8 @@ class User < ActiveRecord::Base :style_usernames => 0x0200, :enable_auto_complete => 0x0400, :show_deleted_children => 0x0800, - :has_saved_searches => 0x1000 + :has_saved_searches => 0x1000, + :can_approve_posts => 0x2000 } attr_accessor :password, :old_password diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index e25d9250a..b90d643f4 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -9,7 +9,7 @@ class WikiPage < ActiveRecord::Base belongs_to :updater, :class_name => "User" validates_uniqueness_of :title, :case_sensitive => false validates_presence_of :title - validate :validate_locker_is_janitor + validate :validate_locker_is_moderator validate :validate_not_locked attr_accessible :title, :body, :is_locked, :other_names has_one :tag, :foreign_key => "name", :primary_key => "title" @@ -112,15 +112,15 @@ class WikiPage < ActiveRecord::Base titled(title).select("title, id").first end - def validate_locker_is_janitor - if is_locked_changed? && !CurrentUser.is_janitor? - errors.add(:is_locked, "can be modified by janitors only") + def validate_locker_is_moderator + if is_locked_changed? && !CurrentUser.is_moderator? + errors.add(:is_locked, "can be modified by moderators only") return false end end def validate_not_locked - if is_locked? && !CurrentUser.is_janitor? + if is_locked? && !CurrentUser.is_moderator? errors.add(:is_locked, "and cannot be updated") return false end @@ -230,7 +230,7 @@ class WikiPage < ActiveRecord::Base end def visible? - artist.blank? || !artist.is_banned? || CurrentUser.user.is_janitor? + artist.blank? || !artist.is_banned? || CurrentUser.is_moderator? end def other_names_array diff --git a/app/models/wiki_page_version.rb b/app/models/wiki_page_version.rb index dbf269bce..14d35f9f8 100644 --- a/app/models/wiki_page_version.rb +++ b/app/models/wiki_page_version.rb @@ -40,7 +40,7 @@ class WikiPageVersion < ActiveRecord::Base end def visible? - artist.blank? || !artist.is_banned? || CurrentUser.user.is_janitor? + artist.blank? || !artist.is_banned? || CurrentUser.is_moderator? end def other_names_array diff --git a/app/views/artist_commentary_versions/index.html.erb b/app/views/artist_commentary_versions/index.html.erb index d53ed82d6..91e2c5124 100644 --- a/app/views/artist_commentary_versions/index.html.erb +++ b/app/views/artist_commentary_versions/index.html.erb @@ -8,7 +8,7 @@ Post Original Translated - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> IP Address <% end %> Edited By @@ -30,7 +30,7 @@

    <%= h(commentary_version.translated_title) %>

    <%= h(commentary_version.translated_description) %> - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> <%= commentary_version.updater_ip_addr %> diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb index 033ec3c6e..8de3a96c6 100644 --- a/app/views/artist_versions/index.html.erb +++ b/app/views/artist_versions/index.html.erb @@ -11,7 +11,7 @@ Group Updated Updated by - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> IP Address <% end %> Active @@ -31,7 +31,7 @@ <%= artist_version.group_name %> <%= compact_time artist_version.created_at %> <%= link_to_user artist_version.updater %> - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> <%= artist_version.updater_ip_addr %> diff --git a/app/views/forum_posts/_forum_post.html.erb b/app/views/forum_posts/_forum_post.html.erb index be51e7489..a190d0799 100644 --- a/app/views/forum_posts/_forum_post.html.erb +++ b/app/views/forum_posts/_forum_post.html.erb @@ -1,4 +1,4 @@ -<% if CurrentUser.is_janitor? || !forum_post.is_deleted? %> +<% if CurrentUser.is_moderator? || !forum_post.is_deleted? %>

    @@ -23,7 +23,7 @@ <% if CurrentUser.is_member? && @forum_topic %>
  • <%= link_to "Quote", new_forum_post_path(:post_id => forum_post.id), :method => :get, :remote => true %>
  • <% end %> - <% if CurrentUser.is_janitor? && !forum_post.is_original_post? %> + <% if CurrentUser.is_moderator? && !forum_post.is_original_post? %> <% if forum_post.is_deleted %>
  • <%= link_to "Undelete", undelete_forum_post_path(forum_post.id), :method => :post, :remote => true %>
  • <% else %> diff --git a/app/views/forum_posts/index.html.erb b/app/views/forum_posts/index.html.erb index 32644f531..e7e5d0237 100644 --- a/app/views/forum_posts/index.html.erb +++ b/app/views/forum_posts/index.html.erb @@ -11,7 +11,7 @@ <% @forum_posts.each do |forum_post| %> - <% if CurrentUser.is_janitor? || !forum_post.is_deleted? %> + <% if CurrentUser.is_moderator? || !forum_post.is_deleted? %> <%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %> diff --git a/app/views/forum_topics/_form.html.erb b/app/views/forum_topics/_form.html.erb index 1fec950e0..82199109a 100644 --- a/app/views/forum_topics/_form.html.erb +++ b/app/views/forum_topics/_form.html.erb @@ -17,7 +17,7 @@ <%= dtext_field "forum_post", "body", :input_name => "forum_topic[original_post_attributes][body]", :value => forum_topic.original_post.body, :input_id => "forum_post_body_for_#{forum_topic.original_post.id}", :preview_id => "dtext-preview-for-#{forum_topic.original_post.id}" %> <% end %> - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> <%= f.input :is_sticky %> <%= f.input :is_locked %> <% end %> diff --git a/app/views/forum_topics/_secondary_links.html.erb b/app/views/forum_topics/_secondary_links.html.erb index 7b5f92664..dda0bc718 100644 --- a/app/views/forum_topics/_secondary_links.html.erb +++ b/app/views/forum_topics/_secondary_links.html.erb @@ -20,7 +20,7 @@ <% end %> <% if !@forum_topic.new_record? && @forum_topic.editable_by?(CurrentUser.user) %>
  • <%= link_to "Edit", edit_forum_topic_path(@forum_topic) %>
  • - <% if CurrentUser.is_janitor? %> + <% if CurrentUser.is_moderator? %> <% if @forum_topic.is_deleted? %>
  • <%= link_to "Undelete", undelete_forum_topic_path(@forum_topic), :method => :post %>
  • <% else %> diff --git a/app/views/forum_topics/show.html.erb b/app/views/forum_topics/show.html.erb index db8136838..05a4bc02a 100644 --- a/app/views/forum_topics/show.html.erb +++ b/app/views/forum_topics/show.html.erb @@ -18,7 +18,7 @@ <%= render "forum_posts/listing", :forum_posts => @forum_posts %> <% if CurrentUser.is_member? %> - <% if CurrentUser.is_janitor? || !@forum_topic.is_locked? %> + <% if CurrentUser.is_moderator? || !@forum_topic.is_locked? %>

    <%= link_to "Reply »".html_safe, new_forum_post_path(:topic_id => @forum_topic.id), :id => "new-response-link" %>