Merge branch 'master' of http://github.com/diaspora/diaspora
This commit is contained in:
commit
03f8cbc249
35 changed files with 151 additions and 158 deletions
|
|
@ -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.
|
||||
* files in the program, then also delete it here.
|
||||
|
|
|
|||
19
README.md
19
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
|
||||
module DashboardsHelper
|
||||
|
||||
def title_for_page
|
||||
'home'
|
||||
'home'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -33,7 +33,4 @@ module SocketsHelper
|
|||
|
||||
action_hash.to_json
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')}"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|
||||
- content_for :page_title do
|
||||
= @person.real_name
|
||||
profile
|
||||
|
||||
- content_for :left_pane do
|
||||
#profile
|
||||
|
|
|
|||
|
|
@ -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;"}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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-----
|
||||
|
|
@ -1 +0,0 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvCyAkyAMbn+flqwLIEnPL08iY8dWpkel1wtXXjUtaINjuvZ72XwK7ntnVHVRm49t+QFMWh8SpxDHnJDgb3X6uYem2DzB6L8HtuFVFN5lOUi+TeiILJsBmiGHc1tQwGB0jqmCG0J2QBDpDiw//ktOJNlZJfnPGY+4viSXwWpYhhh1v3ijInmp0+lw7z0+TyklNGVEsr6emwkgo5t20ClAQDmwy1BeYBcmtAehF55V3aSPQt1d+hCmwl11PR6BLuGYgRirr4Xyc/GmyZVKkz8dLv40X+/Bk2D7owO+N5hf74EB1e3r7Vu7LAfUOdtOFQJV5SWr3HTPo5vvU1oqR4VViQ== Diaspora deploy key
|
||||
|
|
@ -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==
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;}
|
||||
.qq-upload-fail .qq-upload-failed-text {display:inline;}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue