From 6c09fd4289049d0e8a3e58ff95dfe555552ea628 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Tue, 25 Aug 2020 01:29:18 +0200 Subject: [PATCH] DEV: Remove unused code and translations --- .../app/components/topic-join-group-notice.js | 19 ------------------- .../components/topic-join-group-notice.hbs | 5 ----- app/assets/stylesheets/desktop/topic.scss | 6 ++---- app/assets/stylesheets/mobile/topic.scss | 6 ++---- app/controllers/groups_controller.rb | 10 ++-------- config/locales/client.en.yml | 3 --- config/locales/server.en.yml | 1 - 7 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/components/topic-join-group-notice.js delete mode 100644 app/assets/javascripts/discourse/app/templates/components/topic-join-group-notice.hbs diff --git a/app/assets/javascripts/discourse/app/components/topic-join-group-notice.js b/app/assets/javascripts/discourse/app/components/topic-join-group-notice.js deleted file mode 100644 index 216a3fb2b0c..00000000000 --- a/app/assets/javascripts/discourse/app/components/topic-join-group-notice.js +++ /dev/null @@ -1,19 +0,0 @@ -import I18n from "I18n"; -import Component from "@ember/component"; -import discourseComputed from "discourse-common/utils/decorators"; - -export default Component.extend({ - classNames: ["topic-notice"], - - @discourseComputed("model.group.{full_name,name,allow_membership_requests}") - accessViaGroupText(group) { - const name = group.full_name || group.name; - const suffix = group.allow_membership_requests ? "request" : "join"; - return I18n.t(`topic.group_${suffix}`, { name }); - }, - - @discourseComputed("model.group.allow_membership_requests") - accessViaGroupButtonText(allowRequest) { - return `groups.${allowRequest ? "request" : "join"}`; - } -}); diff --git a/app/assets/javascripts/discourse/app/templates/components/topic-join-group-notice.hbs b/app/assets/javascripts/discourse/app/templates/components/topic-join-group-notice.hbs deleted file mode 100644 index 3285ea58bcd..00000000000 --- a/app/assets/javascripts/discourse/app/templates/components/topic-join-group-notice.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{accessViaGroupText}} -{{d-button action=action - class="btn-primary topic-join-group" - icon="user-plus" - label=accessViaGroupButtonText}} diff --git a/app/assets/stylesheets/desktop/topic.scss b/app/assets/stylesheets/desktop/topic.scss index a54d3e6b655..b074a3b69c3 100644 --- a/app/assets/stylesheets/desktop/topic.scss +++ b/app/assets/stylesheets/desktop/topic.scss @@ -42,8 +42,7 @@ } } -.topic-error, -.topic-notice { +.topic-error { padding: 18px; width: 60%; margin-left: auto; @@ -52,8 +51,7 @@ text-align: center; line-height: $line-height-medium; - .topic-retry, - .topic-join-group { + .topic-retry { display: block; margin-top: 28px; margin-left: auto; diff --git a/app/assets/stylesheets/mobile/topic.scss b/app/assets/stylesheets/mobile/topic.scss index 9787bdf5f37..5b991b412fa 100644 --- a/app/assets/stylesheets/mobile/topic.scss +++ b/app/assets/stylesheets/mobile/topic.scss @@ -135,8 +135,7 @@ } } -.topic-error, -.topic-notice { +.topic-error { padding: 18px; width: 90%; margin-left: auto; @@ -144,8 +143,7 @@ font-size: $font-up-4; line-height: $line-height-medium; - .topic-retry, - .topic-join-group { + .topic-retry { display: block; margin-top: 20px; margin-left: auto; diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e11e2c2269f..dedb39358e4 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -470,18 +470,12 @@ class GroupsController < ApplicationController end def request_membership - params.require(:reason) if params[:topic_id].blank? + params.require(:reason) group = find_group(:id) - if params[:topic_id] && topic = Topic.find_by_id(params[:topic_id]) - reason = I18n.t("groups.view_hidden_topic_request_reason", group_name: group.name, topic_url: topic.url) - end - - reason ||= params[:reason] - begin - GroupRequest.create!(group: group, user: current_user, reason: reason) + GroupRequest.create!(group: group, user: current_user, reason: params[:reason]) rescue ActiveRecord::RecordNotUnique => e return render json: failed_json.merge(error: I18n.t("groups.errors.already_requested_membership")), status: 409 end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index f217dd3fb48..f82f5d8b182 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2236,9 +2236,6 @@ en: toggle_information: "toggle topic details" read_more_in_category: "Want to read more? Browse other topics in %{catLink} or %{latestLink}." read_more: "Want to read more? %{catLink} or %{latestLink}." - group_request: "You need to request membership to the `%{name}` group to see this topic" - group_join: "You need join the `%{name}` group to see this topic" - group_request_sent: "Your group membership request has been sent. You will be informed when it's accepted." unread_indicator: "No member has read the last post of this topic yet." # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 3a620230945..26522d3834a 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -428,7 +428,6 @@ en: title: "You've been accepted into @%{group_name}" body: | Your request to enter @%{group_name} has been accepted and you are now a member. - view_hidden_topic_request_reason: "I would like to join the group '%{group_name}', so I may access [this topic](%{topic_url})" education: until_posts: