diff --git a/COPYRIGHT b/COPYRIGHT index af330bbc2..8a380cc7e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,4 +1,4 @@ -Diaspora is copyright Diaspora Inc., 2010, and files herein are licensed under the Affero General Public License version 3, the text of which can be found in GNU-AGPL-3.0, unless otherwise noted. Components of Diaspora, including Rails, JQuery, and Devise, are licensed under the MIT/X11 license. Blueprint-CSS is licensed under a modified version of the MIT/X11 license. All unmodified files from these and other sources retain their original copyright and license notices: see the relevant individual files. Attribution information for Diaspora is contained in the AUTHORS file. +Diaspora is copyright Diaspora Inc., 2010, and files herein are licensed under the Affero General Public License version 3, the text of which can be found in GNU-AGPL-3.0, or any later version of the AGPL, unless otherwise noted. Components of Diaspora, including Rails, JQuery, and Devise, are licensed under the MIT/X11 license. Blueprint-CSS is licensed under a modified version of the MIT/X11 license. All unmodified files from these and other sources retain their original copyright and license notices: see the relevant individual files. Attribution information for Diaspora is contained in the AUTHORS file. * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the @@ -11,4 +11,4 @@ Diaspora is copyright Diaspora Inc., 2010, and files herein are licensed under t * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source -* files in the program, then also delete it here. \ No newline at end of file +* files in the program, then also delete it here. diff --git a/README.md b/README.md index 0bc06f27f..0ae9faff1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,14 @@ The privacy aware, personally controlled, do-it-all, open source social network. Also, we really want to continue to focus on features and improving the code base. When we think it is ready for general use, we will post more detailed instructions. +## Notice + +We currently run Diaspora with the [thin](http://code.macournoyer.com/thin/) as our webserver, behind [nginx](http://wiki.nginx.org/Main). Diaspora uses the asynchronous feature of [EventMachine](http://rubyeventmachine.com/) to send messages between seeds, + +using the power of the [Reactor](http://en.wikipedia.org/wiki/Reactor_pattern) pattern. If you use mod_rails, mongrel, or another non-eventmachine based application server, federation and/or websockets may not work. + +If you don't like thin, you can always try [Rainbows!](http://rainbows.rubyforge.org/) +We will try and fully support more webservers later, but that is what works for now. These instructions are for machines running [Ubuntu](http://www.ubuntu.com/), [Fedora](http://www.fedoraproject.org) or Mac OS X. We are developing Diaspora for the latest and greatest browsers, so please update your Firefox, Chrome or Safari to the latest and greatest. @@ -235,14 +243,3 @@ Ongoing discussion: More general info and updates about the project can be found on our [blog](http://joindiaspora.com), [and on Twitter](http://twitter.com/joindiaspora). Also, be sure to join the official [mailing list](http://http://eepurl.com/Vebk). If you wish to contact us privately about any exploits in Diaspora you may find, you can email [exploits@joindiaspora.com](mailto:exploits@joindiaspora.com). - - -## License -Copyright 2010 Diaspora Inc. - -Diaspora is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -Diaspora is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License along with Diaspora. If not, see . - diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 520485d33..779ce0f6f 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -79,10 +79,10 @@ class AspectsController < ApplicationController end if aspect = current_user.aspect_by_id(params[:to][:to]) flash[:notice] = "You are now showing your friend a different aspect of yourself." - respond_with aspect + render :nothing => true else - flash[:notice] = "You are now showing your friend a different aspect of yourself." - respond_with current_user.visible_person_by_id(params[:friend_id]) + flash[:error] = "Invalid aspect id!" + render aspects_manage_path end end diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 8fa7a3bdf..42b00007c 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -12,6 +12,7 @@ class PhotosController < ApplicationController def create album = Album.find_by_id params[:album_id] + puts params begin @@ -102,13 +103,18 @@ class PhotosController < ApplicationController private def clean_hash(params) - return { - :photo => { - :caption => params[:photo][:caption], - }, - :album_id => params[:album_id], - :user_file => params[:user_file] - } + if params[:photo] + return { + :photo => { + :caption => params[:photo][:caption], + } + } + else + return{ + :album_id => params[:album_id], + :user_file => params[:user_file] + } + end end end diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index 6f2b09c43..d7f4825de 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -10,7 +10,6 @@ class PublicsController < ApplicationController def hcard @person = Person.find_by_id params[:id] - puts @person unless @person.nil? || @person.owner.nil? render 'hcard' end @@ -33,9 +32,10 @@ class PublicsController < ApplicationController render :nothing => true return unless params[:xml] begin - @user = Person.first(:id => params[:id]).owner + person = Person.first(:id => params[:id]) + @user = person.owner rescue NoMethodError => e - Rails.logger.error("Received post #{params[:xml]} for nonexistent person #{params[:id]}") + Rails.logger.error("Received post for nonexistent person #{params[:id]}") return end @user.receive_salmon params[:xml] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 75a13dc6b..2c110f422 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,7 +4,6 @@ module ApplicationHelper - def current_aspect?(aspect) !@aspect.is_a?(Symbol) && @aspect.id == aspect.id end @@ -43,11 +42,11 @@ module ApplicationHelper end def owner_image_tag - person_image_tag(current_user) + person_image_tag(current_user.person) end def owner_image_link - person_image_link(current_user) + person_image_link(current_user.person) end def person_image_tag(person) @@ -68,5 +67,4 @@ module ApplicationHelper def post_yield_tag(post) (':' + post.id.to_s).to_sym end - end diff --git a/app/helpers/dashboards_helper.rb b/app/helpers/dashboards_helper.rb index 542d938ee..ee83d72eb 100644 --- a/app/helpers/dashboards_helper.rb +++ b/app/helpers/dashboards_helper.rb @@ -4,8 +4,7 @@ module DashboardsHelper - def title_for_page - 'home' + 'home' end end diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb index 2d0ddad6e..2737d3a2d 100644 --- a/app/helpers/photos_helper.rb +++ b/app/helpers/photos_helper.rb @@ -4,7 +4,6 @@ module PhotosHelper - def linked_scaled_photo(photo, album) link_to (image_tag photo.url(:scaled_full)), photo_path(album.next_photo(photo)), :rel => "prefetch" end diff --git a/app/helpers/publics_helper.rb b/app/helpers/publics_helper.rb index 9e76f59f7..46e778e2b 100644 --- a/app/helpers/publics_helper.rb +++ b/app/helpers/publics_helper.rb @@ -9,7 +9,6 @@ module PublicsHelper subscriber ||= Subscriber.new(:url => opts[:callback], :topic => opts[:topic]) if subscriber.save - if opts[:verify] == 'sync' 204 elsif opts[:verify] == 'async' diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index 32ce79fd9..faefe1f6e 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -4,7 +4,6 @@ module RequestsHelper - def subscription_mode(profile) if diaspora?(profile) :friend @@ -33,11 +32,11 @@ module RequestsHelper def relationship_flow(identifier) action = :none person = nil + puts identifier person = Person.by_webfinger identifier if person action = (person == current_user.person ? :none : :friend) end { action => person } end - end diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb index cbe465e7b..69135092a 100644 --- a/app/helpers/sockets_helper.rb +++ b/app/helpers/sockets_helper.rb @@ -33,7 +33,4 @@ module SocketsHelper action_hash.to_json end - - - end diff --git a/app/models/person.rb b/app/models/person.rb index 8a6b85175..f2209f0ce 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -35,7 +35,7 @@ class Person /^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix def self.search(query) - query = query.to_s.strip + query = Regexp.escape( query.to_s.strip ) Person.all('profile.first_name' => /^#{query}/i) | Person.all('profile.last_name' => /^#{query}/i) end @@ -78,7 +78,7 @@ class Person def self.by_webfinger( identifier, opts = {}) #need to check if this is a valid email structure, maybe should do in JS - local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', '')) + local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', '').to_s.downcase) if local_person Rails.logger.info("Do not need to webfinger, found a local person #{local_person.real_name}") diff --git a/app/models/user.rb b/app/models/user.rb index f0481341a..e86a98cfb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -96,6 +96,7 @@ class User ######## Posting ######## def post(class_name, options = {}) + puts options.inspect if class_name == :photo raise ArgumentError.new("No album_id given") unless options[:album_id] aspect_ids = aspects_with_post( options[:album_id] ) @@ -105,7 +106,10 @@ class User end aspect_ids = [aspect_ids.to_s] if aspect_ids.is_a? BSON::ObjectId + raise ArgumentError.new("You must post to someone.") if aspect_ids.nil? || aspect_ids.empty? + aspect_ids.each{ |aspect_id| + raise ArgumentError.new("Cannot post to an aspect you do not own.") unless aspect_id == "all" || self.aspects.find(aspect_id) } post = build_post(class_name, options) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index c579671e1..3903039ea 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -38,7 +38,9 @@ %li.aspect .aspect_name - %h1{:contenteditable => true}= aspect.name + %span.edit_name_field + %h1{:contenteditable => true}= aspect.name + %span.tip click to edit %ul.tools %li= link_to "add a new friend", "#add_request_pane_#{aspect.id}", :class => 'add_request_button' @@ -56,13 +58,9 @@ %li.person{:id => person.id, :from_aspect_id => aspect.id} = person_image_tag(person) .name - = person.real_name + = link_to person.real_name, person .yo{:style => 'display:none'} %div{:id => "add_request_pane_#{aspect.id}"} = render "requests/new_request", :aspect => aspect -%p - %br - = link_to 'Update Aspects', '#', :class => 'button', :id => "move_friends_link" - #content_bottom diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 4252d9762..4fd46eb56 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -7,6 +7,6 @@ = person_image_tag(post.person) %span.from = link_to post.person.real_name, post.person - = auto_link sanitize post.text + = post.text %div.time = "#{time_ago_in_words(post.updated_at)} #{t('.ago')}" diff --git a/app/views/people/_person.html.haml b/app/views/people/_person.html.haml index 646d0b333..e0c77d990 100644 --- a/app/views/people/_person.html.haml +++ b/app/views/people/_person.html.haml @@ -8,7 +8,7 @@ .content %span.from - = link_to person.real_name, person + = link_to person.real_name, person_path(person) .info = person.diaspora_handle diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 4f76f18cf..0939bd376 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -4,7 +4,7 @@ - content_for :page_title do - = @person.real_name + profile - content_for :left_pane do #profile diff --git a/app/views/shared/_aspect_nav.haml b/app/views/shared/_aspect_nav.haml index ed3fe6f8f..dbca3bbef 100644 --- a/app/views/shared/_aspect_nav.haml +++ b/app/views/shared/_aspect_nav.haml @@ -6,7 +6,7 @@ #aspect_nav %ul - for aspect in @aspects - %li{:id => aspect.id, :class => ("selected" if current_aspect?(aspect))} + %li{:class => ("selected" if current_aspect?(aspect))} = link_for_aspect aspect %ul{ :style => "position:absolute;right:0;bottom:0.01em;"} diff --git a/app/views/shared/_sub_header.haml b/app/views/shared/_sub_header.haml index badf8783d..4e0e2aca4 100644 --- a/app/views/shared/_sub_header.haml +++ b/app/views/shared/_sub_header.haml @@ -9,7 +9,7 @@ - if @aspect == :all = link_to "All Aspects", root_path - elsif @aspect == :manage - = link_to "Manage Aspects", root_path + = "Manage Aspects" - else = link_to @aspect.name, @aspect diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml index 396f143a7..dcee761d1 100644 --- a/app/views/status_messages/_status_message.html.haml +++ b/app/views/status_messages/_status_message.html.haml @@ -10,7 +10,7 @@ .content %span.from = link_to post.person.real_name, post.person - = auto_link sanitize post.message + = post.message .info %span.time= link_to(how_long_ago(post), object_path(post)) diff --git a/app/views/status_messages/show.html.haml b/app/views/status_messages/show.html.haml index 358c2244b..4a701d6a6 100644 --- a/app/views/status_messages/show.html.haml +++ b/app/views/status_messages/show.html.haml @@ -3,20 +3,14 @@ -# the COPYRIGHT file. -- title "Status Message" - -%p - %strong Message: +%h1 + = link_to @status_message.person.real_name, @status_message.person = @status_message.message -%p - %strong Owner: - = @status_message.person.real_name %h4= "comments (#{@status_message.comments.count})" = render "comments/comments", :post => @status_message %p - = link_to "Destroy", @status_message, :confirm => 'Are you sure?', :method => :delete - | - = link_to "View All", status_messages_path + - if current_user.owns? @status_message + = link_to "Destroy", @status_message, :confirm => 'Are you sure?', :method => :delete diff --git a/config/routes.rb b/config/routes.rb index 188c4b137..ae757499c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,10 +13,11 @@ Diaspora::Application.routes.draw do resources :photos, :except => [:index] resources :albums - match 'aspects/manage', :to => 'aspects#manage' - resources :aspects, :except => [:edit] match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' + match 'aspects/manage', :to => 'aspects#manage' + resources :aspects, :except => [:edit] + match 'warzombie', :to => "dev_utilities#warzombie" match 'zombiefriends', :to => "dev_utilities#zombiefriends" diff --git a/config/sprinkle/deploy_key/id_rsa b/config/sprinkle/deploy_key/id_rsa deleted file mode 100644 index 133715158..000000000 --- a/config/sprinkle/deploy_key/id_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAvCyAkyAMbn+flqwLIEnPL08iY8dWpkel1wtXXjUtaINjuvZ7 -2XwK7ntnVHVRm49t+QFMWh8SpxDHnJDgb3X6uYem2DzB6L8HtuFVFN5lOUi+TeiI -LJsBmiGHc1tQwGB0jqmCG0J2QBDpDiw//ktOJNlZJfnPGY+4viSXwWpYhhh1v3ij -Inmp0+lw7z0+TyklNGVEsr6emwkgo5t20ClAQDmwy1BeYBcmtAehF55V3aSPQt1d -+hCmwl11PR6BLuGYgRirr4Xyc/GmyZVKkz8dLv40X+/Bk2D7owO+N5hf74EB1e3r -7Vu7LAfUOdtOFQJV5SWr3HTPo5vvU1oqR4VViQIBIwKCAQEApqsSy3QoRJzsb4Jw -QStuXRo0ZwEDmpc7HY2zyHg+KV5uRoKK89REMlALEEqnXeVwCG7dOeEB5G3yoJ2T -lewnNpy4WR/e8rfTofrHs2XkoHOhPbCzIDGFE3zIbXzD3ZdCqj5dS1gfl9R2picx -XZMn9MCCKPMzxi7W1ExL5dM4dsOuPRvie+nYGWvvv/LXvFTLFXDVwGXOhfDkLocv -r6STaUMj7RzLJneawOg1YS1Ivsj+Db4Q+abB4mRRhOe6igYu9Zd0ve8XAjJAHbx2 -Kzl5XKj8fhOSwXyLBh+enqHv0yLR7GaZn0odjNdUeWdD0kF9DnsL3VMa12wmNXtu -48bX3wKBgQDzPRDyYmBIKp/eStzAEmkVz98JmQQoX3tF0VrVdLK0j0nLB19jbHl8 -poHaPG8qIgGfFMwdhLOJmJ6CXa4eHffLJ0c32Ow+jQ+Is70Ssn6WSq0962WuuoWA -ARUwhyO9BaWvzTnMCYDI+dSydM26cvDmTTuvCJDbifmAkArgWGqM4wKBgQDGC9za -VTqnfBHGBXebLk/PRA8YOD9CvRrIrjylUxeSrbScK9i6v+1WK3dZCl8j7H3yYJ3B -8CT38FXxrHtGIn+5XU++fAeiLrnmNlYFCsn1nLt2SUqvODYYefxm/Vq1LQaWknHV -itnZF1CIltLLMI2w2iVCA0xRqots6gX+SMarowKBgQC7pCMEIAEhuntTthgB4lEQ -047M48Fg+TM13AQ+RBTUboliG6FbU64s9XodYdIZMC0i8slYmZHQi616gsgl3JqV -Z3F0OaBNgsLXK5HbOT0U2oWky4j0gUJqD3a/CSoyuzasMJpM8WNZNcFWd1zgSgpL -QuTmHI0BIUtxzjRGqptWvQKBgGAxpckiFSzHO9U12wI7ENJi4sKe+ie678CPJMVU -PqZUXwoGqxjg4P332uIa+wLR9AgDCsvpq45eyqiVmvYuA4XrfoEXq++wS6pU5/PS -ClK512VWzID+C6V9FDIGB3ySNmZkYy000DY+hjO2+KvVwSoDjnCFQlONWanuAuk5 -So3hAoGBALfkYFRtSilhvtjOnnil0hdyUbCcRmKeUYl2Yb/cb3JmUfi9xRur7K46 -Okwba+mnOJQT0kefFEUwsP9UPVLgppVh+llyAal1aJ5OnXn1o996TGTfNmy1aThr -aaGeAU2u8GFBiBrz9tRwzZo8ixUEZZrGFFN/n53bDHpBsbhRvHGX ------END RSA PRIVATE KEY----- diff --git a/config/sprinkle/deploy_key/id_rsa.pub b/config/sprinkle/deploy_key/id_rsa.pub deleted file mode 100644 index e0b8e3715..000000000 --- a/config/sprinkle/deploy_key/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvCyAkyAMbn+flqwLIEnPL08iY8dWpkel1wtXXjUtaINjuvZ72XwK7ntnVHVRm49t+QFMWh8SpxDHnJDgb3X6uYem2DzB6L8HtuFVFN5lOUi+TeiILJsBmiGHc1tQwGB0jqmCG0J2QBDpDiw//ktOJNlZJfnPGY+4viSXwWpYhhh1v3ijInmp0+lw7z0+TyklNGVEsr6emwkgo5t20ClAQDmwy1BeYBcmtAehF55V3aSPQt1d+hCmwl11PR6BLuGYgRirr4Xyc/GmyZVKkz8dLv40X+/Bk2D7owO+N5hf74EB1e3r7Vu7LAfUOdtOFQJV5SWr3HTPo5vvU1oqR4VViQ== Diaspora deploy key diff --git a/config/sprinkle/deploy_key/known_hosts b/config/sprinkle/deploy_key/known_hosts deleted file mode 100644 index 6b07b19ca..000000000 --- a/config/sprinkle/deploy_key/known_hosts +++ /dev/null @@ -1,2 +0,0 @@ -|1|1DLdTjtEIabpLiLzhVOp7colQSQ=|/Nw4MuJAYIztcexQDWF3NQoEljs= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -|1|j1rKwLcrA2MgHhcpdVf04ig02Hs=|Y4Jl+8HpsTyFlhSwoVxSVeRsf3k= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb index 2e06913f2..61b2ad44f 100644 --- a/db/seeds/tom.rb +++ b/db/seeds/tom.rb @@ -7,7 +7,7 @@ require 'config/environment' remote_url = "http://tom.joindiaspora.com/" -remote_url = "http://localhost:3000/" +#remote_url = "http://localhost:3000/" # Create seed user user = User.instantiate!( :email => "tom@tom.joindiaspora.com", :username => "tom", diff --git a/lib/diaspora/user/friending.rb b/lib/diaspora/user/friending.rb index e79608381..a4dcdd38d 100644 --- a/lib/diaspora/user/friending.rb +++ b/lib/diaspora/user/friending.rb @@ -86,7 +86,8 @@ module Diaspora def remove_friend(bad_friend) raise "Friend not deleted" unless self.friend_ids.delete( bad_friend.id ) - aspects.each{|g| g.person_ids.delete( bad_friend.id )} + aspects.each{|aspect| + aspect.person_ids.delete( bad_friend.id )} self.save self.raw_visible_posts.find_all_by_person_id( bad_friend.id ).each{|post| diff --git a/lib/message_handler.rb b/lib/message_handler.rb index 7149ee65e..0b55ee0f7 100644 --- a/lib/message_handler.rb +++ b/lib/message_handler.rb @@ -31,7 +31,7 @@ class MessageHandler http.callback { process; process} when :get http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT - http.callback {send_to_seed(query, http.response); process} + http.callback {process} else raise "message is not a type I know!" end @@ -47,10 +47,6 @@ class MessageHandler } unless @queue.size == 0 end - def send_to_seed(message, http_response) - #DO SOMETHING! - end - def size @queue.size end diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index e07877cb7..9f9e5803e 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -20,28 +20,6 @@ function decrementRequestsCounter() { } $(function() { - - - $('#move_friends_link').live( 'click', function(){ - $.post( - '/aspects/move_friends', - { 'moves' : $('#aspect_list').data() }, - function() { - $('#aspect_title').html("Groups edited successfully!"); - } - ); - - // should the following logic be moved into the $.post() callback? - $("#aspect_list").removeData(); - - $(".person") - .css('background-color','none') - .attr('from_aspect_id', function() { - return $(this).parent().attr('id') - }); - - }); - // Multiple classes here won't work $("ul .person").draggable({ revert: true @@ -65,26 +43,24 @@ $(function() { } }); - } else { - var $aspect_list = $('#aspect_list'), - move = {}; - - // This is poor implementation - move[ 'friend_id' ] = ui.draggable[0].id; // ui.draggable.attr('id') - move[ 'to' ] = $(this)[0].id;// $(this).attr('id'); - move[ 'from' ] = ui.draggable[0].getAttribute('from_aspect_id'); // ui.draggable.attr('from_aspect_id') - - // if created custom attr's - should be using `data-foo` - - - if (move['to'] == move['from']){ - $aspect_list.data( ui.draggable[0].id, []); - ui.draggable.css('background-color','#eee'); + }; + var dropzone = $(this)[0]; + + if ($(this)[0].id == ui.draggable[0].getAttribute('from_aspect_id')){ + ui.draggable.css('background','none'); } else { - $aspect_list.data( ui.draggable[0].id, move); ui.draggable.css('background-color','orange'); + $.ajax({ + url: "/aspects/move_friend/", + data: {"friend_id" : ui.draggable[0].id, + "from" : ui.draggable[0].getAttribute('from_aspect_id'), + "to" : { "to" : dropzone.id }}, + success: function(data){ + ui.draggable.attr('from_aspect_id', dropzone.id); + ui.draggable.css('background','none'); + }}); + } - } $(this).closest("ul").append(ui.draggable); } }); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 98893cabb..9e8561cc2 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -346,12 +346,18 @@ label { margin-top: 26px; } #publisher textarea { width: 600px; - height: 40px; + height: 42px; margin-top: 0; margin-bottom: 0; - -webkit-box-shadow: 0 1px 0 white; } + box-shadow: 0 1px white; + -moz-box-shadow: 0 1px white; + -webkit-box-shadow: 0 1px white; } #publisher .button { margin-left: 100px; } + #publisher img { + -webkit-box-shadow: 0 1px 0 white; + border: 1px solid #bbbbbb; + border-top: 1px solid #666666; } #image_picker .small_photo { height: 100px; @@ -463,6 +469,7 @@ h1.big_text { display: inline; margin-right: 2px; } #aspect_nav ul > li a { + text-shadow: 0 2px 0 #444444; -webkit-border-radius: 3px 3px 0 0; -moz-border-radius: 3px 3px 0 0; line-height: 22px; @@ -520,6 +527,16 @@ h1.big_text { .requests h1, .remove h1 { display: inline-block; } + .aspect .tip, + .requests .tip, + .remove .tip { + display: none; + color: #999999; + margin-left: 0.5em; } + .aspect .edit_name_field:hover .tip, + .requests .edit_name_field:hover .tip, + .remove .edit_name_field:hover .tip { + display: inline; } .aspect .aspect_name, .requests .aspect_name, .remove .aspect_name { @@ -547,7 +564,8 @@ h1.big_text { .requests .grey, .remove .grey { color: #999999; - cursor: default; } + cursor: default; + text-shadow: 0 2px white; } .aspect ul.dropzone, .requests ul.dropzone, .remove ul.dropzone { diff --git a/public/stylesheets/fileuploader.css b/public/stylesheets/fileuploader.css index 0e3f111a9..823c1b346 100755 --- a/public/stylesheets/fileuploader.css +++ b/public/stylesheets/fileuploader.css @@ -3,14 +3,14 @@ .qq-upload-button { display:block; /* or inline-block */ width: 105px; padding: 7px 0; text-align:center; - background:#880000; border-bottom:1px solid #ddd;color:#fff; + background:#333; border-bottom:1px solid #999;color:#fff; } -.qq-upload-button-hover {background:#cc0000;} +.qq-upload-button-hover {background:#666;} .qq-upload-button-focus {outline:1px dotted black;} .qq-upload-drop-area { position:absolute; top:0; left:0; width:100%; height:100%; min-height: 70px; z-index:2; - background:#FF9797; text-align:center; + background:#ccc; text-align:center; } .qq-upload-drop-area span { display:block; position:absolute; top: 50%; width:100%; margin-top:-8px; font-size:16px; @@ -28,4 +28,4 @@ .qq-upload-size,.qq-upload-cancel {font-size:11px;} .qq-upload-failed-text {display:none;} -.qq-upload-fail .qq-upload-failed-text {display:inline;} \ No newline at end of file +.qq-upload-fail .qq-upload-failed-text {display:inline;} diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 5edc89135..88145b6df 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -453,16 +453,24 @@ label textarea :width 600px - :height 40px + :height 42px :margin :top 0 :bottom 0 - :-webkit-box-shadow 0 1px 0 #fff + :box-shadow 0 1px #fff + :-moz-box-shadow 0 1px #fff + :-webkit-box-shadow 0 1px #fff .button :margin-left 100px + img + :-webkit-box-shadow 0 1px 0 #fff + :border 1px solid #bbb + :top 1px solid #666 + + #image_picker .small_photo @@ -613,6 +621,7 @@ h1.big_text :right 2px a + :text-shadow 0 2px 0 #444 :-webkit-border-radius 3px 3px 0 0 :-moz-border-radius 3px 3px 0 0 :line @@ -694,6 +703,17 @@ h1.big_text h1 :display inline-block + .tip + :display none + :color #999 + :margin + :left 0.5em + + .edit_name_field:hover + .tip + :display inline + + .aspect_name :position relative @@ -718,6 +738,7 @@ h1.big_text .grey :color #999 :cursor default + :text-shadow 0 2px #fff ul.dropzone :min-height 20px diff --git a/spec/lib/message_handler_spec.rb b/spec/lib/message_handler_spec.rb index 00db2a1b8..e6cd668e2 100644 --- a/spec/lib/message_handler_spec.rb +++ b/spec/lib/message_handler_spec.rb @@ -123,7 +123,6 @@ describe MessageHandler do request = FakeHttpRequest.new(:success) request.should_receive(:get).exactly(1).times.and_return(request) request.should_receive(:post).exactly(1).times.and_return(request) - @handler.should_receive(:send_to_seed).once EventMachine::HttpRequest.stub!(:new).and_return(request) diff --git a/spec/models/user/posting_spec.rb b/spec/models/user/posting_spec.rb index b1f6f71a8..d00747a2d 100644 --- a/spec/models/user/posting_spec.rb +++ b/spec/models/user/posting_spec.rb @@ -30,6 +30,10 @@ describe User do proc {@user.post(:status_message, :message => "heyheyhey")}.should raise_error /You must post to someone/ end + it 'should not be able to post to someone elses aspect' do + proc {@user.post(:status_message, :message => "heyheyhey", :to => @aspect2.id)}.should raise_error /Cannot post to an aspect you do not own./ + end + it 'should put the post in the aspect post array' do post = @user.post(:status_message, :message => "hey", :to => @aspect.id) @aspect.reload diff --git a/spec/models/user/user_friending_spec.rb b/spec/models/user/user_friending_spec.rb index bef8fa416..67ed9f799 100644 --- a/spec/models/user/user_friending_spec.rb +++ b/spec/models/user/user_friending_spec.rb @@ -189,16 +189,14 @@ describe User do @user2 = Factory.create :user @aspect2 = @user2.aspect(:name => "Gross people") - request = @user.send_friend_request_to( @user2, @aspect) - request.reverse_for @user2 - @user2.activate_friend(@user.person, @aspect2) - @user.receive request.to_diaspora_xml + friend_users(@user, @aspect, @user2, @aspect2) + @user.reload + @user2.reload + @aspect.reload + @aspect2.reload end it 'should unfriend the other user on the same seed' do - @user.reload - @user2.reload - @user.friends.count.should == 1 @user2.friends.count.should == 1 @@ -212,6 +210,25 @@ describe User do @aspect.people.count.should == 0 @aspect2.people.count.should == 0 end + context 'with a post' do + before do + @message = @user.post(:status_message, :message => "hi", :to => @aspect.id) + @user2.receive @message.to_diaspora_xml.to_s + @user2.unfriend @user.person + @user.unfriended_by @user2.person + @aspect.reload + @aspect2.reload + @user.reload + @user2.reload + end + it "deletes the unfriended user's posts from visible_posts" do + @user.raw_visible_posts.include?(@message.id).should be_false + end + it "deletes the unfriended user's posts from the aspect's posts" do + pending "We need to implement this" + @aspect2.posts.include?(@message).should be_false + end + end end