Skip to content
Extraits de code Groupes Projets
Valider a946251a rédigé par Faldrian's avatar Faldrian Validation de Jonne Haß
Parcourir les fichiers

Show getting_started only if user has made no profile changes on the page

closes #6456
parent 517cd56f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -4,6 +4,7 @@
* Improve infinite scroll triggering [#6451](https://github.com/diaspora/diaspora/pull/6451)
## Bug fixes
* Skip first getting started step if it looks done already [#6456](https://github.com/diaspora/diaspora/pull/6456)
## Features
* Show spinner on initial stream load [#6384](https://github.com/diaspora/diaspora/pull/6384)
......
......@@ -138,7 +138,12 @@ class ApplicationController < ActionController::Base
end
def current_user_redirect_path
current_user.getting_started? ? getting_started_path : stream_path
# If getting started is active AND the user has not completed the getting_started page
if current_user.getting_started? && !current_user.basic_profile_present?
getting_started_path
else
stream_path
end
end
def gon_set_current_user
......
......@@ -416,6 +416,10 @@ class User < ActiveRecord::Base
Postzord::Dispatcher.build(self, profile).post
end
def basic_profile_present?
tag_followings.any? || profile[:image_url]
end
###Helpers############
def self.build(opts = {})
u = User.new(opts.except(:person, :id))
......
......@@ -20,7 +20,7 @@ describe ApplicationController, :type => :controller do
get :index
expect(response.headers['X-Diaspora-Version']).to include AppConfig.version.number.get
end
context 'with git info' do
before do
allow(AppConfig).to receive(:git_available?).and_return(true)
......@@ -86,10 +86,36 @@ describe ApplicationController, :type => :controller do
alice.update_attribute(:getting_started, true)
end
it "redirects to getting started if the user has getting started set to true" do
it "redirects to getting started if the user has getting started set to true and a blank profile" do
expect(@controller.send(:after_sign_in_path_for, alice)).to eq(getting_started_path)
end
end
context "getting started true and one tag present on user" do
before do
alice.update_attribute(:getting_started, true)
@tag = ActsAsTaggableOn::Tag.create!(name: "partytimeexcellent")
allow(@controller).to receive(:current_user).and_return(alice)
TagFollowing.create!(tag: @tag, user: alice)
end
it "redirects to stream if the user has getting started set to true and has already added tags" do
expect(@controller.send(:after_sign_in_path_for, alice)).to eq(stream_path)
end
end
context "getting started true and user image present on user" do
before do
alice.update_attribute(:getting_started, true)
# Just set the image url...
alice.profile.image_url = "something not nil"
allow(@controller).to receive(:current_user).and_return(alice)
end
it "redirects to stream if the user has getting started set to true and has already added a photo" do
expect(@controller.send(:after_sign_in_path_for, alice)).to eq(stream_path)
end
end
end
describe "#after_sign_out_path_for" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter