diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index 10f240af9..6f62b88bc 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -1,7 +1,7 @@ class ArtistsController < ApplicationController respond_to :html, :xml, :json, :js before_action :member_only, :except => [:index, :show, :show_or_new, :banned] - before_action :builder_only, :only => [:destroy] + before_action :janitor_only, :only => [:destroy] before_action :admin_only, :only => [:ban, :unban] before_action :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete] @@ -106,7 +106,7 @@ private def artist_params(context = nil) permitted_params = %i[name other_names other_names_string group_name url_string notes] - permitted_params << :is_active if CurrentUser.is_builder? + permitted_params << :is_active if CurrentUser.is_janitor? permitted_params << :source if context == :new params.fetch(:artist, {}).permit(permitted_params) diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb index 50c81e8b3..3998c5d81 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_action :member_only, :except => [:index, :show, :gallery] - before_action :builder_only, :only => [:destroy] + before_action :janitor_only, :only => [:destroy] def new @pool = Pool.new diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 8523e6dc4..ecb1c12a0 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -127,7 +127,7 @@ private rating old_rating has_embedded_notes ] - permitted_params += %i[is_rating_locked is_note_locked] if CurrentUser.is_builder? + permitted_params += %i[is_rating_locked is_note_locked] if CurrentUser.is_janitor? permitted_params += %i[is_status_locked locked_tags hide_from_anonymous hide_from_search_engines] if CurrentUser.is_admin? params.require(:post).permit(permitted_params) diff --git a/app/controllers/tag_alias_corrections_controller.rb b/app/controllers/tag_alias_corrections_controller.rb index cf7ecc683..18a0d94cf 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_action :builder_only, only: [:create] + before_action :janitor_only, only: [:create] def create @correction = TagAliasCorrection.new(params[:tag_alias_id]) diff --git a/app/controllers/tag_corrections_controller.rb b/app/controllers/tag_corrections_controller.rb index 21b9c82e6..0f03d46e7 100644 --- a/app/controllers/tag_corrections_controller.rb +++ b/app/controllers/tag_corrections_controller.rb @@ -1,12 +1,12 @@ class TagCorrectionsController < ApplicationController respond_to :html, :json, :xml - before_action :builder_only, only: [:new, :create] + before_action :janitor_only, only: [:new, :create] def new @correction = TagCorrection.new(params[:tag_id]) respond_with(@correction) end - + def show @correction = TagCorrection.new(params[:tag_id]) respond_with(@correction) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index a585c4d2d..e8cda8ccb 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -19,7 +19,7 @@ class TagsController < ApplicationController end def autocomplete - if CurrentUser.is_builder? + if CurrentUser.is_janitor? # limit rollout @tags = TagAutocomplete.search(params[:search][:name_matches]) else diff --git a/app/controllers/wiki_pages_controller.rb b/app/controllers/wiki_pages_controller.rb index 41b7a2b59..f5299d449 100644 --- a/app/controllers/wiki_pages_controller.rb +++ b/app/controllers/wiki_pages_controller.rb @@ -1,9 +1,9 @@ class WikiPagesController < ApplicationController respond_to :html, :xml, :json, :js before_action :member_only, :except => [:index, :search, :show, :show_or_new] - before_action :builder_only, :only => [:destroy] + before_action :janitor_only, :only => [:destroy] before_action :normalize_search_params, :only => [:index] - + def new @wiki_page = WikiPage.new(wiki_page_params(:create)) respond_with(@wiki_page) @@ -49,7 +49,7 @@ class WikiPagesController < ApplicationController return end end - + respond_with(@wiki_page) end @@ -100,8 +100,8 @@ class WikiPagesController < ApplicationController def wiki_page_params(context) permitted_params = %i[body other_names other_names_string skip_secondary_validations] - permitted_params += %i[is_locked is_deleted] if CurrentUser.is_builder? - permitted_params += %i[title] if context == :create || CurrentUser.is_builder? + permitted_params += %i[is_locked is_deleted] if CurrentUser.is_janitor? + permitted_params += %i[title] if context == :create || CurrentUser.is_janitor? params.fetch(:wiki_page, {}).permit(permitted_params) end diff --git a/app/helpers/admin/users_helper.rb b/app/helpers/admin/users_helper.rb index e28ded38a..21aad0e82 100644 --- a/app/helpers/admin/users_helper.rb +++ b/app/helpers/admin/users_helper.rb @@ -4,7 +4,7 @@ module Admin::UsersHelper ["Member", User::Levels::MEMBER], ["Privileged", User::Levels::PRIVILEGED], ["Contributor", User::Levels::CONTRIBUTOR], - ["Builder", User::Levels::JANITOR], + ["Janitor", User::Levels::JANITOR], ["Moderator", User::Levels::MODERATOR], ["Admin", User::Levels::ADMIN] ] diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index e4a9edebc..4fc442d17 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -78,7 +78,7 @@ module PostsHelper source_link = source end - if CurrentUser.is_builder? && !source_search.blank? + if CurrentUser.is_janitor? && !source_search.blank? source_link + " ".html_safe + link_to("»".html_safe, posts_path(:tags => source_search), :rel => "nofollow") else source_link diff --git a/app/javascript/src/styles/common/user_styles.scss b/app/javascript/src/styles/common/user_styles.scss index 20e3db645..5494a0774 100644 --- a/app/javascript/src/styles/common/user_styles.scss +++ b/app/javascript/src/styles/common/user_styles.scss @@ -10,7 +10,7 @@ a.user-contributor.with-style { color: purple; } -a.user-builder.with-style { +a.user-janitor.with-style { color: #6633FF; } diff --git a/app/models/artist.rb b/app/models/artist.rb index 98f398acb..c1ea003ce 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -578,11 +578,11 @@ class Artist < ApplicationRecord end def deletable_by?(user) - user.is_builder? + user.is_janitor? end def editable_by?(user) - user.is_builder? || (!is_banned? && is_active?) + user.is_janitor? || (!is_banned? && is_active?) end def visible? diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index fd6abda69..7bffdbaa2 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -89,8 +89,8 @@ class BulkUpdateRequest < ApplicationRecord nil end ForumUpdater.new( - forum_topic, - forum_post: post, + forum_topic, + forum_post: post, expected_title: title, skip_update: !TagRelationship::SUPPORT_HARD_CODED ) @@ -179,7 +179,7 @@ class BulkUpdateRequest < ApplicationRecord end def editable?(user) - user_id == user.id || user.is_builder? + user_id == user.id || user.is_janitor? end def approvable?(user) diff --git a/app/models/pool.rb b/app/models/pool.rb index ad3b190fc..84c96f26f 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -197,7 +197,7 @@ class Pool < ApplicationRecord end def deletable_by?(user) - user.is_builder? + user.is_janitor? end def updater_can_edit_deleted @@ -348,7 +348,7 @@ class Pool < ApplicationRecord end def category_changeable_by?(user) - user.is_builder? || (user.is_member? && post_count <= Danbooru.config.pool_category_change_limit) + user.is_janitor? || (user.is_member? && post_count <= Danbooru.config.pool_category_change_limit) end def updater_can_change_category diff --git a/app/models/post.rb b/app/models/post.rb index 99ebd7563..72b1d509b 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -951,10 +951,10 @@ class Post < ApplicationRecord self.rating = $1 when /^(-?)locked:notes?$/i - self.is_note_locked = ($1 != "-") if CurrentUser.is_builder? + self.is_note_locked = ($1 != "-") if CurrentUser.is_janitor? when /^(-?)locked:rating$/i - self.is_rating_locked = ($1 != "-") if CurrentUser.is_builder? + self.is_rating_locked = ($1 != "-") if CurrentUser.is_janitor? when /^(-?)locked:status$/i self.is_status_locked = ($1 != "-") if CurrentUser.is_admin? diff --git a/app/models/post_set.rb b/app/models/post_set.rb index 04ecf0dde..373a08256 100644 --- a/app/models/post_set.rb +++ b/app/models/post_set.rb @@ -88,7 +88,7 @@ class PostSet < ApplicationRecord end def can_make_public - if is_public && creator.created_at > 3.days.ago && !creator.is_builder? + if is_public && creator.created_at > 3.days.ago && !creator.is_janitor? errors.add(:base, "Can't make a set public until your account is at least three days old") false else @@ -105,7 +105,7 @@ class PostSet < ApplicationRecord end def set_per_hour_limit - if where("created_at > ? AND creator_id = ?", 1.hour.ago, creator.id).count() > 6 && !creator.is_builder? + if where("created_at > ? AND creator_id = ?", 1.hour.ago, creator.id).count() > 6 && !creator.is_janitor? first = where("created_at > ? AND creator_id = ?", 1.hour.ago, creator.id).order(:created_at).first() errors.add(:base, "You have already created 6 sets in the last hour. You can make a new set in #{time_ago_in_words(first.created_at)}") false diff --git a/app/models/tag.rb b/app/models/tag.rb index a8074b02e..f049ee09b 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -994,7 +994,7 @@ class Tag < ApplicationRecord end def category_editable_by_implicit?(user) - return false unless user.is_builder? + return false unless user.is_janitor? return false if is_locked? return false if post_count >= Danbooru.config.tag_type_change_cutoff true diff --git a/app/models/tag_relationship.rb b/app/models/tag_relationship.rb index 537df4504..c79caf974 100644 --- a/app/models/tag_relationship.rb +++ b/app/models/tag_relationship.rb @@ -70,7 +70,7 @@ class TagRelationship < ApplicationRecord def deletable_by?(user) return true if user.is_admin? - return true if is_pending? && user.is_builder? + return true if is_pending? && user.is_janitor? return true if is_pending? && user.id == creator_id return false end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 7c1864038..7fcb1ecf8 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -136,7 +136,7 @@ class WikiPage < ApplicationRecord end def validate_not_locked - if is_locked? && !CurrentUser.is_builder? + if is_locked? && !CurrentUser.is_janitor? errors.add(:is_locked, "and cannot be updated") return false end @@ -252,6 +252,6 @@ class WikiPage < ApplicationRecord end def visible? - artist.blank? || !artist.is_banned? || CurrentUser.is_builder? + artist.blank? || !artist.is_banned? || CurrentUser.is_janitor? end end diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index 931ac2d19..77c5c20ac 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -5,7 +5,7 @@ <%= text_field "artist", "name" %> - <% elsif CurrentUser.user.is_builder? %> + <% elsif CurrentUser.user.is_janitor? %> <%= text_field "artist", "name" %> Change to rename this artist entry and its wiki page diff --git a/app/views/comments/_index_by_post.html.erb b/app/views/comments/_index_by_post.html.erb index d28b408ba..2a890fe02 100644 --- a/app/views/comments/_index_by_post.html.erb +++ b/app/views/comments/_index_by_post.html.erb @@ -1,5 +1,5 @@
- <% if !CurrentUser.user.is_builder? %> + <% if !CurrentUser.user.is_janitor? %>

Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.

diff --git a/app/views/layouts/_main_links.html.erb b/app/views/layouts/_main_links.html.erb index 804a61cd4..66ae7e25a 100644 --- a/app/views/layouts/_main_links.html.erb +++ b/app/views/layouts/_main_links.html.erb @@ -10,7 +10,7 @@ <%= nav_link_to("Artists", artists_path) %> <%= nav_link_to("Tags", tags_path) %> <%= nav_link_to("Blips", blips_path) %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> <%= nav_link_to("Aliases", tag_aliases_path) %> <%= nav_link_to("Implications", tag_implications_path) %> <% end %> diff --git a/app/views/meta_searches/tags.html.erb b/app/views/meta_searches/tags.html.erb index bc227b4f6..e7afbae69 100644 --- a/app/views/meta_searches/tags.html.erb +++ b/app/views/meta_searches/tags.html.erb @@ -33,7 +33,7 @@ <% if tag.editable_by?(CurrentUser.user) %> <%= link_to "edit", edit_tag_path(tag) %> <% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> | <%= link_to "fix", new_tag_correction_path(:tag_id => tag.id) %> <% end %> @@ -74,7 +74,7 @@ | <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %> <% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> | <%= link_to "Fix", tag_alias_correction_path(:tag_alias_id => tag_alias.id) %> <% end %> diff --git a/app/views/posts/partials/index/_mode_menu.html.erb b/app/views/posts/partials/index/_mode_menu.html.erb index dda83ccf8..462cbaa4b 100644 --- a/app/views/posts/partials/index/_mode_menu.html.erb +++ b/app/views/posts/partials/index/_mode_menu.html.erb @@ -11,7 +11,7 @@ <% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> <% end %> diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb index d18fbc73c..e137a0a36 100644 --- a/app/views/posts/partials/show/_edit.html.erb +++ b/app/views/posts/partials/show/_edit.html.erb @@ -1,4 +1,4 @@ -<% unless CurrentUser.user.is_builder? %> +<% unless CurrentUser.user.is_janitor? %>

Before editing, read the <%= link_to "how to tag guide", wiki_page_path(:id => "howto:tag") %>.

@@ -39,7 +39,7 @@
<% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %>
<%= f.label :blank, "Lock" %> @@ -107,7 +107,7 @@ <%= f.text_area :locked_tags, :size => "60x2", :spellcheck => false, :"data-autocomplete" => "tag-edit", :"data-shortcut" => "e", :value => (post.locked_tags || ""), disabled: !CurrentUser.is_admin? %>
- +
<%= submit_tag "Submit", :class => "ui-button ui-widget ui-corner-all" %>
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index b7054d166..6c582763b 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -114,7 +114,7 @@ <% end %>
- <% if !CurrentUser.user.is_builder? %> + <% if !CurrentUser.user.is_janitor? %>

Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.

<% end %> <%= render "comments/partials/index/list", :comments => @post.comments.visible(CurrentUser.user), :post => @post, :show_header => false %> diff --git a/app/views/static/error.html.erb b/app/views/static/error.html.erb index 8689cba62..1b47931cc 100644 --- a/app/views/static/error.html.erb +++ b/app/views/static/error.html.erb @@ -1,4 +1,4 @@ -<% if CurrentUser.user.try(:is_builder?) && @exception.present? %> +<% if CurrentUser.user.try(:is_janitor?) && @exception.present? %>

<%= @exception.class.to_s %> exception raised

<%= @exception.message.dup.force_encoding("utf-8") %>

diff --git a/app/views/tag_aliases/_listing.html.erb b/app/views/tag_aliases/_listing.html.erb index 41aec5c86..31da980dd 100644 --- a/app/views/tag_aliases/_listing.html.erb +++ b/app/views/tag_aliases/_listing.html.erb @@ -38,7 +38,7 @@ | <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %> <% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> | <%= link_to "Fix", tag_alias_correction_path(:tag_alias_id => tag_alias.id) %> <% end %> diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index eee3863f4..94ff2a302 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -22,7 +22,7 @@ <%= link_to "edit", edit_tag_path(tag) %> <% end %> | <%= link_to "history", tag_type_versions_path(search: {tag: tag.name}) %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> | <%= link_to "fix", new_tag_correction_path(:tag_id => tag.id) %> <% end %> diff --git a/app/views/uploads/show.html.erb b/app/views/uploads/show.html.erb index db7101dea..6264fc0a2 100644 --- a/app/views/uploads/show.html.erb +++ b/app/views/uploads/show.html.erb @@ -29,7 +29,7 @@

This upload is a duplicate: <%= link_to "post ##{@upload.duplicate_post_id}", post_path(@upload.duplicate_post_id) %>

<% else %>

An error occurred: <%= render_status(@upload) %>

- <% if CurrentUser.user.is_builder? %> + <% if CurrentUser.user.is_janitor? %> <%= render "static/backtrace", backtrace: @upload.backtrace.to_s.split(/\n/) %> <% end %> <% end %> diff --git a/app/views/wiki_pages/_form.html.erb b/app/views/wiki_pages/_form.html.erb index 649ad40f8..424ab7d5b 100644 --- a/app/views/wiki_pages/_form.html.erb +++ b/app/views/wiki_pages/_form.html.erb @@ -4,7 +4,7 @@ <%= simple_form_for(@wiki_page) do |f| %> <% if @wiki_page.new_record? %> <%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } } %> - <% elsif CurrentUser.is_builder? %> + <% elsif CurrentUser.is_janitor? %> <%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } }, hint: "Change to rename this wiki page. Move the tag and update any wikis linking to this page first." %> <% else %>

<%= @wiki_page.pretty_title %>

@@ -14,11 +14,11 @@ <%= dtext_field "wiki_page", "body" %> - <% if CurrentUser.is_builder? && @wiki_page.is_deleted? %> + <% if CurrentUser.is_janitor? && @wiki_page.is_deleted? %> <%= f.input :is_deleted, :label => "Deleted", :hint => "Uncheck to restore this wiki page" %> <% end %> - <% if CurrentUser.is_builder? %> + <% if CurrentUser.is_janitor? %> <%= f.input :is_locked, :label => "Locked" %> <% end %> diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb index 294f0e4b9..2841ff0f3 100644 --- a/app/views/wiki_pages/_secondary_links.html.erb +++ b/app/views/wiki_pages/_secondary_links.html.erb @@ -28,7 +28,7 @@ <%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page), "data-shortcut": "e" %> <% end %> - <% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %> + <% if CurrentUser.is_janitor? && !@wiki_page.is_deleted? %> <%= subnav_link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this wiki page?" %> <% end %> diff --git a/test/factories/user.rb b/test/factories/user.rb index 49ca1459b..077749c53 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -31,8 +31,8 @@ FactoryBot.define do level 31 end - factory(:builder_user) do - level 32 + factory(:janitor_user) do + level 35 end factory(:contributor_user) do diff --git a/test/functional/artists_controller_test.rb b/test/functional/artists_controller_test.rb index da95627e6..f4e695640 100644 --- a/test/functional/artists_controller_test.rb +++ b/test/functional/artists_controller_test.rb @@ -188,16 +188,16 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest end should "delete an artist" do - @builder = create(:builder_user) - delete_auth artist_path(@artist.id), @builder + @janitor = create(:janitor_user) + delete_auth artist_path(@artist.id), @janitor assert_redirected_to(artist_path(@artist.id)) @artist.reload assert_equal(false, @artist.is_active) end should "undelete an artist" do - @builder = create(:builder_user) - put_auth artist_path(@artist.id), @builder, params: {artist: {is_active: true}} + @janitor = create(:janitor_user) + put_auth artist_path(@artist.id), @janitor, params: {artist: {is_active: true}} assert_redirected_to(artist_path(@artist.id)) assert_equal(true, @artist.reload.is_active) end diff --git a/test/functional/tags_controller_test.rb b/test/functional/tags_controller_test.rb index 6936de81e..9ea4e4ab6 100644 --- a/test/functional/tags_controller_test.rb +++ b/test/functional/tags_controller_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class TagsControllerTest < ActionDispatch::IntegrationTest context "The tags controller" do setup do - @user = create(:builder_user) + @user = create(:janitor_user) as_user do @tag = create(:tag, name: "touhou", category: Tag.categories.copyright, post_count: 1) end diff --git a/test/unit/pool_test.rb b/test/unit/pool_test.rb index d2ef787dd..6c5a22399 100644 --- a/test/unit/pool_test.rb +++ b/test/unit/pool_test.rb @@ -181,8 +181,8 @@ class PoolTest < ActiveSupport::TestCase context "to a deleted pool" do setup do - # must be a builder to update deleted pools. - CurrentUser.user = FactoryBot.create(:builder_user) + # must be a janitor to update deleted pools. + CurrentUser.user = FactoryBot.create(:janitor_user) @pool.update_attribute(:is_deleted, true) @pool.post_ids += [@p2.id] @@ -266,9 +266,9 @@ class PoolTest < ActiveSupport::TestCase assert_equal(["You cannot change the category of pools with greater than 1 posts"], @pool.errors[:base]) end - should "allow Builders to change the category of large pools" do - @builder = FactoryBot.create(:builder_user) - as(@builder) { @pool.update(category: "collection") } + should "allow janitors to change the category of large pools" do + @janitor = FactoryBot.create(:janitor_user) + as(@janitor) { @pool.update(category: "collection") } assert_equal(true, @pool.valid?) assert_equal("collection", @pool.category) diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 6e1524060..c35822122 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -93,8 +93,8 @@ class PostTest < ActiveSupport::TestCase context "that belongs to a pool" do setup do - # must be a builder to update deleted pools. must be >1 week old to remove posts from pools. - CurrentUser.user = FactoryBot.create(:builder_user, created_at: 1.month.ago) + # must be a janitor to update deleted pools. must be >1 week old to remove posts from pools. + CurrentUser.user = FactoryBot.create(:janitor_user, created_at: 1.month.ago) SqsService.any_instance.stubs(:send_message) @pool = FactoryBot.create(:pool) @@ -574,7 +574,7 @@ class PostTest < ActiveSupport::TestCase context "with an artist tag that is then changed to copyright" do setup do - CurrentUser.user = FactoryBot.create(:builder_user) + CurrentUser.user = FactoryBot.create(:janitor_user) @post = Post.find(@post.id) @post.update(:tag_string => "art:abc") @post = Post.find(@post.id) @@ -1032,7 +1032,7 @@ class PostTest < ActiveSupport::TestCase context "of" do setup do - @builder = FactoryBot.create(:builder_user) + @janitor = FactoryBot.create(:janitor_user) end context "locked:notes" do @@ -1043,9 +1043,9 @@ class PostTest < ActiveSupport::TestCase end end - context "by a builder" do + context "by a janitor" do should "lock/unlock the notes" do - CurrentUser.scoped(@builder) do + CurrentUser.scoped(@janitor) do @post.update(:tag_string => "locked:notes") assert_equal(true, @post.is_note_locked) @@ -1064,9 +1064,9 @@ class PostTest < ActiveSupport::TestCase end end - context "by a builder" do + context "by a janitor" do should "lock/unlock the rating" do - CurrentUser.scoped(@builder) do + CurrentUser.scoped(@janitor) do @post.update(:tag_string => "locked:rating") assert_equal(true, @post.is_rating_locked) diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index a01458075..35c8f0dd7 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -2,8 +2,8 @@ require 'test_helper' class TagTest < ActiveSupport::TestCase setup do - @builder = FactoryBot.create(:builder_user) - CurrentUser.user = @builder + @janitor = FactoryBot.create(:janitor_user) + CurrentUser.user = @janitor CurrentUser.ip_addr = "127.0.0.1" end @@ -194,9 +194,9 @@ class TagTest < ActiveSupport::TestCase assert_equal(0, tag.category) end - should "not change category when the tag is too large to be changed by a builder" do + should "not change category when the tag is too large to be changed by a janitor" do tag = FactoryBot.create(:tag, post_count: 1001) - Tag.find_or_create_by_name("artist:#{tag.name}", creator: @builder) + Tag.find_or_create_by_name("artist:#{tag.name}", creator: @janitor) assert_equal(0, tag.reload.category) end