From 0c6f794eb057e6fb602fe8956c1c3cd57a52379f Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 7 Nov 2013 13:53:32 -0500 Subject: [PATCH] Used the term suspended instead of banned. --- ...er.js => admin_suspend_user_controller.js} | 12 +++---- .../javascripts/admin/models/admin_user.js | 24 ++++++------- .../admin/routes/admin_dashboard_route.js | 2 +- .../javascripts/admin/routes/admin_routes.js | 2 +- .../admin/routes/admin_user_route.js | 6 ++-- .../admin/routes/admin_users_list_routes.js | 8 ++--- .../admin/templates/dashboard.js.handlebars | 4 +-- ...ebars => admin_suspend_user.js.handlebars} | 8 ++--- .../admin/templates/user.js.handlebars | 36 +++++++++---------- .../admin/templates/users_list.js.handlebars | 2 +- .../admin/views/modals/admin_ban_user_view.js | 12 ------- .../views/modals/admin_suspend_user_view.js | 12 +++++++ app/controllers/admin/users_controller.rb | 24 ++++++------- app/controllers/session_controller.rb | 8 ++--- app/jobs/regular/user_email.rb | 6 ++-- app/models/admin_dashboard_data.rb | 2 +- app/models/user.rb | 20 +++++------ app/models/user_history.rb | 8 ++--- .../admin_detailed_user_serializer.rb | 8 ++--- app/serializers/admin_user_serializer.rb | 10 +++--- app/services/staff_action_logger.rb | 8 ++--- config/locales/client.cs.yml | 18 +++++----- config/locales/client.da.yml | 12 +++---- config/locales/client.de.yml | 18 +++++----- config/locales/client.en.yml | 34 +++++++++--------- config/locales/client.es.yml | 12 +++---- config/locales/client.fr.yml | 18 +++++----- config/locales/client.id.yml | 12 +++---- config/locales/client.it.yml | 12 +++---- config/locales/client.ko.yml | 18 +++++----- config/locales/client.nb_NO.yml | 12 +++---- config/locales/client.nl.yml | 18 +++++----- config/locales/client.pseudo.yml | 18 +++++----- config/locales/client.pt.yml | 12 +++---- config/locales/client.pt_BR.yml | 18 +++++----- config/locales/client.ru.yml | 18 +++++----- config/locales/client.sv.yml | 12 +++---- config/locales/client.zh_CN.yml | 18 +++++----- config/locales/client.zh_TW.yml | 18 +++++----- config/locales/server.cs.yml | 2 +- config/locales/server.de.yml | 2 +- config/locales/server.en.yml | 4 +-- config/locales/server.fr.yml | 2 +- config/locales/server.nl.yml | 2 +- config/locales/server.pseudo.yml | 2 +- config/locales/server.pt_BR.yml | 2 +- config/locales/server.ru.yml | 2 +- config/routes.rb | 4 +-- ...131107154900_rename_banned_to_suspended.rb | 6 ++++ lib/admin_user_index_query.rb | 4 +-- lib/auth/default_current_user_provider.rb | 2 +- lib/guardian.rb | 4 +-- .../components/admin_user_index_query_spec.rb | 6 ++-- spec/components/guardian_spec.rb | 18 +++++----- spec/controllers/session_controller_spec.rb | 6 ++-- spec/jobs/user_email_spec.rb | 24 ++++++------- spec/services/staff_action_logger_spec.rb | 18 +++++----- 57 files changed, 318 insertions(+), 312 deletions(-) rename app/assets/javascripts/admin/controllers/{admin_ban_user_controller.js => admin_suspend_user_controller.js} (53%) rename app/assets/javascripts/admin/templates/modal/{admin_ban_user.js.handlebars => admin_suspend_user.js.handlebars} (52%) delete mode 100644 app/assets/javascripts/admin/views/modals/admin_ban_user_view.js create mode 100644 app/assets/javascripts/admin/views/modals/admin_suspend_user_view.js create mode 100644 db/migrate/20131107154900_rename_banned_to_suspended.rb diff --git a/app/assets/javascripts/admin/controllers/admin_ban_user_controller.js b/app/assets/javascripts/admin/controllers/admin_suspend_user_controller.js similarity index 53% rename from app/assets/javascripts/admin/controllers/admin_ban_user_controller.js rename to app/assets/javascripts/admin/controllers/admin_suspend_user_controller.js index d2df4bbaf50..0f4c1625ffd 100644 --- a/app/assets/javascripts/admin/controllers/admin_ban_user_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_suspend_user_controller.js @@ -1,24 +1,24 @@ /** - The modal for banning a user. + The modal for suspending a user. - @class AdminBanUserController + @class AdminSuspendUserController @extends Discourse.Controller @namespace Discourse @uses Discourse.ModalFunctionality @module Discourse **/ -Discourse.AdminBanUserController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, { +Discourse.AdminSuspendUserController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, { actions: { - ban: function() { + suspend: function() { var duration = parseInt(this.get('duration'), 10); if (duration > 0) { var self = this; this.send('hideModal'); - this.get('model').ban(duration, this.get('reason')).then(function() { + this.get('model').suspend(duration, this.get('reason')).then(function() { window.location.reload(); }, function(e) { - var error = I18n.t('admin.user.ban_failed', { error: "http: " + e.status + " - " + e.body }); + var error = I18n.t('admin.user.suspend_failed', { error: "http: " + e.status + " - " + e.body }); bootbox.alert(error, function() { self.send('showModal'); }); }); } diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index f9b98f87e52..9aeec0bf57d 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -133,31 +133,31 @@ Discourse.AdminUser = Discourse.User.extend({ this.set('trustLevel.id', this.get('originalTrustLevel')); }, - isBanned: Em.computed.equal('is_banned', true), - canBan: Em.computed.not('staff'), + isSuspended: Em.computed.equal('suspended', true), + canSuspend: Em.computed.not('staff'), - banDuration: function() { - var banned_at = moment(this.banned_at); - var banned_till = moment(this.banned_till); - return banned_at.format('L') + " - " + banned_till.format('L'); - }.property('banned_till', 'banned_at'), + suspendDuration: function() { + var suspended_at = moment(this.suspended_at); + var suspended_till = moment(this.suspended_till); + return suspended_at.format('L') + " - " + suspended_till.format('L'); + }.property('suspended_till', 'suspended_at'), - ban: function(duration, reason) { - return Discourse.ajax("/admin/users/" + this.id + "/ban", { + suspend: function(duration, reason) { + return Discourse.ajax("/admin/users/" + this.id + "/suspend", { type: 'PUT', data: {duration: duration, reason: reason} }); }, - unban: function() { - Discourse.ajax("/admin/users/" + this.id + "/unban", { + unsuspend: function() { + Discourse.ajax("/admin/users/" + this.id + "/unsuspend", { type: 'PUT' }).then(function() { // succeeded window.location.reload(); }, function(e) { // failed - var error = I18n.t('admin.user.unban_failed', { error: "http: " + e.status + " - " + e.body }); + var error = I18n.t('admin.user.unsuspend_failed', { error: "http: " + e.status + " - " + e.body }); bootbox.alert(error); }); }, diff --git a/app/assets/javascripts/admin/routes/admin_dashboard_route.js b/app/assets/javascripts/admin/routes/admin_dashboard_route.js index 8af0dab4bee..0c842d9f791 100644 --- a/app/assets/javascripts/admin/routes/admin_dashboard_route.js +++ b/app/assets/javascripts/admin/routes/admin_dashboard_route.js @@ -32,7 +32,7 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({ c.set('top_referrers', topReferrers); } - ['admins', 'moderators', 'blocked', 'banned', 'top_traffic_sources', 'top_referred_topics', 'updated_at'].forEach(function(x) { + ['admins', 'moderators', 'blocked', 'suspended', 'top_traffic_sources', 'top_referred_topics', 'updated_at'].forEach(function(x) { c.set(x, d[x]); }); diff --git a/app/assets/javascripts/admin/routes/admin_routes.js b/app/assets/javascripts/admin/routes/admin_routes.js index d9ca9b5b442..58e39cf8170 100644 --- a/app/assets/javascripts/admin/routes/admin_routes.js +++ b/app/assets/javascripts/admin/routes/admin_routes.js @@ -42,7 +42,7 @@ Discourse.Route.buildRoutes(function() { this.resource('adminUsers', { path: '/users' }, function() { this.resource('adminUser', { path: '/:username' }); this.resource('adminUsersList', { path: '/list' }, function() { - _.each(['active', 'new', 'pending', 'admins', 'moderators', 'blocked', 'banned', + _.each(['active', 'new', 'pending', 'admins', 'moderators', 'blocked', 'suspended', 'newuser', 'basic', 'regular', 'leaders', 'elders'], function(x) { this.route(x, { path: '/' + x }); }, this); diff --git a/app/assets/javascripts/admin/routes/admin_user_route.js b/app/assets/javascripts/admin/routes/admin_user_route.js index cda73d13d77..65192f6ec4d 100644 --- a/app/assets/javascripts/admin/routes/admin_user_route.js +++ b/app/assets/javascripts/admin/routes/admin_user_route.js @@ -31,9 +31,9 @@ Discourse.AdminUserRoute = Discourse.Route.extend({ }, actions: { - showBanModal: function(user) { - Discourse.Route.showModal(this, 'admin_ban_user', user); - this.controllerFor('modal').set('modalClass', 'ban-user-modal'); + showSuspendModal: function(user) { + Discourse.Route.showModal(this, 'admin_suspend_user', user); + this.controllerFor('modal').set('modalClass', 'suspend-user-modal'); } } diff --git a/app/assets/javascripts/admin/routes/admin_users_list_routes.js b/app/assets/javascripts/admin/routes/admin_users_list_routes.js index ba719c6bf9e..86b180d39bc 100644 --- a/app/assets/javascripts/admin/routes/admin_users_list_routes.js +++ b/app/assets/javascripts/admin/routes/admin_users_list_routes.js @@ -111,15 +111,15 @@ Discourse.AdminUsersListBlockedRoute = Discourse.Route.extend({ }); /** - Handles the route that lists banned users. + Handles the route that lists suspended users. - @class AdminUsersListBannedRoute + @class AdminUsersListSuspendedRoute @extends Discourse.Route @namespace Discourse @module Discourse **/ -Discourse.AdminUsersListBannedRoute = Discourse.Route.extend({ +Discourse.AdminUsersListSuspendedRoute = Discourse.Route.extend({ setupController: function() { - return this.controllerFor('adminUsersList').show('banned'); + return this.controllerFor('adminUsersList').show('suspended'); } }); diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index fdc9fdd5f16..457a55171f8 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -132,8 +132,8 @@ {{i18n admin.dashboard.admins}} {{#link-to 'adminUsersList.admins'}}{{admins}}{{/link-to}} - {{i18n admin.dashboard.banned}} - {{#link-to 'adminUsersList.banned'}}{{banned}}{{/link-to}} + {{i18n admin.dashboard.suspended}} + {{#link-to 'adminUsersList.suspended'}}{{suspended}}{{/link-to}} {{i18n admin.dashboard.moderators}} diff --git a/app/assets/javascripts/admin/templates/modal/admin_ban_user.js.handlebars b/app/assets/javascripts/admin/templates/modal/admin_suspend_user.js.handlebars similarity index 52% rename from app/assets/javascripts/admin/templates/modal/admin_ban_user.js.handlebars rename to app/assets/javascripts/admin/templates/modal/admin_suspend_user.js.handlebars index 0b9c9dc843a..bc70d42c82d 100644 --- a/app/assets/javascripts/admin/templates/modal/admin_ban_user.js.handlebars +++ b/app/assets/javascripts/admin/templates/modal/admin_suspend_user.js.handlebars @@ -1,15 +1,15 @@ diff --git a/app/assets/javascripts/admin/templates/user.js.handlebars b/app/assets/javascripts/admin/templates/user.js.handlebars index b98fc08395a..fb707b054f6 100644 --- a/app/assets/javascripts/admin/templates/user.js.handlebars +++ b/app/assets/javascripts/admin/templates/user.js.handlebars @@ -198,39 +198,39 @@ -
-
{{i18n admin.user.banned}}
-
{{isBanned}}
+
+
{{i18n admin.user.suspended}}
+
{{isSuspended}}
- {{#if isBanned}} - - {{banDuration}} - {{i18n admin.user.banned_explanation}} + {{suspendDuration}} + {{i18n admin.user.suspended_explanation}} {{else}} - {{#if canBan}} - - {{i18n admin.user.banned_explanation}} + {{i18n admin.user.suspended_explanation}} {{/if}} {{/if}}
- {{#if isBanned}} + {{#if isSuspended}}
-
{{i18n admin.user.banned_by}}
+
{{i18n admin.user.suspended_by}}
- {{#link-to 'adminUser' banned_by}}{{avatar banned_by imageSize="tiny"}}{{/link-to}} - {{#link-to 'adminUser' banned_by}}{{banned_by.username}}{{/link-to}} + {{#link-to 'adminUser' suspended_by}}{{avatar suspended_by imageSize="tiny"}}{{/link-to}} + {{#link-to 'adminUser' suspended_by}}{{suspended_by.username}}{{/link-to}}
- {{i18n admin.user.ban_reason}}: - {{ban_reason}} + {{i18n admin.user.suspend_reason}}: + {{suspend_reason}}
{{/if}} diff --git a/app/assets/javascripts/admin/templates/users_list.js.handlebars b/app/assets/javascripts/admin/templates/users_list.js.handlebars index 5eed2a5f653..452e73f1b3e 100644 --- a/app/assets/javascripts/admin/templates/users_list.js.handlebars +++ b/app/assets/javascripts/admin/templates/users_list.js.handlebars @@ -8,7 +8,7 @@ {{/if}}
  • {{#link-to 'adminUsersList.admins'}}{{i18n admin.users.nav.admins}}{{/link-to}}
  • {{#link-to 'adminUsersList.moderators'}}{{i18n admin.users.nav.moderators}}{{/link-to}}
  • -
  • {{#link-to 'adminUsersList.banned'}}{{i18n admin.users.nav.banned}}{{/link-to}}
  • +
  • {{#link-to 'adminUsersList.suspended'}}{{i18n admin.users.nav.suspended}}{{/link-to}}
  • {{#link-to 'adminUsersList.blocked'}}{{i18n admin.users.nav.blocked}}{{/link-to}}
  • diff --git a/app/assets/javascripts/admin/views/modals/admin_ban_user_view.js b/app/assets/javascripts/admin/views/modals/admin_ban_user_view.js deleted file mode 100644 index cd4b9230d33..00000000000 --- a/app/assets/javascripts/admin/views/modals/admin_ban_user_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for banning a user. - - @class AdminBanUserView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.AdminBanUserView = Discourse.ModalBodyView.extend({ - templateName: 'admin/templates/modal/admin_ban_user', - title: I18n.t('admin.user.ban_modal_title') -}); diff --git a/app/assets/javascripts/admin/views/modals/admin_suspend_user_view.js b/app/assets/javascripts/admin/views/modals/admin_suspend_user_view.js new file mode 100644 index 00000000000..102a5e765c7 --- /dev/null +++ b/app/assets/javascripts/admin/views/modals/admin_suspend_user_view.js @@ -0,0 +1,12 @@ +/** + A modal view for suspending a user. + + @class AdminSuspendUserView + @extends Discourse.ModalBodyView + @namespace Discourse + @module Discourse +**/ +Discourse.AdminSuspendUserView = Discourse.ModalBodyView.extend({ + templateName: 'admin/templates/modal/admin_suspend_user', + title: I18n.t('admin.user.suspend_modal_title') +}); diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 131db0a07bf..9208048e909 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -4,8 +4,8 @@ require_dependency 'boost_trust_level' class Admin::UsersController < Admin::AdminController - before_filter :fetch_user, only: [:ban, - :unban, + before_filter :fetch_user, only: [:suspend, + :unsuspend, :refresh_browsers, :revoke_admin, :grant_admin, @@ -37,21 +37,21 @@ class Admin::UsersController < Admin::AdminController render nothing: true end - def ban - guardian.ensure_can_ban!(@user) - @user.banned_till = params[:duration].to_i.days.from_now - @user.banned_at = DateTime.now + def suspend + guardian.ensure_can_suspend!(@user) + @user.suspended_till = params[:duration].to_i.days.from_now + @user.suspended_at = DateTime.now @user.save! - StaffActionLogger.new(current_user).log_user_ban(@user, params[:reason]) + StaffActionLogger.new(current_user).log_user_suspend(@user, params[:reason]) render nothing: true end - def unban - guardian.ensure_can_ban!(@user) - @user.banned_till = nil - @user.banned_at = nil + def unsuspend + guardian.ensure_can_suspend!(@user) + @user.suspended_till = nil + @user.suspended_at = nil @user.save! - StaffActionLogger.new(current_user).log_user_unban(@user) + StaffActionLogger.new(current_user).log_user_unsuspend(@user) render nothing: true end diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 6cf36265107..6623d51475f 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -27,11 +27,11 @@ class SessionController < ApplicationController # If their password is correct if @user.confirm_password?(password) - if @user.is_banned? - if reason = @user.ban_reason - render json: { error: I18n.t("login.banned_with_reason", {date: I18n.l(@user.banned_till, format: :date_only), reason: reason}) } + if @user.suspended? + if reason = @user.suspend_reason + render json: { error: I18n.t("login.suspended_with_reason", {date: I18n.l(@user.suspended_till, format: :date_only), reason: reason}) } else - render json: { error: I18n.t("login.banned", {date: I18n.l(@user.banned_till, format: :date_only)}) } + render json: { error: I18n.t("login.suspended", {date: I18n.l(@user.suspended_till, format: :date_only)}) } end return end diff --git a/app/jobs/regular/user_email.rb b/app/jobs/regular/user_email.rb index 49891c51092..69538e3a3e4 100644 --- a/app/jobs/regular/user_email.rb +++ b/app/jobs/regular/user_email.rb @@ -14,7 +14,7 @@ module Jobs # Find the user user = User.where(id: args[:user_id]).first return unless user - return if user.is_banned? && args[:type] != :user_private_message + return if user.suspended? && args[:type] != :user_private_message seen_recently = (user.last_seen_at.present? && user.last_seen_at > SiteSetting.email_time_window_mins.minutes.ago) seen_recently = false if user.email_always @@ -38,7 +38,7 @@ module Jobs notification = Notification.where(id: args[:notification_id]).first if args[:notification_id].present? if notification.present? # Don't email a user about a post when we've seen them recently. - return if seen_recently && !user.is_banned? + return if seen_recently && !user.suspended? # Load the post if present email_args[:post] ||= notification.post @@ -69,7 +69,7 @@ module Jobs post && (post.topic.blank? || post.user_deleted? || - (user.is_banned? && !post.user.try(:staff?)) || + (user.suspended? && !post.user.try(:staff?)) || PostTiming.where(topic_id: post.topic_id, post_number: post.post_number, user_id: user.id).present?) end diff --git a/app/models/admin_dashboard_data.rb b/app/models/admin_dashboard_data.rb index 2a0ac42d9dd..2075b0cbf9d 100644 --- a/app/models/admin_dashboard_data.rb +++ b/app/models/admin_dashboard_data.rb @@ -64,7 +64,7 @@ class AdminDashboardData reports: REPORTS.map { |type| Report.find(type).as_json }, admins: User.admins.count, moderators: User.moderators.count, - banned: User.banned.count, + suspended: User.suspended.count, blocked: User.blocked.count, top_referrers: IncomingLinksReport.find('top_referrers').as_json, top_traffic_sources: IncomingLinksReport.find('top_traffic_sources').as_json, diff --git a/app/models/user.rb b/app/models/user.rb index ea6f9fdef49..f2f5b30e7a1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -78,8 +78,8 @@ class User < ActiveRecord::Base attr_accessor :notification_channel_position scope :blocked, -> { where(blocked: true) } # no index - scope :banned, -> { where('banned_till IS NOT NULL AND banned_till > ?', Time.zone.now) } # no index - scope :not_banned, -> { where('banned_till IS NULL') } + scope :suspended, -> { where('suspended_till IS NOT NULL AND suspended_till > ?', Time.zone.now) } # no index + scope :not_suspended, -> { where('suspended_till IS NULL') } # excluding fake users like the community user scope :real, -> { where('id > 0') } @@ -356,16 +356,16 @@ class User < ActiveRecord::Base end end - def is_banned? - banned_till && banned_till > DateTime.now + def suspended? + suspended_till && suspended_till > DateTime.now end - def ban_record - UserHistory.for(self, :ban_user).order('id DESC').first + def suspend_record + UserHistory.for(self, :suspend_user).order('id DESC').first end - def ban_reason - ban_record.try(:details) if is_banned? + def suspend_reason + suspend_record.try(:details) if suspended? end # Use this helper to determine if the user has a particular trust level. @@ -623,8 +623,8 @@ end # approved_at :datetime # digest_after_days :integer # previous_visit_at :datetime -# banned_at :datetime -# banned_till :datetime +# suspended_at :datetime +# suspended_till :datetime # date_of_birth :date # auto_track_topics_after_msecs :integer # views :integer default(0), not null diff --git a/app/models/user_history.rb b/app/models/user_history.rb index a07de2ce51a..73bc57379e5 100644 --- a/app/models/user_history.rb +++ b/app/models/user_history.rb @@ -19,8 +19,8 @@ class UserHistory < ActiveRecord::Base :notified_about_avatar, :notified_about_sequential_replies, :notitied_about_dominating_topic, - :ban_user, - :unban_user) + :suspend_user, + :unsuspend_user) end # Staff actions is a subset of all actions, used to audit actions taken by staff users. @@ -30,8 +30,8 @@ class UserHistory < ActiveRecord::Base :change_site_setting, :change_site_customization, :delete_site_customization, - :ban_user, - :unban_user] + :suspend_user, + :unsuspend_user] end def self.staff_action_ids diff --git a/app/serializers/admin_detailed_user_serializer.rb b/app/serializers/admin_detailed_user_serializer.rb index d3ff1f95f94..27717311bb4 100644 --- a/app/serializers/admin_detailed_user_serializer.rb +++ b/app/serializers/admin_detailed_user_serializer.rb @@ -14,11 +14,11 @@ class AdminDetailedUserSerializer < AdminUserSerializer :private_topics_count, :can_delete_all_posts, :can_be_deleted, - :ban_reason + :suspend_reason has_one :approved_by, serializer: BasicUserSerializer, embed: :objects has_one :api_key, serializer: ApiKeySerializer, embed: :objects - has_one :banned_by, serializer: BasicUserSerializer, embed: :objects + has_one :suspended_by, serializer: BasicUserSerializer, embed: :objects def can_revoke_admin scope.can_revoke_admin?(object) @@ -56,8 +56,8 @@ class AdminDetailedUserSerializer < AdminUserSerializer api_key.present? end - def banned_by - object.ban_record.try(:acting_user) + def suspended_by + object.suspend_record.try(:acting_user) end end diff --git a/app/serializers/admin_user_serializer.rb b/app/serializers/admin_user_serializer.rb index 51694f981dc..be16a34dce4 100644 --- a/app/serializers/admin_user_serializer.rb +++ b/app/serializers/admin_user_serializer.rb @@ -15,9 +15,9 @@ class AdminUserSerializer < BasicUserSerializer :avatar_template, :can_approve, :approved, - :banned_at, - :banned_till, - :is_banned, + :suspended_at, + :suspended_till, + :suspended, :ip_address, :can_send_activation_email, :can_activate, @@ -32,8 +32,8 @@ class AdminUserSerializer < BasicUserSerializer end end - def is_banned - object.is_banned? + def suspended + object.suspended? end def can_impersonate diff --git a/app/services/staff_action_logger.rb b/app/services/staff_action_logger.rb index 2d5d1034c43..bb9fa1f7401 100644 --- a/app/services/staff_action_logger.rb +++ b/app/services/staff_action_logger.rb @@ -57,19 +57,19 @@ class StaffActionLogger })) end - def log_user_ban(user, reason, opts={}) + def log_user_suspend(user, reason, opts={}) raise Discourse::InvalidParameters.new('user is nil') unless user UserHistory.create( params(opts).merge({ - action: UserHistory.actions[:ban_user], + action: UserHistory.actions[:suspend_user], target_user_id: user.id, details: reason })) end - def log_user_unban(user, opts={}) + def log_user_unsuspend(user, opts={}) raise Discourse::InvalidParameters.new('user is nil') unless user UserHistory.create( params(opts).merge({ - action: UserHistory.actions[:unban_user], + action: UserHistory.actions[:unsuspend_user], target_user_id: user.id })) end diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index cce34b0039d..8b816709fe4 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -1086,7 +1086,7 @@ cs: moderators: 'Moderátoři:' admins: 'Administrátoři:' blocked: 'Blokováno:' - banned: 'Zakázáno:' + suspended: 'Zakázáno:' private_messages_short: "SZ" private_messages_title: "Soukromé zprávy" @@ -1229,7 +1229,7 @@ cs: pending: "Čeká na schválení" admins: "Administrátoři" moderators: "Moderátoři" - banned: "Zakázaní" + suspended: "Zakázaní" blocked: "Blokovaní" approved: "Schválen?" approved_selected: @@ -1248,16 +1248,16 @@ cs: admins: 'Admininstrátoři' moderators: 'Moderátoři' blocked: 'Blokovaní uživatelé' - banned: "Zakázaní uživatelé" + suspended: "Zakázaní uživatelé" user: - ban_failed: "Nastala chyba při zakazování uživatele {{error}}" - unban_failed: "Nastala chyba při povolování uživatele {{error}}" - ban_duration: "Jak dlouho má zákaz platit? (dny)" + suspend_failed: "Nastala chyba při zakazování uživatele {{error}}" + unsuspend_failed: "Nastala chyba při povolování uživatele {{error}}" + suspend_duration: "Jak dlouho má zákaz platit? (dny)" delete_all_posts: "Smazat všechny příspěvky" - ban: "Zakázat" - unban: "Povolit" - banned: "Zakázán?" + suspend: "Zakázat" + unsuspend: "Povolit" + suspended: "Zakázán?" moderator: "Moderátor?" admin: "Administrátor?" blocked: "Zablokovaný?" diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index ab1e894c315..b347cd10ae0 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -791,13 +791,13 @@ da: other: "approve users ({{count}})" user: - ban_failed: "Something went wrong banning this user {{error}}" - unban_failed: "Something went wrong unbanning this user {{error}}" - ban_duration: "How long would you like to ban the user for? (days)" + suspend_failed: "Something went wrong banning this user {{error}}" + unsuspend_failed: "Something went wrong unbanning this user {{error}}" + suspend_duration: "How long would you like to ban the user for? (days)" delete_all_posts: "Delete all posts" - ban: "Ban" - unban: "Unban" - banned: "Banned?" + suspend: "Ban" + unsuspend: "Unban" + suspended: "Banned?" moderator: "Moderator?" admin: "Admin?" show_admin_profile: "Admin" diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 8fc524b39a3..744acb857cd 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -1074,7 +1074,7 @@ de: moderators: 'Moderatoren:' admins: 'Administratoren:' blocked: 'Gesperrt:' - banned: "Gebannt:" + suspended: "Gebannt:" private_messages_short: "PNs" private_messages_title: "Private Nachrichten" @@ -1251,7 +1251,7 @@ de: pending: "Unerledigt" admins: "Administratoren" moderators: "Moderatoren" - banned: "Gebannt" + suspended: "Gebannt" blocked: "Blockiert" approved: "Zugelassen?" approved_selected: @@ -1272,7 +1272,7 @@ de: admins: 'Administratoren' moderators: 'Moderatoren' blocked: 'Gesperrte Benutzer' - banned: "Gebannte Benutzer" + suspended: "Gebannte Benutzer" reject_successful: one: "Erfolgreich 1 Benutzer abgelehnt." other: "Erfolgreich %{count} Benutzer abgelehnt." @@ -1281,14 +1281,14 @@ de: other: "Konnte %{count} Benutzer nicht ablehnen." user: - ban_failed: "Beim Sperren dieses Benutzers ist etwas schief gegangen {{error}}" - unban_failed: "Beim Entsperren dieses Benutzers ist etwas schief gegangen {{error}}" - ban_duration: "Wie lange soll dieser Benutzer gesperrt werden? (Tage)" + suspend_failed: "Beim Sperren dieses Benutzers ist etwas schief gegangen {{error}}" + unsuspend_failed: "Beim Entsperren dieses Benutzers ist etwas schief gegangen {{error}}" + suspend_duration: "Wie lange soll dieser Benutzer gesperrt werden? (Tage)" delete_all_posts: "Lösche alle Beiträge" delete_all_posts_confirm: "Du löschst %{posts} Beiträge und %{topics} Themen. Bist du sicher?" - ban: "Sperren" - unban: "Entsperren" - banned: "Gesperrt?" + suspend: "Sperren" + unsuspend: "Entsperren" + suspended: "Gesperrt?" moderator: "Moderator?" admin: "Administrator?" blocked: "Geblockt?" diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index f21bf92fb27..aeb4c6f8df4 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1105,7 +1105,7 @@ en: moderators: 'Moderators:' admins: 'Admins:' blocked: 'Blocked:' - banned: 'Banned:' + suspended: 'Suspended:' private_messages_short: "PMs" private_messages_title: "Private Messages" @@ -1265,8 +1265,8 @@ en: change_site_setting: "change site setting" change_site_customization: "change site customization" delete_site_customization: "delete site customization" - ban_user: "ban user" - unban_user: "unban user" + suspend_user: "suspend user" + unsuspend_user: "unsuspend user" screened_emails: title: "Screened Emails" description: "When someone tries to create a new account, the following email addresses will be checked and the registration will be blocked, or some other action performed." @@ -1307,7 +1307,7 @@ en: pending: "Pending" admins: 'Admins' moderators: 'Mods' - banned: 'Banned' + suspended: 'Suspended' blocked: 'Blocked' approved: "Approved?" approved_selected: @@ -1328,7 +1328,7 @@ en: admins: 'Admin Users' moderators: 'Moderators' blocked: 'Blocked Users' - banned: 'Banned Users' + suspended: 'Suspended Users' reject_successful: one: "Successfully rejected 1 user." other: "Successfully rejected %{count} users." @@ -1337,18 +1337,18 @@ en: other: "Failed to reject %{count} users." user: - ban_failed: "Something went wrong banning this user {{error}}" - unban_failed: "Something went wrong unbanning this user {{error}}" - ban_duration: "How long would you like to ban the user for?" - ban_duration_units: "(days)" - ban_reason_label: "Why are you banning? When the user tries to log in, they will see this text. Keep it short." - ban_reason: "Reason for Ban" - banned_by: "Banned by" + suspend_failed: "Something went wrong suspending this user {{error}}" + unsuspend_failed: "Something went wrong unsuspending this user {{error}}" + suspend_duration: "How long would you like to suspend the user for?" + suspend_duration_units: "(days)" + suspend_reason_label: "Why are you suspending? When the user tries to log in, they will see this text. Keep it short." + suspend_reason: "Reason" + suspended_by: "Suspended by" delete_all_posts: "Delete all posts" delete_all_posts_confirm: "You are about to delete %{posts} posts and %{topics} topics. Are you sure?" - ban: "Ban" - unban: "Unban" - banned: "Banned?" + suspend: "Suspend" + unsuspend: "Unsuspend" + suspended: "Suspended?" moderator: "Moderator?" admin: "Admin?" blocked: "Blocked?" @@ -1400,10 +1400,10 @@ en: unblock_failed: 'There was a problem unblocking the user.' block_failed: 'There was a problem blocking the user.' deactivate_explanation: "A deactivated user must re-validate their email." - banned_explanation: "A banned user can't log in." + suspended_explanation: "A suspended user can't log in." block_explanation: "A blocked user can't post or start topics." trust_level_change_failed: "There was a problem changing the user's trust level." - ban_modal_title: "Ban User" + suspend_modal_title: "Suspend User" site_content: none: "Choose a type of content to begin editing." diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index 4e04aebfa3d..e4aae511fd0 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -891,13 +891,13 @@ es: other: "aprobar usuarios ({{count}})" user: - ban_failed: "Algo salió mal baneando este usuario {{error}}" - unban_failed: "Algo salió mal quitando ban a este usuario {{error}}" - ban_duration: "¿Cuánto tiempo le gustaría aplicar ban al usuario? (days)" + suspend_failed: "Algo salió mal baneando este usuario {{error}}" + unsuspend_failed: "Algo salió mal quitando ban a este usuario {{error}}" + suspend_duration: "¿Cuánto tiempo le gustaría aplicar ban al usuario? (days)" delete_all_posts: "Eliminar todos los mensajes" - ban: "Banear" - unban: "Quitar ban" - banned: "Baneado?" + suspend: "Banear" + unsuspend: "Quitar ban" + suspended: "Baneado?" moderator: "Moderador?" admin: "Administrador?" show_admin_profile: "Administrador" diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index 32a94c5bc3d..dc703668a3d 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -1055,7 +1055,7 @@ fr: moderators: 'Modérateurs :' admins: 'Administateurs :' blocked: 'Bloqués :' - banned: 'Banni :' + suspended: 'Banni :' private_messages_short: "MPs" private_messages_title: "Messages Privés" reports: @@ -1246,7 +1246,7 @@ fr: pending: "En attente" admins: 'Administrateurs' moderators: 'Modérateurs' - banned: 'Banni' + suspended: 'Banni' blocked: 'Bloqué' approved: "Approuvé ?" approved_selected: @@ -1267,7 +1267,7 @@ fr: admins: 'Administrateurs' moderators: 'Modérateurs' blocked: 'Utilisateurs bloqués' - banned: 'Utilisateurs bannis' + suspended: 'Utilisateurs bannis' reject_successful: one: "Utilisateur rejeté avec succès." other: "%{count} utilisateurs rejetés avec succès." @@ -1275,14 +1275,14 @@ fr: one: "Utilisateur dont le rejet a échoué." other: "%{count} utilisateurs dont le rejet a échoué." user: - ban_failed: "Il y a eu un problème pendant le bannissement de cet utilisateur {{error}}" - unban_failed: "Il y a eu un problème pendant le débannissement de cet utilisateur {{error}}" - ban_duration: "Pour combien de temps voulez-vous bannir cet utilisateur ? (jours)" + suspend_failed: "Il y a eu un problème pendant le bannissement de cet utilisateur {{error}}" + unsuspend_failed: "Il y a eu un problème pendant le débannissement de cet utilisateur {{error}}" + suspend_duration: "Pour combien de temps voulez-vous bannir cet utilisateur ? (jours)" delete_all_posts: "Supprimer tous les messages" delete_all_posts_confirm: "Vous allez supprimer supprimer %{posts} messages et %{topics} discussions. Êtes-vous sûr ?" - ban: "Bannir" - unban: "Débannir" - banned: "Banni ?" + suspend: "Bannir" + unsuspend: "Débannir" + suspended: "Banni ?" moderator: "Modérateur ?" admin: "Admin ?" blocked: "Bloqué ?" diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml index b2ccba06c58..d4ddf1da0c4 100644 --- a/config/locales/client.id.yml +++ b/config/locales/client.id.yml @@ -726,13 +726,13 @@ id: other: "approve users ({{count}})" user: - ban_failed: "Something went wrong banning this user {{error}}" - unban_failed: "Something went wrong unbanning this user {{error}}" - ban_duration: "How long would you like to ban the user for? (days)" + suspend_failed: "Something went wrong banning this user {{error}}" + unsuspend_failed: "Something went wrong unbanning this user {{error}}" + suspend_duration: "How long would you like to ban the user for? (days)" delete_all_posts: "Delete all posts" - ban: "Ban" - unban: "Unban" - banned: "Banned?" + suspend: "Ban" + unsuspend: "Unban" + suspended: "Banned?" moderator: "Moderator?" admin: "Admin?" show_admin_profile: "Admin" diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index b1749051409..a221d9a447e 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -1132,13 +1132,13 @@ it: moderators: 'Moderatori' user: - ban_failed: "Qualcosa è andato storto nel bannare questo utente {{error}}" - unban_failed: "Qualcosa è andato rimuovendo il ban a questo utente {{error}}" - ban_duration: "Per quanto tempo vuoi bannare l'utente? (giorni)" + suspend_failed: "Qualcosa è andato storto nel bannare questo utente {{error}}" + unsuspend_failed: "Qualcosa è andato rimuovendo il ban a questo utente {{error}}" + suspend_duration: "Per quanto tempo vuoi bannare l'utente? (giorni)" delete_all_posts: "Cancella tutti i post" - ban: "Ban" - unban: "Rimuovi Ban" - banned: "Bannato?" + suspend: "Ban" + unsuspend: "Rimuovi Ban" + suspended: "Bannato?" moderator: "Moderatore?" admin: "Amministratore?" show_admin_profile: "Amministratore" diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml index 22c46e30e6a..e6f46a7334a 100644 --- a/config/locales/client.ko.yml +++ b/config/locales/client.ko.yml @@ -1099,7 +1099,7 @@ ko: moderators: '중간 관리자:' admins: '운영자:' blocked: '블락됨:' - banned: '접근금지:' + suspended: '접근금지:' private_messages_short: "PMs" private_messages_title: "개인 메시지" @@ -1301,7 +1301,7 @@ ko: pending: "보류" admins: "운영자들" moderators: '중간 관리자들' - banned: '접근 금지' + suspended: '접근 금지' blocked: '블락됨' approved: "승인?" approved_selected: @@ -1322,7 +1322,7 @@ ko: admins: '운영자 사용자' moderators: '중간 관리자' blocked: '블락된 사용자들' - banned: '접근 금지된 사용자들' + suspended: '접근 금지된 사용자들' reject_successful: other: "성공적으로 1명의 사용자를 거절하였습니다." other: "성공적으로 ${count}명의 사용자를 거절하였습니다." @@ -1331,18 +1331,18 @@ ko: other: "%{count}명의 사용자를 거절하는데 실패했습니다." user: - ban_failed: "이 사용자를 접근 금지하는데 오류 발생 {{error}}" - unban_failed: "이 사용자를 접근 허용 하는데 오류 발생 {{error}}" - ban_duration: "사용자를 몇일 접근 금지 하시겠습니까?" + suspend_failed: "이 사용자를 접근 금지하는데 오류 발생 {{error}}" + unsuspend_failed: "이 사용자를 접근 허용 하는데 오류 발생 {{error}}" + suspend_duration: "사용자를 몇일 접근 금지 하시겠습니까?" ban_duration_units: "(일)" ban_reason_label: "왜 접근 금지 합니까? 사용자가 로그인을 시도하면 그들은 이 메시지를 보게 됩니다." ban_reason: "접근 금지 이유" banned_by: "접근 금지자" delete_all_posts: "모든 글을 삭제합니다" delete_all_posts_confirm: "당신은 %{posts} 개의 게시글과 %{topics} 개의 토픽를 삭제합니다. 확실합니까?" - ban: "접근 금지" - unban: "접근 허용" - banned: "접근 금지?" + suspend: "접근 금지" + unsuspend: "접근 허용" + suspended: "접근 금지?" moderator: "중간 관리자?" admin: "운영자?" blocked: "블락" diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml index a18da7acb51..07ae04b6301 100644 --- a/config/locales/client.nb_NO.yml +++ b/config/locales/client.nb_NO.yml @@ -1045,13 +1045,13 @@ nb_NO: moderators: 'Moderatorer' user: - ban_failed: "Noe gikk galt ved å bannlyse denne brukeren {{error}}" - unban_failed: "Noe gikk galt ved å gjeninsette denne brukeren {{error}}" - ban_duration: "Hvor lenge vil du bannlyse denne brukeren? (dager)" + suspend_failed: "Noe gikk galt ved å bannlyse denne brukeren {{error}}" + unsuspend_failed: "Noe gikk galt ved å gjeninsette denne brukeren {{error}}" + suspend_duration: "Hvor lenge vil du bannlyse denne brukeren? (dager)" delete_all_posts: "Slett alle innlegg" - ban: "Bannlyst" - unban: Gjeninnsett" - banned: "Banlyst?" + suspend: "Bannlyst" + unsuspend: Gjeninnsett" + suspended: "Banlyst?" moderator: "Moderator?" admin: "Admin?" show_admin_profile: "Admin" diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 6da8a354acd..d61fdc9655b 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -1103,7 +1103,7 @@ nl: moderators: "Moderators:" admins: "Admins:" blocked: "Geblokkeerd:" - banned: "Geband:" + suspended: "Geband:" private_messages_short: PBs private_messages_title: Privé-berichten @@ -1304,7 +1304,7 @@ nl: pending: Te beoordelen admins: Admins moderators: Moderatoren - banned: Verbannen + suspended: Verbannen blocked: Geblokt approved: Goedgekeurd? approved_selected: @@ -1325,7 +1325,7 @@ nl: admins: Administrators moderators: Moderators blocked: Geblokkeerde leden - banned: Verbannen leden + suspended: Verbannen leden reject_successful: one: "1 Gebruiker met succes geweigerd" other: "%{count} Gebruikers met succes geweigerd" @@ -1334,18 +1334,18 @@ nl: other: "Weigering van %{count} gebruikers is niet gelukt" user: - ban_failed: "Er ging iets fout met het blokkeren van deze gebruiker: {{error}}" - unban_failed: "Er ging iets fout bij het deblokkeren van deze gebruiker: {{error}}" - ban_duration: "Hoe lang wil je deze gebruiker blokkeren?" + suspend_failed: "Er ging iets fout met het blokkeren van deze gebruiker: {{error}}" + unsuspend_failed: "Er ging iets fout bij het deblokkeren van deze gebruiker: {{error}}" + suspend_duration: "Hoe lang wil je deze gebruiker blokkeren?" ban_duretion_units: (dagen) ban_reason_label: "Waarom ban je? Als de gebruiker in probeert te loggen, zullen ze deze tekst zien. Hou het kort." ban_reason: Reden voor ban banned_by: Verbannen door delete_all_posts: Verwijder alle berichten delete_all_posts_confirm: "Je gaat %{posts} en %{topics} verwijderen. Zeker weten?" - ban: Blokkeer - unban: Deblokkeer - banned: Geblokkeerd? + suspend: Blokkeer + unsuspend: Deblokkeer + suspended: Geblokkeerd? moderator: Moderator? admin: Beheerder? blocked: Geblokkeerd? diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml index 172a7f31266..0c661045e95 100644 --- a/config/locales/client.pseudo.yml +++ b/config/locales/client.pseudo.yml @@ -990,7 +990,7 @@ pseudo: moderators: '[[ Ϻóďéřáťóřš: ]]' admins: '[[ Áďɱíɳš: ]]' blocked: '[[ Ɓłóčǩéď: ]]' - banned: '[[ Ɓáɳɳéď: ]]' + suspended: '[[ Ɓáɳɳéď: ]]' private_messages_short: '[[ РϺš ]]' private_messages_title: '[[ Рříνáťé Ϻéššáǧéš ]]' reports: @@ -1121,7 +1121,7 @@ pseudo: pending: '[[ Рéɳďíɳǧ ]]' admins: '[[ Áďɱíɳš ]]' moderators: '[[ Ϻóďš ]]' - banned: '[[ Ɓáɳɳéď ]]' + suspended: '[[ Ɓáɳɳéď ]]' blocked: '[[ Ɓłóčǩéď ]]' approved: '[[ Áƿƿřóνéď? ]]' approved_selected: @@ -1139,15 +1139,15 @@ pseudo: admins: '[[ Áďɱíɳ Ůšéřš ]]' moderators: '[[ Ϻóďéřáťóřš ]]' blocked: '[[ Ɓłóčǩéď Ůšéřš ]]' - banned: '[[ Ɓáɳɳéď Ůšéřš ]]' + suspended: '[[ Ɓáɳɳéď Ůšéřš ]]' user: - ban_failed: '[[ Šóɱéťĥíɳǧ ŵéɳť ŵřóɳǧ ƀáɳɳíɳǧ ťĥíš ůšéř {{error}} ]]' - unban_failed: '[[ Šóɱéťĥíɳǧ ŵéɳť ŵřóɳǧ ůɳƀáɳɳíɳǧ ťĥíš ůšéř {{error}} ]]' - ban_duration: '[[ Ĥóŵ łóɳǧ ŵóůłď ýóů łíǩé ťó ƀáɳ ťĥé ůšéř ƒóř? (ďáýš) ]]' + suspend_failed: '[[ Šóɱéťĥíɳǧ ŵéɳť ŵřóɳǧ ƀáɳɳíɳǧ ťĥíš ůšéř {{error}} ]]' + unsuspend_failed: '[[ Šóɱéťĥíɳǧ ŵéɳť ŵřóɳǧ ůɳƀáɳɳíɳǧ ťĥíš ůšéř {{error}} ]]' + suspend_duration: '[[ Ĥóŵ łóɳǧ ŵóůłď ýóů łíǩé ťó ƀáɳ ťĥé ůšéř ƒóř? (ďáýš) ]]' delete_all_posts: '[[ Ďéłéťé áłł ƿóšťš ]]' - ban: '[[ Ɓáɳ ]]' - unban: '[[ Ůɳƀáɳ ]]' - banned: '[[ Ɓáɳɳéď? ]]' + suspend: '[[ Ɓáɳ ]]' + unsuspend: '[[ Ůɳƀáɳ ]]' + suspended: '[[ Ɓáɳɳéď? ]]' moderator: '[[ Ϻóďéřáťóř? ]]' admin: '[[ Áďɱíɳ? ]]' blocked: '[[ Ɓłóčǩéď? ]]' diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml index c6a2179cb07..472570f24f3 100644 --- a/config/locales/client.pt.yml +++ b/config/locales/client.pt.yml @@ -682,13 +682,13 @@ pt: other: "aprovar utilizadores ({{count}})" user: - ban_failed: "Algo correu mal ao banir este utilizador {{error}}" - unban_failed: "Algo não correu bem ao desbanir este utilizador {{error}}" - ban_duration: "Por quanto tempo gostarias de banir a pessoa? (dias)" + suspend_failed: "Algo correu mal ao banir este utilizador {{error}}" + unsuspend_failed: "Algo não correu bem ao desbanir este utilizador {{error}}" + suspend_duration: "Por quanto tempo gostarias de banir a pessoa? (dias)" delete_all_posts: "Apagar todos os posts" - ban: "Banir" - unban: "Desbanir" - banned: "Banido?" + suspend: "Banir" + unsuspend: "Desbanir" + suspended: "Banido?" moderator: "Moderador?" admin: "Admin?" show_admin_profile: "Admin" diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml index 3b0e986d506..5a673ba6c36 100644 --- a/config/locales/client.pt_BR.yml +++ b/config/locales/client.pt_BR.yml @@ -1094,7 +1094,7 @@ pt_BR: moderators: 'Moderadores:' admins: 'Admins:' blocked: 'Bloqueado:' - banned: 'Banido:' + suspended: 'Banido:' private_messages_short: "MPs" private_messages_title: "Mensagens Particulares" @@ -1273,7 +1273,7 @@ pt_BR: pending: "Pendentes" admins: 'Administradores' moderators: 'Moderadores' - banned: 'Banidos' + suspended: 'Banidos' blocked: 'Bloqueados' approved: "Aprovado?" approved_selected: @@ -1294,7 +1294,7 @@ pt_BR: admins: 'Usuários Administradores' moderators: 'Moderadores' blocked: 'Usuários Boqueados' - banned: 'Usuários Banidos' + suspended: 'Usuários Banidos' reject_successful: one: "1 usuário rejeitado com sucesso." other: "%{count} usuários rejeitados com sucesso" @@ -1303,14 +1303,14 @@ pt_BR: other: "Falha ao rejeitar %{count} usuários." user: - ban_failed: "Ocorreu um erro ao banir este usuário {{error}}" - unban_failed: "Ocorreu um erro ao desbanir este usuário {{error}}" - ban_duration: "Por quanto tempo gostaria de banir a pessoa? (dias)" + suspend_failed: "Ocorreu um erro ao banir este usuário {{error}}" + unsuspend_failed: "Ocorreu um erro ao desbanir este usuário {{error}}" + suspend_duration: "Por quanto tempo gostaria de banir a pessoa? (dias)" delete_all_posts: "Apagar todas postagens" delete_all_posts_confirm: "Você irá deletar %{posts} posts e %{topics} tópicos. Tem certeza?" - ban: "Banir" - unban: "Desbanir" - banned: "Banido?" + suspend: "Banir" + unsuspend: "Desbanir" + suspended: "Banido?" moderator: "Moderador?" admin: "Admin?" blocked: "Bloqueado?" diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml index 406c9ab2953..b3e9474cc62 100644 --- a/config/locales/client.ru.yml +++ b/config/locales/client.ru.yml @@ -1108,7 +1108,7 @@ ru: moderators: 'Модераторы:' admins: 'Администраторы:' blocked: 'Заблокированы:' - banned: 'Забанены:' + suspended: 'Забанены:' private_messages_short: ЛС private_messages_title: 'Личные сообщения' reports: @@ -1304,7 +1304,7 @@ ru: pending: Ожидает одобрения admins: Администраторы moderators: Модераторы - banned: Забаненые + suspended: Забаненые blocked: Заблокированные approved: 'Подтвердить?' approved_selected: @@ -1329,7 +1329,7 @@ ru: admins: 'Администраторы' moderators: Модераторы blocked: 'Заблокированные пользователи' - banned: 'Забаненые пользователи' + suspended: 'Забаненые пользователи' reject_successful: one: 'Отказано одному пользователю.' other: 'Отказано %{count} пользователей.' @@ -1341,14 +1341,14 @@ ru: few: 'Ошибка отказа %{count} пользователям.' many: 'Ошибка отказа %{count} пользователям.' user: - ban_failed: 'Ошибка при наложении бана {{error}}' - unban_failed: 'Ошибка при снятии бана {{error}}' - ban_duration: 'Насколько вы хотите забанить пользователя? (в днях)' + suspend_failed: 'Ошибка при наложении бана {{error}}' + unsuspend_failed: 'Ошибка при снятии бана {{error}}' + suspend_duration: 'Насколько вы хотите забанить пользователя? (в днях)' delete_all_posts: 'Удалить все сообщения' delete_all_posts_confirm: 'Вы собираетесь удалить %{posts} сообщений и %{topics} тем. Вы уверены?' - ban: Забанить - unban: Разбанить - banned: 'Забанен?' + suspend: Забанить + unsuspend: Разбанить + suspended: 'Забанен?' moderator: 'Модератор?' admin: 'Администратор?' blocked: 'Заблокирован?' diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index 2fedf9af4a5..47d756e8bdc 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -900,13 +900,13 @@ sv: other: "godkänd användare ({{count}})" user: - ban_failed: "Någonting gick fel under avstängningen av denna användare {{error}}" - unban_failed: "Någonting gick fel under upplåsningen av denna användare {{error}}" - ban_duration: "Hur länge vill du stänga av denna användare? (dagar)" + suspend_failed: "Någonting gick fel under avstängningen av denna användare {{error}}" + unsuspend_failed: "Någonting gick fel under upplåsningen av denna användare {{error}}" + suspend_duration: "Hur länge vill du stänga av denna användare? (dagar)" delete_all_posts: "Radera alla inlägg" - ban: "Stäng av" - unban: "Lås upp" - banned: "Avstängd?" + suspend: "Stäng av" + unsuspend: "Lås upp" + suspended: "Avstängd?" moderator: "Moderator?" admin: "Administratör?" show_admin_profile: "Administratör" diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index 8b133f2302e..153e74ae8f1 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -1105,7 +1105,7 @@ zh_CN: moderators: '版主:' admins: '管理员:' blocked: '禁止参与讨论:' - banned: "禁止登录" + suspended: "禁止登录" private_messages_short: "私信" private_messages_title: "私密信息" @@ -1307,7 +1307,7 @@ zh_CN: pending: "待定" admins: "管理员" moderators: "版主" - banned: "禁止登录" + suspended: "禁止登录" blocked: "禁止参与讨论" approved: "已批准?" approved_selected: @@ -1328,7 +1328,7 @@ zh_CN: admins: '管理员' moderators: '版主' blocked: '被封用户' - banned: '被禁用户' + suspended: '被禁用户' reject_successful: one: "1名用户已被拒绝。" other: "%{count}名用户已被拒绝。" @@ -1337,18 +1337,18 @@ zh_CN: other: "%{count}名用户决绝失败。" user: - ban_failed: "禁止此用户时发生了错误 {{error}}" - unban_failed: "解禁此用户时发生了错误 {{error}}" - ban_duration: "你计划禁止该用户多久?" + suspend_failed: "禁止此用户时发生了错误 {{error}}" + unsuspend_failed: "解禁此用户时发生了错误 {{error}}" + suspend_duration: "你计划禁止该用户多久?" ban_duration_units: "(天)" ban_reason_label: "为什么禁止该用户?当其尝试登入时,会看到这条理由。" ban_reason: "禁止的理由" banned_by: "禁止操作者:" delete_all_posts: "删除所有帖子" delete_all_posts_confirm: "你将删除 %{posts} 个帖子和 %{topics} 个主题,确认吗?" - ban: "禁止" - unban: "解禁" - banned: "已禁止?" + suspend: "禁止" + unsuspend: "解禁" + suspended: "已禁止?" moderator: "版主?" admin: "管理员?" blocked: "已封?" diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 7d913a2040f..beb78a0d6ed 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -992,7 +992,7 @@ zh_TW: moderators: '版主:' admins: '管理員:' blocked: '已封鎖:' - banned: '已禁止:' + suspended: '已禁止:' private_messages_short: "私信" private_messages_title: "私密信息" @@ -1152,7 +1152,7 @@ zh_TW: pending: "待定" admins: '管理員' moderators: '版主' - banned: '已禁止' + suspended: '已禁止' blocked: '已封鎖' approved: "已批准?" approved_selected: @@ -1169,17 +1169,17 @@ zh_TW: elder: '信用等級爲4的用戶(年長用戶)' admins: '管理員' moderators: '版主' - banned: '已禁止的用戶' + suspended: '已禁止的用戶' blocked: '已封鎖的用戶' user: - ban_failed: "禁止此用戶時發生了錯誤 {{error}}" - unban_failed: "解禁此用戶時發生了錯誤 {{error}}" - ban_duration: "你計劃禁止該用戶多久?(天)" + suspend_failed: "禁止此用戶時發生了錯誤 {{error}}" + unsuspend_failed: "解禁此用戶時發生了錯誤 {{error}}" + suspend_duration: "你計劃禁止該用戶多久?(天)" delete_all_posts: "刪除所有帖子" - ban: "禁止" - unban: "解禁" - banned: "已禁止?" + suspend: "禁止" + unsuspend: "解禁" + suspended: "已禁止?" moderator: "版主?" admin: "管理員?" show_admin_profile: "管理員" diff --git a/config/locales/server.cs.yml b/config/locales/server.cs.yml index b8a6648dbd4..27acfacf737 100644 --- a/config/locales/server.cs.yml +++ b/config/locales/server.cs.yml @@ -743,7 +743,7 @@ cs: active: "Váš účet je aktivní a připraven k používání." activate_email: "Už to skoro bude! Zaslali jsme vám aktivační email na %{email}. Prosím následujte instrukce v tomto emailu a aktivujte si tak svůj účet." not_activated: "Ještě se nemůžete přihlásit. Zaslali jsme vám aktivační email na %{email}. Prosím následujte instrukce v tomto emailu a aktivujte si tak svůj účet." - banned: "Máte zakázáno přihlášení až do %{date}." + suspended: "Máte zakázáno přihlášení až do %{date}." errors: "%{errors}" not_available: "Není k dispozici. Nechcete zkusit %{suggestion}?" something_already_taken: "Nastala chyba při zpracování, zřejmě je dané uživatelské jméno nebo email již zaregistrován. Zkuste odkaz pro obnovení hesla." diff --git a/config/locales/server.de.yml b/config/locales/server.de.yml index 888cf2bb8d1..c4b5515c13c 100644 --- a/config/locales/server.de.yml +++ b/config/locales/server.de.yml @@ -718,7 +718,7 @@ de: active: "Dein Konto ist nun freigeschaltet und einsatzbereit." activate_email: "Fast fertig! Wir haben eine Aktivierungsmail an %{email} verschickt. Bitte folge den Anweisungen in der Mail, um Dein Konto zu aktivieren." not_activated: "Du kannst Dich noch nicht anmelden. Wir haben Dir eine Aktivierungsmail geschickt. Bitte folge zunächst den Anweisungen aus der Mail, um Dein Konto zu aktivieren." - banned: "Du kannst dich bis am %{date} nicht mehr anmelden." + suspended: "Du kannst dich bis am %{date} nicht mehr anmelden." errors: "%{errors}" not_available: " Nicht verfügbar. Versuche %{suggestion}?" something_already_taken: "Etwas ist schief gelaufen. Möglicherweise ist der Benutzername bereits registriert. Probiere den 'Passwort vergessen'-Link." diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 016ebc88117..c221e473cd5 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -778,8 +778,8 @@ en: active: "Your account is activated and ready to use." activate_email: "You're almost done! We sent an activation email to %{email}. Please follow the instructions in the email to activate your account." not_activated: "You can't log in yet. We sent an activation email to you. Please follow the instructions in the email to activate your account." - banned: "You can't log in until %{date}." - banned_with_reason: "You can't log in until %{date}. The reason you were banned: %{reason}" + suspended: "You can't log in until %{date}." + suspended_with_reason: "You can't log in until %{date}. The reason you were suspended: %{reason}" errors: "%{errors}" not_available: "Not available. Try %{suggestion}?" something_already_taken: "Something went wrong, perhaps the username or email is already registered. Try the forgot password link." diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml index 8fdea424925..a092bb1c60c 100644 --- a/config/locales/server.fr.yml +++ b/config/locales/server.fr.yml @@ -675,7 +675,7 @@ fr: active: "Votre compte est activé et prêt à l'emploi." activate_email: "Vous avez presque fini ! Un mail de confirmation a été envoyé à %{email}. Suivez les instructions pour activer votre compte." not_activated: "Vous ne pouvez pas vous connecter pour le moment. Nous vous avons envoyé un mail d'activation. Merci de suivre les instructions qui y sont contenues pour activer votre compte." - banned: "Vous ne pouvez pas vous connecter jusqu'au %{date}." + suspended: "Vous ne pouvez pas vous connecter jusqu'au %{date}." errors: "%{errors}" not_available: "Pas disponible. Essayez %{suggestion} ?" something_already_taken: "Quelque chose s'est mal passé. Peut-être que votre nom d'utilisateur ou adresse email est déjà enregistré ? Essayez le lien : j'ai oublié mon mot de passe." diff --git a/config/locales/server.nl.yml b/config/locales/server.nl.yml index 99d860334a8..134f9c20571 100644 --- a/config/locales/server.nl.yml +++ b/config/locales/server.nl.yml @@ -779,7 +779,7 @@ nl: active: "Je account is actief en klaar voor gebruik!" activate_email: "Je bent er bijna! We hebben een activatiemail verstuurd naar %{email}. Volg de instructies in de mail om je account te activeren." not_activated: "Je kan nog niet inloggen. We hebben je een activatiemail gestuurd. Volg de instructies in de mail om je account te activeren." - banned: "Je kan tot %{date} niet inloggen." + suspended: "Je kan tot %{date} niet inloggen." banned_with_reason: "Je kan tot %{date} niet inloggen. Je hebt een ban om de volgende reden: %{reden}" errors: "%{errors}" not_available: "Niet beschikbaar. Probeer %{suggestion}?" diff --git a/config/locales/server.pseudo.yml b/config/locales/server.pseudo.yml index 521b3e10c81..bd168006ff5 100644 --- a/config/locales/server.pseudo.yml +++ b/config/locales/server.pseudo.yml @@ -859,7 +859,7 @@ pseudo: Рłéášé ƒółłóŵ ťĥé íɳšťřůčťíóɳš íɳ ťĥé éɱáíł ťó áčťíνáťé ýóůř áččóůɳť. ]]' not_activated: '[[ Ýóů čáɳ''ť łóǧ íɳ ýéť. Ŵé šéɳť áɳ áčťíνáťíóɳ éɱáíł ťó ýóů. Рłéášé ƒółłóŵ ťĥé íɳšťřůčťíóɳš íɳ ťĥé éɱáíł ťó áčťíνáťé ýóůř áččóůɳť. ]]' - banned: '[[ Ýóů čáɳ''ť łóǧ íɳ ůɳťíł %{date}. ]]' + suspended: '[[ Ýóů čáɳ''ť łóǧ íɳ ůɳťíł %{date}. ]]' errors: '[[ %{errors} ]]' not_available: '[[ Ѝóť áνáíłáƀłé. Ťřý %{suggestion}? ]]' something_already_taken: '[[ Šóɱéťĥíɳǧ ŵéɳť ŵřóɳǧ, ƿéřĥáƿš ťĥé ůšéřɳáɱé óř éɱáíł diff --git a/config/locales/server.pt_BR.yml b/config/locales/server.pt_BR.yml index 28f026a1871..8e9babff4aa 100644 --- a/config/locales/server.pt_BR.yml +++ b/config/locales/server.pt_BR.yml @@ -765,7 +765,7 @@ pt_BR: active: "A sua conta está ativa e pronta." activate_email: "Estamos quase prontos! Enviamos um email de ativação para %{email}. Por favor siga as instruções no email para ativar a sua conta." not_activated: "Ainda não podes fazer log in. Enviamos um email de ativação para você. Por favor siga as instruções no email para ativar a sua conta." - banned: "Você não pode entrar antes de %{date}." + suspended: "Você não pode entrar antes de %{date}." errors: "%{errors}" not_available: "Não disponível. Tente %{suggestion}?" something_already_taken: "Algo deu errado, talvez o nome de usuário ou o email já estejam registrados. Tente o link Esqueci minha Senha." diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml index 52f7e6ec5fd..003a56399ee 100644 --- a/config/locales/server.ru.yml +++ b/config/locales/server.ru.yml @@ -717,7 +717,7 @@ ru: active: 'Ваша учетная запись активирована и готова к использованию.' activate_email: 'Почти готово! Мы послали письмо с инструкциями по активации учетной записи на %{email}.' not_activated: 'Вы пока что не можете войти на сайт. Пожалуйста, следуйте инструкциям по активации учетной записи, которые мы отправили вам по электронной почтой.' - banned: 'Вы не можете войти до %{date}.' + suspended: 'Вы не можете войти до %{date}.' errors: '%{errors}' not_available: 'Недоступно. Попробуйте %{suggestion}?' something_already_taken: 'Что-то пошло не так, возможно, имя пользователя или электронный ящик уже используются. Попробуйте восстановить ваш пароль.' diff --git a/config/routes.rb b/config/routes.rb index d99aa0f3e27..3b578152cc9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -38,9 +38,9 @@ Discourse::Application.routes.draw do put 'approve-bulk' => 'users#approve_bulk' delete 'reject-bulk' => 'users#reject_bulk' end - put 'ban' + put 'suspend' put 'delete_all_posts' - put 'unban' + put 'unsuspend' put 'revoke_admin', constraints: AdminConstraint.new put 'grant_admin', constraints: AdminConstraint.new post 'generate_api_key', constraints: AdminConstraint.new diff --git a/db/migrate/20131107154900_rename_banned_to_suspended.rb b/db/migrate/20131107154900_rename_banned_to_suspended.rb new file mode 100644 index 00000000000..bf797b1fd5b --- /dev/null +++ b/db/migrate/20131107154900_rename_banned_to_suspended.rb @@ -0,0 +1,6 @@ +class RenameBannedToSuspended < ActiveRecord::Migration + def change + rename_column :users, :banned_at, :suspended_at + rename_column :users, :banned_till, :suspended_till + end +end diff --git a/lib/admin_user_index_query.rb b/lib/admin_user_index_query.rb index cf3c6e3e4db..985804b1a0c 100644 --- a/lib/admin_user_index_query.rb +++ b/lib/admin_user_index_query.rb @@ -29,8 +29,8 @@ class AdminUserIndexQuery when 'admins' then @query.where('admin = ?', true) when 'moderators' then @query.where('moderator = ?', true) when 'blocked' then @query.blocked - when 'banned' then @query.banned - when 'pending' then @query.not_banned.where('approved = false') + when 'suspended' then @query.suspended + when 'pending' then @query.not_suspended.where('approved = false') end end diff --git a/lib/auth/default_current_user_provider.rb b/lib/auth/default_current_user_provider.rb index 14341fcccb0..0f047da6a42 100644 --- a/lib/auth/default_current_user_provider.rb +++ b/lib/auth/default_current_user_provider.rb @@ -26,7 +26,7 @@ class Auth::DefaultCurrentUserProvider current_user = User.where(auth_token: auth_token).first end - if current_user && current_user.is_banned? + if current_user && current_user.suspended? current_user = nil end diff --git a/lib/guardian.rb b/lib/guardian.rb index 040b4086c53..0d1806ebe45 100644 --- a/lib/guardian.rb +++ b/lib/guardian.rb @@ -115,10 +115,10 @@ class Guardian end alias :can_activate? :can_approve? - def can_ban?(user) + def can_suspend?(user) user && is_staff? && user.regular? end - alias :can_deactivate? :can_ban? + alias :can_deactivate? :can_suspend? def can_clear_flags?(post) is_staff? && post diff --git a/spec/components/admin_user_index_query_spec.rb b/spec/components/admin_user_index_query_spec.rb index f5b16bec55a..fc312173f29 100644 --- a/spec/components/admin_user_index_query_spec.rb +++ b/spec/components/admin_user_index_query_spec.rb @@ -51,9 +51,9 @@ describe AdminUserIndexQuery do expect(query.find_users.count).to eq(1) end - context 'and a banned pending user' do - let!(:banned_user) { Fabricate(:user, approved: false, banned_at: 1.hour.ago, banned_till: 20.years.from_now) } - it "doesn't return the banned user" do + context 'and a suspended pending user' do + let!(:suspended_user) { Fabricate(:user, approved: false, suspended_at: 1.hour.ago, suspended_till: 20.years.from_now) } + it "doesn't return the suspended user" do query = ::AdminUserIndexQuery.new({ query: 'pending' }) expect(query.find_users.count).to eq(1) end diff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rb index 7071afac08d..c4df3852b4f 100644 --- a/spec/components/guardian_spec.rb +++ b/spec/components/guardian_spec.rb @@ -802,21 +802,21 @@ describe Guardian do end - context 'can_ban?' do - it 'returns false when a user tries to ban another user' do - Guardian.new(user).can_ban?(coding_horror).should be_false + context 'can_suspend?' do + it 'returns false when a user tries to suspend another user' do + Guardian.new(user).can_suspend?(coding_horror).should be_false end - it 'returns true when an admin tries to ban another user' do - Guardian.new(admin).can_ban?(coding_horror).should be_true + it 'returns true when an admin tries to suspend another user' do + Guardian.new(admin).can_suspend?(coding_horror).should be_true end - it 'returns true when a moderator tries to ban another user' do - Guardian.new(moderator).can_ban?(coding_horror).should be_true + it 'returns true when a moderator tries to suspend another user' do + Guardian.new(moderator).can_suspend?(coding_horror).should be_true end - it 'returns false when staff tries to ban staff' do - Guardian.new(admin).can_ban?(moderator).should be_false + it 'returns false when staff tries to suspend staff' do + Guardian.new(admin).can_suspend?(moderator).should be_false end end diff --git a/spec/controllers/session_controller_spec.rb b/spec/controllers/session_controller_spec.rb index 810accb48ce..98775b04325 100644 --- a/spec/controllers/session_controller_spec.rb +++ b/spec/controllers/session_controller_spec.rb @@ -23,10 +23,10 @@ describe SessionController do end end - describe 'banned user' do + describe 'suspended user' do it 'should return an error' do - User.any_instance.stubs(:is_banned?).returns(true) - User.any_instance.stubs(:banned_till).returns(2.days.from_now) + User.any_instance.stubs(:suspended?).returns(true) + User.any_instance.stubs(:suspended_till).returns(2.days.from_now) xhr :post, :create, login: user.username, password: 'myawesomepassword' ::JSON.parse(response.body)['error'].should be_present end diff --git a/spec/jobs/user_email_spec.rb b/spec/jobs/user_email_spec.rb index f149ae7a8f9..7dc726d136f 100644 --- a/spec/jobs/user_email_spec.rb +++ b/spec/jobs/user_email_spec.rb @@ -8,7 +8,7 @@ describe Jobs::UserEmail do end let(:user) { Fabricate(:user, last_seen_at: 11.minutes.ago ) } - let(:banned) { Fabricate(:user, last_seen_at: 10.minutes.ago, banned_at: 5.minutes.ago, banned_till: 7.days.from_now ) } + let(:suspended) { Fabricate(:user, last_seen_at: 10.minutes.ago, suspended_at: 5.minutes.ago, suspended_till: 7.days.from_now ) } let(:mailer) { Mail::Message.new(to: user.email) } it "raises an error when there is no user" do @@ -83,17 +83,17 @@ describe Jobs::UserEmail do Jobs::UserEmail.new.execute(type: :private_message, user_id: user.id, post_id: post.id) end - context 'user is banned' do + context 'user is suspended' do it "doesn't send email for a pm from a regular user" do Email::Sender.any_instance.expects(:send).never - Jobs::UserEmail.new.execute(type: :private_message, user_id: banned.id, post_id: post.id) + Jobs::UserEmail.new.execute(type: :private_message, user_id: suspended.id, post_id: post.id) end it "doesn't send email for a pm from a staff user" do pm_from_staff = Fabricate(:post, user: Fabricate(:moderator)) - pm_from_staff.topic.topic_allowed_users.create!(user_id: banned.id) + pm_from_staff.topic.topic_allowed_users.create!(user_id: suspended.id) Email::Sender.any_instance.expects(:send).never - Jobs::UserEmail.new.execute(type: :private_message, user_id: banned.id, post_id: pm_from_staff.id) + Jobs::UserEmail.new.execute(type: :private_message, user_id: suspended.id, post_id: pm_from_staff.id) end end end @@ -121,28 +121,28 @@ describe Jobs::UserEmail do Jobs::UserEmail.new.execute(type: :user_mentioned, user_id: user.id, notification_id: notification.id) end - context 'user is banned' do + context 'user is suspended' do it "doesn't send email for a pm from a regular user" do Email::Sender.any_instance.expects(:send).never - Jobs::UserEmail.new.execute(type: :user_private_message, user_id: banned.id, notification_id: notification.id) + Jobs::UserEmail.new.execute(type: :user_private_message, user_id: suspended.id, notification_id: notification.id) end context 'pm from staff' do before do @pm_from_staff = Fabricate(:post, user: Fabricate(:moderator)) - @pm_from_staff.topic.topic_allowed_users.create!(user_id: banned.id) - @pm_notification = Fabricate(:notification, user: banned, topic: @pm_from_staff.topic, post_number: @pm_from_staff.post_number) - UserNotifications.expects(:user_private_message).with(banned, notification: @pm_notification, post: @pm_from_staff).returns(mailer) + @pm_from_staff.topic.topic_allowed_users.create!(user_id: suspended.id) + @pm_notification = Fabricate(:notification, user: suspended, topic: @pm_from_staff.topic, post_number: @pm_from_staff.post_number) + UserNotifications.expects(:user_private_message).with(suspended, notification: @pm_notification, post: @pm_from_staff).returns(mailer) end - subject(:execute_user_email_job) { Jobs::UserEmail.new.execute(type: :user_private_message, user_id: banned.id, notification_id: @pm_notification.id) } + subject(:execute_user_email_job) { Jobs::UserEmail.new.execute(type: :user_private_message, user_id: suspended.id, notification_id: @pm_notification.id) } it "sends an email" do execute_user_email_job end it "sends an email even if user was last seen recently" do - banned.update_column(:last_seen_at, 1.minute.ago) + suspended.update_column(:last_seen_at, 1.minute.ago) execute_user_email_job end end diff --git a/spec/services/staff_action_logger_spec.rb b/spec/services/staff_action_logger_spec.rb index feadc73099c..71c26d3dd5d 100644 --- a/spec/services/staff_action_logger_spec.rb +++ b/spec/services/staff_action_logger_spec.rb @@ -116,36 +116,36 @@ describe StaffActionLogger do end end - describe "log_user_ban" do + describe "log_user_suspend" do let(:user) { Fabricate(:user) } it "raises an error when arguments are missing" do - expect { logger.log_user_ban(nil, nil) }.to raise_error(Discourse::InvalidParameters) - expect { logger.log_user_ban(nil, "He was bad.") }.to raise_error(Discourse::InvalidParameters) + expect { logger.log_user_suspend(nil, nil) }.to raise_error(Discourse::InvalidParameters) + expect { logger.log_user_suspend(nil, "He was bad.") }.to raise_error(Discourse::InvalidParameters) end it "reason arg is optional" do - expect { logger.log_user_ban(user, nil) }.to_not raise_error + expect { logger.log_user_suspend(user, nil) }.to_not raise_error end it "creates a new UserHistory record" do reason = "He was a big meanie." - log_record = logger.log_user_ban(user, reason) + log_record = logger.log_user_suspend(user, reason) log_record.should be_valid log_record.details.should == reason log_record.target_user.should == user end end - describe "log_user_unban" do - let(:user) { Fabricate(:user, banned_at: 1.day.ago, banned_till: 7.days.from_now) } + describe "log_user_unsuspend" do + let(:user) { Fabricate(:user, suspended_at: 1.day.ago, suspended_till: 7.days.from_now) } it "raises an error when argument is missing" do - expect { logger.log_user_unban(nil) }.to raise_error(Discourse::InvalidParameters) + expect { logger.log_user_unsuspend(nil) }.to raise_error(Discourse::InvalidParameters) end it "creates a new UserHistory record" do - log_record = logger.log_user_unban(user) + log_record = logger.log_user_unsuspend(user) log_record.should be_valid log_record.target_user.should == user end