From f19d36cbba1d7f9ea0479ae14a278deb860814e4 Mon Sep 17 00:00:00 2001 From: Tarek Khalil <45508821+khalilovcmded@users.noreply.github.com> Date: Tue, 5 Mar 2019 14:40:31 +0000 Subject: [PATCH] REFACTOR: Change `watch` wording to `unignore` (#7112) * REFACTOR: Change `watch` wording to `unignore` --- .../discourse/components/user-card-contents.js.es6 | 5 ----- app/assets/javascripts/discourse/controllers/user.js.es6 | 4 ++-- app/assets/javascripts/discourse/models/user.js.es6 | 2 +- app/assets/javascripts/discourse/templates/user.hbs | 4 ++-- app/controllers/users_controller.rb | 4 ++-- config/locales/client.en.yml | 2 +- config/routes.rb | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 index f81fc71af04..d13fcd101c1 100644 --- a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 +++ b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 @@ -195,11 +195,6 @@ export default Ember.Component.extend( this._close(); }, - watchUser() { - this.get("user").watch(); - this._close(); - }, - showUser() { this.showUser(this.get("user")); this._close(); diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index d6f577fe37f..48d271183eb 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -152,9 +152,9 @@ export default Ember.Controller.extend(CanCheckEmails, { user.ignore().then(() => user.set("ignored", true)); }, - watchUser() { + unignoreUser() { const user = this.get("model"); - user.watch().then(() => user.set("ignored", false)); + user.unignore().then(() => user.set("ignored", false)); } } }); diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index ab7f31538d6..18963d737cb 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -622,7 +622,7 @@ const User = RestModel.extend({ }); }, - watch() { + unignore() { return ajax(`${userPath(this.get("username"))}/ignore.json`, { type: "DELETE", data: { ignored_user_id: this.get("id") } diff --git a/app/assets/javascripts/discourse/templates/user.hbs b/app/assets/javascripts/discourse/templates/user.hbs index 02ff00914ce..b702fd9b464 100644 --- a/app/assets/javascripts/discourse/templates/user.hbs +++ b/app/assets/javascripts/discourse/templates/user.hbs @@ -53,9 +53,9 @@
  • {{#if model.ignored}} {{d-button class="btn-default" - action=(action "watchUser") + action=(action "unignoreUser") icon="far-eye" - label="user.watch"}} + label="user.unignore"}} {{else}} {{d-button class="btn-danger" action=(action "ignoreUser") diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 81d6ea8963c..de1032355d4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -14,7 +14,7 @@ class UsersController < ApplicationController :pick_avatar, :destroy_user_image, :destroy, :check_emails, :topic_tracking_state, :preferences, :create_second_factor, :update_second_factor, :create_second_factor_backup, :select_avatar, - :ignore, :watch, :revoke_auth_token + :ignore, :unignore, :revoke_auth_token ] skip_before_action :check_xhr, only: [ @@ -1004,7 +1004,7 @@ class UsersController < ApplicationController render json: success_json end - def watch + def unignore raise Discourse::NotFound unless SiteSetting.ignore_user_enabled IgnoredUser.where(user: current_user, ignored_user_id: params[:ignored_user_id]).delete_all diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 1230635886f..a7524bf5d5a 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -637,7 +637,7 @@ en: private_message: "Message" private_messages: "Messages" ignore: "Ignore" - watch: "Watch" + unignore: "Unignore" activity_stream: "Activity" preferences: "Preferences" profile_hidden: "This user's public profile is hidden." diff --git a/config/routes.rb b/config/routes.rb index d3ec4656fdb..392400fcc13 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -422,7 +422,7 @@ Discourse::Application.routes.draw do get "#{root_path}/:username/staff-info" => "users#staff_info", constraints: { username: RouteFormat.username } get "#{root_path}/:username/summary" => "users#summary", constraints: { username: RouteFormat.username } put "#{root_path}/:username/ignore" => "users#ignore", constraints: { username: RouteFormat.username } - delete "#{root_path}/:username/ignore" => "users#watch", constraints: { username: RouteFormat.username } + delete "#{root_path}/:username/ignore" => "users#unignore", constraints: { username: RouteFormat.username } get "#{root_path}/:username/invited" => "users#invited", constraints: { username: RouteFormat.username } get "#{root_path}/:username/invited_count" => "users#invited_count", constraints: { username: RouteFormat.username } get "#{root_path}/:username/invited/:filter" => "users#invited", constraints: { username: RouteFormat.username }