DEV: Remove unused code and translations

This commit is contained in:
Gerhard Schlager
2020-08-25 01:29:18 +02:00
committed by Gerhard Schlager
parent d684d5fba4
commit 6c09fd4289
7 changed files with 6 additions and 44 deletions

View File

@ -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"}`;
}
});

View File

@ -1,5 +0,0 @@
{{accessViaGroupText}}
{{d-button action=action
class="btn-primary topic-join-group"
icon="user-plus"
label=accessViaGroupButtonText}}

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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: