show new profile pages for those who have it activated
This commit is contained in:
parent
bbd4ee5738
commit
c3b0bbd425
5 changed files with 39 additions and 14 deletions
|
|
@ -24,10 +24,13 @@ app.pages.Profile = app.views.Base.extend({
|
|||
presenter : function(){
|
||||
var bio = this.model.get("bio") || ''
|
||||
|
||||
console.log(this.defaultPresenter().current_user)
|
||||
|
||||
return _.extend(this.defaultPresenter(),
|
||||
{text : this.model && app.helpers.textFormatter(bio, this.model),
|
||||
isOwnProfile : this.isOwnProfile(),
|
||||
showFollowButton : this.showFollowButton() })
|
||||
showFollowButton : this.showFollowButton()
|
||||
})
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
|
|
@ -55,7 +58,8 @@ app.pages.Profile = app.views.Base.extend({
|
|||
},
|
||||
|
||||
followingEnabled : function() {
|
||||
return app.currentUser.get("following_count") != 0
|
||||
var user = app.currentUser
|
||||
return user.get("following_count") != 0 && user.get("diaspora_id") !== undefined
|
||||
},
|
||||
|
||||
showFollowButton : function() {
|
||||
|
|
|
|||
|
|
@ -10,14 +10,24 @@
|
|||
</a>
|
||||
{{/if}}
|
||||
|
||||
<a href="/" id="home-button">
|
||||
<span class="label label-inverse">
|
||||
<i class="icon-home icon-white"></i>
|
||||
<span>
|
||||
HOME
|
||||
{{#if current_user.guid}}
|
||||
<a href="/" id="home-button">
|
||||
<span class="label label-inverse">
|
||||
<i class="icon-home icon-white"></i>
|
||||
<span>
|
||||
HOME
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</a>
|
||||
{{else}}
|
||||
<a href="/" id="home-button">
|
||||
<span class="label label-inverse">
|
||||
<span>
|
||||
DIASPORA
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
{{/if}}
|
||||
|
||||
{{#if isOwnProfile}}
|
||||
<a href="/users/sign_out" title="Log out" id="logout-button">
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class PeopleController < ApplicationController
|
|||
|
||||
def show
|
||||
@person = Person.find_from_guid_or_username(params)
|
||||
flag = FeatureFlagger.new(current_user)
|
||||
flag = FeatureFlagger.new(current_user, @person)
|
||||
logger.info(request.format)
|
||||
|
||||
raise(ActiveRecord::RecordNotFound) if remote_profile_with_no_user_session?
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
class FeatureFlagger
|
||||
def initialize(current_user)
|
||||
def initialize(current_user, person=nil)
|
||||
@current_user = current_user
|
||||
@person = person
|
||||
end
|
||||
|
||||
def new_publisher?
|
||||
|
|
@ -8,7 +9,7 @@ class FeatureFlagger
|
|||
end
|
||||
|
||||
def new_profile?
|
||||
admin?
|
||||
person_is_beta?
|
||||
end
|
||||
|
||||
def new_hotness?
|
||||
|
|
@ -25,4 +26,9 @@ class FeatureFlagger
|
|||
@current_user.try(:admin?)
|
||||
end
|
||||
|
||||
def person_is_beta?
|
||||
return unless @person.present?
|
||||
Role.is_beta?(@person) || Role.is_admin?(@person)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -127,12 +127,17 @@ describe("app.pages.Profile", function(){
|
|||
describe("followingEnabled", function(){
|
||||
/* for legacy beta testers */
|
||||
it("returns false if following_count is zero", function(){
|
||||
app.currentUser.set({following_count : 0})
|
||||
loginAs({following_count : 0})
|
||||
expect(this.page.followingEnabled()).toBeFalsy()
|
||||
})
|
||||
|
||||
it("returns false if the user is not signed in", function(){
|
||||
logout()
|
||||
expect(this.page.followingEnabled()).toBeFalsy()
|
||||
})
|
||||
|
||||
it("returns false if following_count is zero", function(){
|
||||
app.currentUser.set({following_count : 1})
|
||||
loginAs({following_count : 1})
|
||||
expect(this.page.followingEnabled()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue