Improve communication about signing up on closed pods

fixes #7767
This commit is contained in:
alebor-5 2018-10-15 18:04:23 +02:00 committed by Benjamin Neff
parent 6826e89a95
commit 469983a623
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
8 changed files with 75 additions and 9 deletions

View file

@ -106,3 +106,26 @@ ul#help_nav {
}
}
}
.ball{
background: image-url('branding/ball.png') no-repeat;
background-size: contain;
height: 633px;
max-width: 100%;
}
.v-center {
display: table;
height: 633px;
}
.content {
display: table-cell;
vertical-align: middle;
h2 {
font-size: 35px;
margin: 12px;
text-align: left;
}
}

View file

@ -33,8 +33,12 @@ class RegistrationsController < Devise::RegistrationsController
def check_registrations_open_or_valid_invite!
return true if AppConfig.settings.enable_registrations? || invite.try(:can_be_used?)
flash[:error] = params[:invite] ? t("registrations.invalid_invite") : t("registrations.closed")
redirect_to new_user_session_path
if params[:invite]
flash[:error] = t("registrations.invalid_invite")
redirect_to new_user_session_path
else
redirect_to registration_closed_path
end
end
def invite

View file

@ -0,0 +1,25 @@
- content_for :page_title do
= AppConfig.settings.pod_name + " - " + t("devise.shared.links.sign_up_closed")
.container
.row
.col-md-10.offset1
.col-md-7.hidden-phone
%h1.ball
.col-md-5.v-center
.content
%h2
= t("devise.shared.links.sign_up_closed")
!= t("help.closed_pod",
wiki: link_to("another pod", "https://diasporafoundation.org/getting_started/sign_up"))
!= t("help.find_pods",
poduptime: link_to("Poduptime", "https://podupti.me/"))
!= t("help.other_questions",
wiki: link_to("Wiki", "https://wiki.diasporafoundation.org/Choosing_a_pod"))

View file

@ -0,0 +1,11 @@
%h2
= t("devise.shared.links.sign_up_closed")
!= t("help.closed_pod",
wiki: link_to("another pod", "https://diasporafoundation.org/getting_started/sign_up"))
!= t("help.find_pods",
poduptime: link_to("Poduptime", "https://podupti.me/"))
!= t("help.other_questions",
wiki: link_to("Wiki", "https://wiki.diasporafoundation.org/Choosing_a_pod"))

View file

@ -1,5 +1,5 @@
%ul.nav.navbar-nav.navbar-right
- if AppConfig.settings.enable_registrations? && !current_page?(controller: "/registrations", action: :new)
- unless current_page?(controller: "/registrations", action: :new)
%li= link_to t("devise.shared.links.sign_up"), new_user_registration_path, class: "login"
- unless current_page?(controller: "/sessions", action: :new)
%li= link_to t("devise.shared.links.sign_in"), new_user_session_path, class: "login"

View file

@ -346,6 +346,10 @@ en:
tutorials: "tutorials"
tutorial: "tutorial"
irc: "IRC"
closed_pod: "This pod is currently closed to new registrations. However, you can still join the diaspora* network by registering on %{wiki}. Because all pods are interconnected, you will have access to the same content there."
find_pods: "You can find pods at %{poduptime}."
other_questions: "If you have any other questions regarding choosing a pod, checkout our %{wiki}."
choose_another: "Please, choose another pod"
wiki: "wiki"
faq: "FAQ"
markdown: "Markdown"

View file

@ -205,6 +205,7 @@ Rails.application.routes.draw do
# Help
get 'help' => 'help#faq', :as => 'help'
get "help/registration_closed" => "help#registration_closed", :as => "registration_closed"
get 'help/:topic' => 'help#faq'
#Protocol Url

View file

@ -25,16 +25,14 @@ describe RegistrationsController, type: :controller do
AppConfig.settings.enable_registrations = false
end
it "redirects #new to the login page" do
it "redirects #new to the registration closed page" do
get :new
expect(flash[:error]).to eq(I18n.t("registrations.closed"))
expect(response).to redirect_to new_user_session_path
expect(response).to redirect_to registration_closed_path
end
it "redirects #create to the login page" do
it "redirects #create to the registration closed page" do
post :create, params: valid_params
expect(flash[:error]).to eq(I18n.t("registrations.closed"))
expect(response).to redirect_to new_user_session_path
expect(response).to redirect_to registration_closed_path
end
it "does not redirect if there is a valid invite token" do