Simplify /podmin redirect
Some podmins were confuse how they can disable this redirect and I think the rule with two users can actually be a little confusing. I think the main goal of this page to give the podmin a little start and I think after they configured everything, the pod works and they found the link to the wiki to make themself an admin, it is OK to remove the redirect. Also it's bad for single-user pods where this page always stays active, even if they are an admin, but have only one user. It's more useful for single-user pods to have the login on the home page. closes #7783
This commit is contained in:
parent
e31ca1fd3b
commit
686310fb8e
3 changed files with 6 additions and 21 deletions
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
## Refactor
|
||||
* Remove the 'make contacts in this aspect visible to each other' option [#7769](https://github.com/diaspora/diaspora/pull/7769)
|
||||
* Remove the requirement to have at least two users to disable the /podmin redirect [#7783](https://github.com/diaspora/diaspora/pull/7783)
|
||||
|
||||
## Bug fixes
|
||||
* Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744)
|
||||
* Fix profiles sometimes not loading properly in background tabs [#7740](https://github.com/diaspora/diaspora/pull/7740)
|
||||
* Show error message when creating posts with invalid aspects [#7742](https://github.com/diaspora/diaspora/pull/7742)
|
||||
* Fix mention syntax backport for two immediately consecutive mentions [#7777](https://github.com/diaspora/diaspora/pull/7777)
|
||||
* Fix link to 'make yourself an admin' [#7783](https://github.com/diaspora/diaspora/pull/7783)
|
||||
|
||||
## Features
|
||||
* Make public stream accessible for logged out users [#7775](https://github.com/diaspora/diaspora/pull/7775)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class HomeController < ApplicationController
|
|||
partial_dir.join("_show.html.erb").exist? ||
|
||||
partial_dir.join("_show.haml").exist?
|
||||
render :show
|
||||
elsif User.count > 1 && Role.where(name: "admin").any?
|
||||
elsif Role.admins.any?
|
||||
render :default
|
||||
else
|
||||
redirect_to podmin_path
|
||||
|
|
|
|||
|
|
@ -6,31 +6,14 @@
|
|||
|
||||
describe HomeController, type: :controller do
|
||||
describe "#show" do
|
||||
it "does not redirect for :html if there are at least 2 users and an admin" do
|
||||
allow(User).to receive(:count).and_return(2)
|
||||
allow(Role).to receive_message_chain(:where, :any?).and_return(true)
|
||||
allow(Role).to receive_message_chain(:where, :exists?).and_return(true)
|
||||
it "does not redirect for :html if there is at least one admin" do
|
||||
expect(Role).to receive_message_chain(:admins, :any?).and_return(true)
|
||||
get :show
|
||||
expect(response).not_to be_redirect
|
||||
end
|
||||
|
||||
it "redirects to the podmin page for :html if there are less than 2 users" do
|
||||
allow(User).to receive(:count).and_return(1)
|
||||
allow(Role).to receive_message_chain(:where, :any?).and_return(true)
|
||||
get :show
|
||||
expect(response).to redirect_to(podmin_path)
|
||||
end
|
||||
|
||||
it "redirects to the podmin page for :html if there is no admin" do
|
||||
allow(User).to receive(:count).and_return(2)
|
||||
allow(Role).to receive_message_chain(:where, :any?).and_return(false)
|
||||
get :show
|
||||
expect(response).to redirect_to(podmin_path)
|
||||
end
|
||||
|
||||
it "redirects to the podmin page for :html if there are less than 2 users and no admin" do
|
||||
allow(User).to receive(:count).and_return(0)
|
||||
allow(Role).to receive_message_chain(:where, :any?).and_return(false)
|
||||
expect(Role).to receive_message_chain(:admins, :any?).and_return(false)
|
||||
get :show
|
||||
expect(response).to redirect_to(podmin_path)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue