Merge remote branch 'upstream/master'

This commit is contained in:
Alec Leamas 2010-10-19 22:10:30 +02:00
commit d738846900
31 changed files with 262 additions and 239 deletions

View file

@ -23,7 +23,7 @@ class AspectsController < ApplicationController
else else
flash[:error] = I18n.t('aspects.create.failure') flash[:error] = I18n.t('aspects.create.failure')
end end
respond_with :location => aspects_manage_path respond_with @aspect
end end
def new def new

View file

@ -7,6 +7,14 @@ module ApplicationHelper
!@aspect.is_a?(Symbol) && @aspect.id == aspect.id !@aspect.is_a?(Symbol) && @aspect.id == aspect.id
end end
def aspect_or_all_path aspect
if @aspect.is_a? Aspect
aspect_path @aspect
else
aspects_path
end
end
def object_path(object, opts = {}) def object_path(object, opts = {})
object = object.person if object.is_a? User object = object.person if object.is_a? User
eval("#{object.class.to_s.underscore}_path(object, opts)") eval("#{object.class.to_s.underscore}_path(object, opts)")
@ -50,7 +58,7 @@ module ApplicationHelper
def person_image_tag(person) def person_image_tag(person)
image_location = person.profile.image_url image_location = person.profile.image_url
image_location ||= "/images/user/default.jpg" image_location ||= "/images/user/default.png"
image_tag image_location, :class => "avatar", :alt => person.real_name, :title => person.real_name image_tag image_location, :class => "avatar", :alt => person.real_name, :title => person.real_name
end end

View file

@ -14,12 +14,4 @@ module AspectsHelper
"<span class='grey' title=#{I18n.t('aspects.helper.aspect_not_empty')}>#{I18n.t('aspects.helper.remove')}</span>" "<span class='grey' title=#{I18n.t('aspects.helper.aspect_not_empty')}>#{I18n.t('aspects.helper.remove')}</span>"
end end
end end
def aspect_id(aspect)
if aspect.class == Aspect
aspect.id
else
:all
end
end
end end

View file

@ -17,6 +17,7 @@ class Aspect
belongs_to :user, :class_name => 'User' belongs_to :user, :class_name => 'User'
validates_presence_of :name validates_presence_of :name
validates_uniqueness_of :name, :scope => :user_id
timestamps! timestamps!

View file

@ -27,21 +27,12 @@ class Person
timestamps! timestamps!
before_save :strip_and_downcase_diaspora_handle
before_destroy :remove_all_traces before_destroy :remove_all_traces
before_validation :clean_url before_validation :clean_url
validates_presence_of :url, :profile, :serialized_public_key validates_presence_of :url, :profile, :serialized_public_key
validates_format_of :url, :with => validates_format_of :url, :with =>
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix /^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
def strip_and_downcase_diaspora_handle
if self.diaspora_handle
self.diaspora_handle.strip!
self.diaspora_handle.downcase!
end
end
def self.search(query) def self.search(query)
return Person.all if query.to_s.empty? return Person.all if query.to_s.empty?
query_tokens = query.to_s.strip.split(" ") query_tokens = query.to_s.strip.split(" ")
@ -95,12 +86,14 @@ class Person
def self.by_webfinger(identifier, opts = {}) def self.by_webfinger(identifier, opts = {})
#need to check if this is a valid email structure, maybe should do in JS #need to check if this is a valid email structure, maybe should do in JS
local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', '').to_s) query = /#{Regexp.escape(identifier.gsub('acct:', '').to_s)}/i
local_person = Person.first(:diaspora_handle => query)
if local_person if local_person
Rails.logger.info("Do not need to webfinger, found a local person #{local_person.real_name}") Rails.logger.info("Do not need to webfinger, found a local person #{local_person.real_name}")
local_person local_person
elsif !identifier.include?("localhost") && !opts[:local] elsif !identifier.include?("localhost") && !opts[:local]
#Get remote profile
begin begin
Rails.logger.info("Webfingering #{identifier}") Rails.logger.info("Webfingering #{identifier}")
f = Redfinger.finger(identifier) f = Redfinger.finger(identifier)

View file

@ -388,7 +388,7 @@ class User
end end
def diaspora_handle def diaspora_handle
"#{self.username}@#{APP_CONFIG[:terse_pod_url]}".downcase "#{self.username}@#{APP_CONFIG[:terse_pod_url]}"
end end
def as_json(opts={}) def as_json(opts={})

View file

@ -8,20 +8,23 @@
$("#add_album_button").fancybox(); $("#add_album_button").fancybox();
}); });
- content_for :left_pane do .span-4.append-1.last
= render "shared/aspect_friends" = render "shared/aspect_friends"
%h3 Albums .span-15.last
= link_to t('.new_album'), '#new_album_pane', {:class => "button", :id => "add_album_button"} %h3
= @aspect
Albums
= link_to t('.new_album'), '#new_album_pane', {:class => "button", :id => "add_album_button"}
.fancybox_content .fancybox_content
#new_album_pane #new_album_pane
= render "albums/new_album", :aspect => params[:aspect] = render "albums/new_album", :aspect => params[:aspect]
%div %div
- for album in @albums - for album in @albums
= render "album", :post => album = render "album", :post => album
#pagination #pagination
= will_paginate @albums = will_paginate @albums

View file

@ -9,29 +9,27 @@
}); });
}); });
= content_for :page_title do .span-4.append-1.last
= link_to "◂ #{t('.albums')}", albums_path(:aspect => @aspect)
- content_for :left_pane do
= render "shared/aspect_friends" = render "shared/aspect_friends"
%h3 .span-19.last
%h3
= link_to "#{@aspect} Albums", albums_path(:aspect => @aspect)
= @album.name = @album.name
="#{t('.updated')} #{how_long_ago(@album)}" ="#{t('.updated')} #{how_long_ago(@album)}"
-if current_user.owns? @album .right
-if current_user.owns? @album
=render 'photos/new_photo' =render 'photos/new_photo'
= link_to t('.edit_album'), edit_album_path(@album), :class => 'button' = link_to t('.edit_album'), edit_album_path(@album), :class => 'button'
.album_id{:id => @album.id, :style => "display:hidden;"} .album_id{:id => @album.id, :style => "display:hidden;"}
-unless current_user.owns? @album -unless current_user.owns? @album
%h4= "#{t('.by')} #{@album.person.real_name}" %h4= "#{t('.by')} #{@album.person.real_name}"
#thumbnails #thumbnails
- for photo in @album_photos - for photo in @album_photos
.image_thumb .image_thumb
= link_to (image_tag photo.url(:thumb_medium)), object_path(photo) = link_to (image_tag photo.url(:thumb_medium)), object_path(photo)
#content_bottom
.back
= link_to "⇧ #{t('.albums')}", albums_path(:aspect => @aspect)

View file

@ -2,12 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
#no_posts.empty_message{:style => ("display:none" unless @posts.count == 0)}
.null_arrow ⇧
%h3=t('.start_talking')
#no_friends.empty_message{:style => ("display:none" unless @friends.count == 0)} #no_friends.empty_message{:style => ("display:none" unless @friends.count == 0)}
- if (@aspect == :all) || (@aspect == :public) - if (@aspect == :all) || (@aspect == :public)
%h3=t('.nobody') %h3=t('.nobody')
%h4= link_to t('.add_friend'), aspects_manage_path %h4= link_to t('.add_friend'), aspects_manage_path
@ -17,4 +12,3 @@
%h4= link_to t('.add_friend_to', :aspect_name => @aspect.name), "#add_request_pane", :class => "add_request_button" %h4= link_to t('.add_friend_to', :aspect_name => @aspect.name), "#add_request_pane", :class => "add_request_button"
%h4= link_to t('.invite', :aspect_name => @aspect.name), "#invite_user_pane", :class => "invite_user_button", :class => "invite_user_button", :title => t('.invite') %h4= link_to t('.invite', :aspect_name => @aspect.name), "#invite_user_pane", :class => "invite_user_button", :class => "invite_user_button", :title => t('.invite')

View file

@ -0,0 +1,8 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
#no_posts.empty_message{:style => ("display:none" unless @posts.count == 0)}
.null_arrow ⇧
%h3=t('.start_talking')

View file

@ -2,19 +2,17 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
- content_for :left_pane do .span-4.append-1.last
= render "shared/aspect_friends" = render "shared/aspect_friends"
- content_for :publish do .span-15.last
= render "shared/publisher", :aspect_ids => :all, :broadcast => true = render 'aspects/no_friends_message'
= render 'shared/publisher'
= render 'aspects/empty_messages' = render 'aspects/no_posts_message'
%ul#stream
= render "shared/publisher"
%ul#stream
- for post in @posts - for post in @posts
= render type_partial(post), :post => post unless post.class == Album = render type_partial(post), :post => post unless post.class == Album
#pagination #pagination
= will_paginate @posts = will_paginate @posts

View file

@ -6,7 +6,13 @@
= javascript_include_tag 'jquery-ui-1.8.4.custom.min.js' = javascript_include_tag 'jquery-ui-1.8.4.custom.min.js'
= javascript_include_tag 'aspect-edit.js' = javascript_include_tag 'aspect-edit.js'
- content_for :left_pane do #section_header
%h2
Manage aspects
.right
= link_to(t('.add_a_new_aspect'), "#add_aspect_pane", :class => "new_aspect add_aspect_button button", :title => t('.add_a_new_aspect'))
.span-4.append-1.last
%h3=t('.requests') %h3=t('.requests')
.requests .requests
@ -27,10 +33,8 @@
= render 'shared/invitations', :invites => @invites = render 'shared/invitations', :invites => @invites
%h2 Manage aspects .span-19.last
= link_to(t('.add_a_new_aspect'), "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => t('.add_a_new_aspect')) %ul#aspect_list
%ul#aspect_list
- for aspect in @aspects - for aspect in @aspects
%li.aspect %li.aspect

View file

@ -2,16 +2,17 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
- content_for :left_pane do .span-4.append-1.last
= render "shared/aspect_friends" = render "shared/aspect_friends"
= render 'aspects/empty_messages' .span-15.last
= render 'aspects/no_friends_message'
= render "shared/publisher" = render 'shared/publisher'
%ul#stream = render 'aspects/no_posts_message'
%ul#stream
- for post in @posts - for post in @posts
= render type_partial(post), :post => post unless post.class == Album = render type_partial(post), :post => post unless post.class == Album
#pagination #pagination
= will_paginate @posts = will_paginate @posts

View file

@ -4,7 +4,7 @@
= javascript_include_tag 'FABridge', 'swfobject', 'web_socket' = javascript_include_tag 'FABridge', 'swfobject', 'web_socket'
:javascript :javascript
WebSocket.__swfLocation = "/javascripts/WebSocketMain.swf"; WebSocket.__swfLocation = "#{javascript_path 'WebSocketMain.swf'}";
$(document).ready(function(){ $(document).ready(function(){
function debug(str){ $("#debug").append("<p>" + str); }; function debug(str){ $("#debug").append("<p>" + str); };

View file

@ -59,10 +59,7 @@
= render "shared/aspect_nav" = render "shared/aspect_nav"
.container .container
.span-4.append-1.last .span-24.last
= yield :left_pane
.span-15.last
= yield = yield
.span-19.prepend-5.last .span-19.prepend-5.last

View file

@ -10,10 +10,7 @@
%span.from %span.from
= link_to person.real_name, person_path(person) = link_to person.real_name, person_path(person)
.info .right{:style=>"display:inline;"}
= person.diaspora_handle
.right{ :style => "display:inline;top:0;" }
- if person.id == current_user.person.id - if person.id == current_user.person.id
thats you! thats you!
- elsif current_user.friends.include?(person) - elsif current_user.friends.include?(person)
@ -25,3 +22,7 @@
= f.select(:aspect_id, @aspects_dropdown_array) = f.select(:aspect_id, @aspects_dropdown_array)
= f.hidden_field :destination_url, :value => person.diaspora_handle = f.hidden_field :destination_url, :value => person.diaspora_handle
= f.submit t('.add_friend') = f.submit t('.add_friend')
.info
= person.diaspora_handle

View file

@ -2,23 +2,13 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
- content_for :publish do .span-15.prepend-5.last
%h1 %h2
Search
=form_tag '/people', :method => "get" do
= text_field_tag :q, params[:q]
= submit_tag "search"
- content_for :left_pane do
\.
%h1
search results for search results for
%u= params[:q] %u= params[:q]
%ul#stream %ul#stream
- for person in @people - for person in @people
= render 'people/person', :person => person = render 'people/person', :person => person
= will_paginate @people = will_paginate @people

View file

@ -5,7 +5,8 @@
- content_for :page_title do - content_for :page_title do
profile profile
- content_for :left_pane do .span-4.append-1.last
%h2= @person.real_name
#profile #profile
.profile_photo .profile_photo
= person_image_link(@person) = person_image_link(@person)
@ -26,12 +27,12 @@
- if @person != current_user.person && current_user.friends.include?(@person) - if @person != current_user.person && current_user.friends.include?(@person)
= link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button" = link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
.span-20.last .span-15.last
.span-19.last - if @posts.count > 0
- if @posts
%ul#stream %ul#stream
- for post in @posts - for post in @posts
= render type_partial(post), :post => post unless post.class == Album = render type_partial(post), :post => post unless post.class == Album
= will_paginate @posts = will_paginate @posts
- else - else
%h3=t('no posts to display!') %h3=t('no posts to display!')

View file

@ -18,6 +18,10 @@
- for aspect in current_user.aspects_with_post( post.id ) - for aspect in current_user.aspects_with_post( post.id )
%li= link_to aspect.name, aspect %li= link_to aspect.name, aspect
- if current_user.owns?(post)
.right
= link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
=t('.posted_a_new_photo_to') =t('.posted_a_new_photo_to')
= link_to post.album.name, object_path(post.album) = link_to post.album.name, object_path(post.album)

View file

@ -54,14 +54,12 @@
});//end document ready });//end document ready
= content_for :page_title do .span-4.append-1.last
= link_to "◂ #{@photo.album.name}", @photo.album
- content_for :left_pane do
= render "shared/aspect_friends" = render "shared/aspect_friends"
- content_for :publish do .span-19.last
%h1 %h3
= link_to @photo.album.name, @photo.album
= @photo.image = @photo.image
= link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch' = link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch'
@ -70,11 +68,13 @@
| |
= link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch' = link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch'
.right
-if current_user.owns? @album -if current_user.owns? @album
= link_to t('.edit_photo'), edit_photo_path(@photo), :class => "button" = link_to t('.edit_photo'), edit_photo_path(@photo), :class => "button"
%div{:id => @photo.id} %br
%br
%div{:id => @photo.id}
#show_photo #show_photo
= linked_scaled_photo @photo, @album = linked_scaled_photo @photo, @album
.caption .caption
@ -94,6 +94,10 @@
= p.submit = p.submit
%div{:class => 'clear'} %div{:class => 'clear'}
%h4{:class => "show_post_comments"}
= "#{t('.comments')} (#{@photo.comments.count})"
= render "comments/comments", :post => @photo
#content_bottom #content_bottom
.back .back
= link_to "⇧ #{@album.name}", album_path(@album) = link_to "⇧ #{@album.name}", album_path(@album)
@ -102,7 +106,4 @@
.right .right
= link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button' = link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button'
%h4{:class => "show_post_comments"}
= "#{t('.comments')} (#{@photo.comments.count})"
= render "comments/comments", :post => @photo

View file

@ -28,7 +28,7 @@
%br %br
%br %br
%ul %ul
%li= link_to 'stream', aspect_path(@aspect) %li= link_to 'stream', aspect_or_all_path(@aspect)
%li= link_to t('.photos'), albums_path(:aspect => @aspect) %li= link_to t('.photos'), albums_path(:aspect => @aspect)
%br %br

View file

@ -9,12 +9,14 @@
- for aspect in @aspects - for aspect in @aspects
%li{:class => ("selected" if current_aspect?(aspect))} %li{:class => ("selected" if current_aspect?(aspect))}
= link_for_aspect aspect = link_for_aspect aspect
%li
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button"
%ul{ :style => "position:absolute;right:0;bottom:0.01em;"} %ul{ :style => "position:absolute;right:0;bottom:0.01em;"}
%li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)} %li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)}
= link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects') = link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects')
.yo{ :style => "display:none;"} .fancybox_content
#add_aspect_pane #add_aspect_pane
= render "aspects/new_aspect" = render "aspects/new_aspect"

View file

@ -19,7 +19,7 @@
%li= link_to aspect.name, aspect %li= link_to aspect.name, aspect
- if current_user.owns?(post) - if current_user.owns?(post)
.destroy_link .right
= render "shared/reshare", :post => post, :current_user => current_user = render "shared/reshare", :post => post, :current_user => current_user
= link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete" = link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
:javascript :javascript
$("#settings_nav li > a").click( function() { $("#settings_nav li > a").live("click", function() {
var target = "#"+$(this).attr('class'); var target = "#"+$(this).attr('class');
if( !$(target).is(":visible") ) { if( !$(target).is(":visible") ) {
$(".settings_pane").fadeOut(200, function() { $(".settings_pane").fadeOut(200, function() {
@ -12,22 +12,21 @@
} }
}); });
#section_header
- content_for :publish do %h2
%h2="#{t('.editing_profile')}" Settings
- content_for :left_pane do
%ul#settings_nav %ul#settings_nav
%li=link_to 'Profile', '#', :class => 'profile' %li=link_to 'Profile', '#', :class => 'profile'
%li=link_to 'Account', '#', :class => 'account' %li=link_to 'Account', '#', :class => 'account'
%li=link_to 'Services', '#', :class => 'services' %li=link_to 'Services', '#', :class => 'services'
#profile.settings_pane{:style=>"display:block;"} .span-19.prepend-5.last
#profile.settings_pane{:style=>"display:block;"}
= render 'users/profile' = render 'users/profile'
#account.settings_pane #account.settings_pane
= render 'users/account' = render 'users/account'
#services.settings_pane #services.settings_pane
= render 'users/services' = render 'users/services'

View file

@ -79,13 +79,14 @@ en:
friends_albums: "Friends Albums" friends_albums: "Friends Albums"
your_albums: "Your Albums" your_albums: "Your Albums"
aspects: aspects:
empty_messages: no_friends_message:
start_talking: "Nobody has said anything yet. Get the conversation started!"
nobody: "We know you have friends, bring them to Diaspora!" nobody: "We know you have friends, bring them to Diaspora!"
nobody_in_aspect: "Your aspect '%{aspect_name}' is empty." nobody_in_aspect: "Your aspect '%{aspect_name}' is empty."
add_friend: "Add a friend" add_friend: "Add a friend"
add_friend_to: "Add someone to %{aspect_name}" add_friend_to: "Add someone to %{aspect_name}"
invite: "Invite someone to join Diaspora!" invite: "Invite someone to join Diaspora!"
no_posts_message:
start_talking: "Nobody has said anything yet. Get the conversation started!"
manage: manage:
add_a_new_aspect: "Add a new aspect" add_a_new_aspect: "Add a new aspect"
add_a_new_friend: "Add a new friend" add_a_new_friend: "Add a new friend"
@ -149,6 +150,8 @@ en:
photo: photo:
show_comments: "show comments" show_comments: "show comments"
posted_a_new_photo_to: "posted a new photo to" posted_a_new_photo_to: "posted a new photo to"
delete: "Delete"
are_you_sure: "Are you sure?"
new: new:
new_photo: "New Photo" new_photo: "New Photo"
back_to_list: "Back to List" back_to_list: "Back to List"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -26,7 +26,7 @@ $(document).ready(function(){
}); });
//buttons////// //buttons//////
$("#add_aspect_button").fancybox({ 'titleShow' : false , 'hideOnOverlayClick' : false }); $(".add_aspect_button").fancybox({ 'titleShow' : false , 'hideOnOverlayClick' : false });
$("#add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $("#add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
$(".invite_user_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".invite_user_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
$(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });

View file

@ -187,6 +187,7 @@ ul#stream
:min-height 50px :min-height 50px
:list-style none :list-style none
:padding 12px 0 :padding 12px 0
:right 12px
:border :border
:bottom 1px solid #eee :bottom 1px solid #eee
@ -195,11 +196,8 @@ ul#stream
:color #fafafa :color #fafafa
:border :border
:bottom 1px solid #ddd :bottom 1px solid #ddd
.destroy_link
:display inline
.right .right
:top 0 :display inline
.avatar .avatar
:border-radius 5px :border-radius 5px
@ -216,9 +214,6 @@ li.message
:margin :margin
:right 15px :right 15px
.delete:hover
:background #eee
.content .content
:margin :margin
:top -4px :top -4px
@ -292,14 +287,14 @@ li.message
:color #005D9C :color #005D9C
.destroy_link .reshare_pane .reshare_button a.inactive .right .reshare_pane .reshare_button a.inactive
:color #ccc :color #ccc
&:hover &:hover
:text :text
:decoration none :decoration none
:cursor default :cursor default
.destroy_link .reshare_pane .right .reshare_pane
:margin :margin
:left 5px :left 5px
:right 5px :right 5px
@ -495,12 +490,13 @@ ul.comment_set
a a
:padding 3px :padding 3px
li.message .from .destroy_link li.message .from .right
:display none :display none
:position absolute :position absolute
:right 0 :right 12px
:font :font
:size 12px :size 12px
:color #999
a a
:color #999 :color #999
:font :font
@ -941,22 +937,20 @@ h1.big_text
:opacity 0.9 :opacity 0.9
ul#settings_nav ul#settings_nav
:display inline
:list :list
:style none :style none
:padding 0 :padding 0
:marign 0
:font :font
:size larger :size large
:margin
:left 5.68em
> li > li
:display inline
:margin
:right 1em
a a
:font
:size smaller
:display block
:height 100%
:border
:bottom 1px solid #eee
:padding 2px :padding 2px
@ -1036,3 +1030,17 @@ header
.edit_photo .edit_photo
:display none :display none
#section_header
:width 100%
:border
:bottom 2px solid #777
:position relative
:margin
:bottom 2em
:padding
:bottom 1em
h2
:display inline

View file

@ -39,6 +39,21 @@ describe Aspect do
end end
end end
describe 'validation' do
before do
@aspect = @user.aspect(:name => 'losers')
end
it 'has a unique name for one user' do
aspect2 = @user.aspect(:name => @aspect.name)
aspect2.valid?.should be_false
end
it 'has no uniqueness between users' do
aspect2 = @user2.aspect(:name => @aspect.name)
aspect2.valid?.should be_true
end
end
describe 'querying' do describe 'querying' do
before do before do
@aspect = @user.aspect(:name => 'losers') @aspect = @user.aspect(:name => 'losers')

View file

@ -14,11 +14,6 @@ describe Person do
end end
describe '#diaspora_handle' do describe '#diaspora_handle' do
it 'should downcase and strip the handle before it saves' do
p = Factory.build(:person, :diaspora_handle => " FOOBaR@example.com ")
p.save
p.diaspora_handle.should == "foobar@example.com"
end
context 'local people' do context 'local people' do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do
@user.person.diaspora_handle.should == @user.username + "@" + APP_CONFIG[:terse_pod_url] @user.person.diaspora_handle.should == @user.username + "@" + APP_CONFIG[:terse_pod_url]
@ -30,11 +25,17 @@ describe Person do
@person.diaspora_handle.include?(APP_CONFIG[:terse_pod_url]).should be false @person.diaspora_handle.include?(APP_CONFIG[:terse_pod_url]).should be false
end end
end end
describe 'validation' do
it 'is unique' do
person_two = Factory.build(:person, :url => @person.diaspora_handle)
person_two.valid?.should be_false
end end
it 'should not allow two people with the same diaspora_handle' do it 'is case insensitive' do
person_two = Factory.build(:person, :url => @person.diaspora_handle) person_two = Factory.build(:person, :url => @person.diaspora_handle.upcase)
person_two.valid?.should == false person_two.valid?.should be_false
end
end
end end
describe 'xml' do describe 'xml' do
@ -52,7 +53,7 @@ describe Person do
end end
end end
it 'should know when a post belongs to it' do it '#owns? posts' do
person_message = Factory.create(:status_message, :person => @person) person_message = Factory.create(:status_message, :person => @person)
person_two = Factory.create(:person) person_two = Factory.create(:person)
@ -188,6 +189,12 @@ describe Person do
person = Person.by_webfinger(user.person.diaspora_handle) person = Person.by_webfinger(user.person.diaspora_handle)
person.should == user.person person.should == user.person
end end
it "is case insensitive" do
user = Factory(:user, :username => "SaMaNtHa")
person = Person.by_webfinger(user.person.diaspora_handle.upcase)
person.should == user.person
end
end end
it 'creates a stub for a remote user' do it 'creates a stub for a remote user' do

View file

@ -83,11 +83,6 @@ describe User do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do
user.diaspora_handle.should == user.username + "@" + APP_CONFIG[:terse_pod_url] user.diaspora_handle.should == user.username + "@" + APP_CONFIG[:terse_pod_url]
end end
it 'should be lowercase, even if username is uppercase' do
user.username = "fooBAR"
user.diaspora_handle.should == (user.username + "@" + APP_CONFIG[:terse_pod_url]).downcase
end
end end
context 'profiles' do context 'profiles' do