Commit a946251a authored by Faldrian's avatar Faldrian Committed by Jonne Haß

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

closes #6456
parent 517cd56f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment