Skip to content

Commit

Permalink
MS DC; admins are now always redirected to new profile
Browse files Browse the repository at this point in the history
  • Loading branch information
dnsco committed Apr 25, 2012
1 parent 87fb922 commit 340411f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions .powenv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NEW_HOTNESS=yessir
13 changes: 5 additions & 8 deletions app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,12 @@ def hashes_for_people(people, aspects)

def show
@person = Person.find_from_guid_or_username(params)
flag = FeatureFlagger.new(current_user)

if remote_profile_with_no_user_session?
raise ActiveRecord::RecordNotFound
end

if @person.closed_account?
redirect_to :back, :notice => t("people.show.closed_account")
return
end
raise(ActiveRecord::RecordNotFound) if remote_profile_with_no_user_session?
return redirect_to :back, :notice => t("people.show.closed_account") if @person.closed_account?
return redirect_to person_path(@person) if params[:ex] && !flag.new_profile?
return redirect_to person_path(@person, :ex => true) if !params[:ex] && flag.new_profile? && flag.new_hotness?

@post_type = :all
@aspect = :profile
Expand Down
21 changes: 20 additions & 1 deletion app/models/feature_flagger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ def initialize(current_user)
end

def new_publisher?
@current_user.admin? || !(Rails.env.production? || Rails.env.staging?)
admin? || developer?
end

def new_profile?
admin?
end

def new_hotness?
ENV["NEW_HOTNESS"]
end

protected

def developer?
!(Rails.env.production? || Rails.env.staging?) #includes test, cucumber, or developer
end

def admin?
@current_user.try(:admin?)
end

end

0 comments on commit 340411f

Please sign in to comment.