Merge branch 'stable' into develop

This commit is contained in:
Jonne Haß 2015-10-07 10:58:10 +02:00
commit 1df5c7f7bf
4 changed files with 39 additions and 3 deletions

View file

@ -87,6 +87,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure.
* Improve infinite scroll triggering [#6451](https://github.com/diaspora/diaspora/pull/6451) * Improve infinite scroll triggering [#6451](https://github.com/diaspora/diaspora/pull/6451)
## Bug fixes ## Bug fixes
* Skip first getting started step if it looks done already [#6456](https://github.com/diaspora/diaspora/pull/6456)
## Features ## Features
* Show spinner on initial stream load [#6384](https://github.com/diaspora/diaspora/pull/6384) * Show spinner on initial stream load [#6384](https://github.com/diaspora/diaspora/pull/6384)

View file

@ -139,7 +139,12 @@ class ApplicationController < ActionController::Base
end end
def current_user_redirect_path 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 end
def gon_set_appconfig def gon_set_appconfig

View file

@ -422,6 +422,10 @@ class User < ActiveRecord::Base
Postzord::Dispatcher.build(self, profile).post Postzord::Dispatcher.build(self, profile).post
end end
def basic_profile_present?
tag_followings.any? || profile[:image_url]
end
###Helpers############ ###Helpers############
def self.build(opts = {}) def self.build(opts = {})
u = User.new(opts.except(:person, :id)) u = User.new(opts.except(:person, :id))

View file

@ -20,7 +20,7 @@ describe ApplicationController, :type => :controller do
get :index get :index
expect(response.headers['X-Diaspora-Version']).to include AppConfig.version.number.get expect(response.headers['X-Diaspora-Version']).to include AppConfig.version.number.get
end end
context 'with git info' do context 'with git info' do
before do before do
allow(AppConfig).to receive(:git_available?).and_return(true) allow(AppConfig).to receive(:git_available?).and_return(true)
@ -86,10 +86,36 @@ describe ApplicationController, :type => :controller do
alice.update_attribute(:getting_started, true) alice.update_attribute(:getting_started, true)
end 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) expect(@controller.send(:after_sign_in_path_for, alice)).to eq(getting_started_path)
end end
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 end
describe "#after_sign_out_path_for" do describe "#after_sign_out_path_for" do