removed real name from signup process.

This commit is contained in:
danielvincent 2010-10-27 16:25:22 -07:00
parent bfb1c6df28
commit 05c5e770ee
11 changed files with 34 additions and 60 deletions

View file

@ -13,7 +13,7 @@ class AspectsController < ApplicationController
@aspect = :all
if current_user.getting_started == true
redirect_to getting_started_path(1)
redirect_to getting_started_path
end
end

View file

@ -58,7 +58,11 @@ class Person
end
def real_name
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
if profile.first_name.nil? || profile.first_name.empty?
self.diaspora_handle
else
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
end
end
def owns?(post)

View file

@ -19,7 +19,6 @@ class Profile
key :image_url, String
key :bio, String
validates_presence_of :first_name, :last_name
after_validation :strip_names
before_save :strip_names

View file

@ -89,10 +89,6 @@ class User
self.person.send(method, *args)
end
def real_name
"#{person.profile.first_name.to_s} #{person.profile.last_name.to_s}"
end
######### Aspects ######################
def aspect(opts = {})
aspect = Aspect.new(opts)
@ -405,12 +401,15 @@ class User
###Helpers############
def self.build(opts = {})
opts[:person] = {}
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}"
opts[:person][:url] = APP_CONFIG[:pod_url]
opts[:serialized_private_key] = generate_key
opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key
opts[:person][:profile] = Profile.new
u = User.new(opts)
u
end

View file

@ -17,14 +17,6 @@
= f.label :password_confirmation
= f.password_field :password_confirmation
= f.fields_for :person do |p|
= p.fields_for :profile do |pr|
%p
= pr.label :first_name
= pr.text_field :first_name
%p
= pr.label :last_name
= pr.text_field :last_name
= f.submit t('.sign_up')

View file

@ -30,7 +30,7 @@
%br
.span-15.last
.floating
.floating{:style=>"min-height:500px;"}
= render "users/getting_started/step_#{@step}", :current_user => current_user
- if @step > 1

View file

@ -1293,7 +1293,6 @@ ul.aspects
:border
:bottom 1px solid #ccc
:top 1px solid #fff
:min-height 500px
.submit_block
:position absolute

View file

@ -14,11 +14,7 @@ describe RegistrationsController do
@valid_params = {"user" => {"username" => "jdoe",
"email" => "jdoe@example.com",
"password" => "password",
"password_confirmation" => "password",
"person" => {
"profile" => {
"first_name" => "John",
"last_name" => "Doe"}}}}
"password_confirmation" => "password"}}
end
describe "#create" do
@ -41,7 +37,7 @@ describe RegistrationsController do
end
context "with invalid parameters" do
before do
@valid_params["user"]["person"]["profile"].delete("first_name")
@valid_params["user"]["password_confirmation"] = "baddword"
@invalid_params = @valid_params
end
it "does not create a user" do

View file

@ -13,22 +13,6 @@ describe Person do
@aspect2 = @user2.aspect(:name => "Abscence of Babes")
end
describe "validation" do
describe "of associated profile" do
it "fails if the profile isn't valid" do
person = Factory.build(:person)
person.should be_valid
person.profile.update_attribute(:first_name, nil)
person.profile.should_not be_valid
person.should_not be_valid
person.errors.count.should == 1
person.errors.full_messages.first.should =~ /first name/i
end
end
end
describe '#diaspora_handle' do
context 'local people' do
it 'uses the pod config url to set the diaspora_handle' do
@ -54,6 +38,27 @@ describe Person do
end
end
context '#real_name' do
let!(:user) { Factory(:user) }
let!(:person) { user.person }
let!(:profile) { person.profile }
context 'with first name' do
it 'should return their name for real name' do
person.real_name.should match /#{profile.first_name}|#{profile.last_name}/
end
end
context 'without first name' do
it 'should display their diaspora handle' do
person.profile.first_name = nil
person.profile.last_name = nil
person.save!
person.real_name.should == person.diaspora_handle
end
end
end
describe 'xml' do
before do
@xml = @person.to_xml.to_s

View file

@ -7,16 +7,6 @@ require 'spec_helper'
describe Profile do
describe 'validation' do
describe "of first_name" do
it "requires first name" do
profile = Factory.build(:profile, :first_name => nil)
profile.should_not be_valid
profile.first_name = "Hortense"
profile.should be_valid
end
it "requires non-empty first name" do
profile = Factory.build(:profile, :first_name => " ")
profile.should_not be_valid
end
it "strips leading and trailing whitespace" do
profile = Factory.build(:profile, :first_name => " Shelly ")
profile.should be_valid
@ -24,16 +14,6 @@ describe Profile do
end
end
describe "of last_name" do
it "requires a last name" do
profile = Factory.build(:profile, :last_name => nil)
profile.should_not be_valid
profile.last_name = "Shankar"
profile.should be_valid
end
it "requires non-empty last name" do
profile = Factory.build(:profile, :last_name => " ")
profile.should_not be_valid
end
it "strips leading and trailing whitespace" do
profile = Factory.build(:profile, :last_name => " Ohba ")
profile.should be_valid

View file

@ -124,7 +124,7 @@ describe User do
:username => "ohai",
:email => "ohai@example.com",
:password => "password",
:password_confirmation => "password",
:password_confirmation => "wrongpasswordz",
:person => {:profile => {:first_name => "", :last_name => ""}}}
end
it "raises no error" do