diff --git a/COPYRIGHT b/COPYRIGHT
index 243dd1066..c1e5ed876 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1 +1 @@
-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 relevand 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, 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.
diff --git a/README.md b/README.md
index 5252f5670..d941ac182 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
## Commit Guidlines
You are welcome to contribute, add and extend Diaspora however you see fit. We will do our best to incorporate everything that meets our guidelines.
+We need you to fill out a [contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq) before we can accept your patches. The agreement gives Diaspora joint ownership of the patch so the copyright isn't scattered. You can find it [here](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq).
+
All commits must be tested, and after each commit, all tests should be green before a pull request is sent. Please write your tests in Rspec or Test-Unit.
GEMS: We would like to keep external dependencies unduplicated. We're using Nokogiri, and Mongomapper, and EM::HttpRequest as much as possible. We have a few gems in the project we'd rather not use, but if you can, use dependencies we already have.
@@ -10,6 +12,13 @@ GEMS: We would like to keep external dependencies unduplicated. We're using No
The privacy aware, personally controlled, do-it-all, open source social network.
**DISCLAIMER: THIS IS PRE-ALPHA SOFTWARE AND SHOULD BE TREATED ACCORDINGLY.**
+**PLEASE, DO NOT RUN IN PRODUCTION. IT IS FUN TO GET RUNNING, BUT EXPECT THINGS TO BE BROKEN**
+
+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.
+
+
+
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.
## Preparing your system
@@ -145,13 +154,13 @@ To install Git on **Mac OS X**, run the following:
### Rubygems
-On **Ubuntu**, run the following:
+On **Ubuntu** 10.04, run the following:
- wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
- tar -xf rubygems-1.3.7.tgz
- cd rubygems-1.3.7
- sudo ruby setup.rb
- sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
+ sudo add-apt-repository ppa:maco.m/ruby
+ sudo apt-get update
+ sudo apt-get install rubygems
+
+This PPA is maintained by an Ubuntu Developer. For Ubuntu 10.10, this version of rubygems is in the repositories.
On **Fedora**, run the following:
@@ -162,7 +171,7 @@ On **Mac OS X**, RubyGems comes preinstalled; however, you might need to update
### Bundler
-After RubyGems is updated, simply run `sudo gem install bundler` to get Bundler.
+After RubyGems is updated, simply run `sudo gem install bundler` to get Bundler. If you're using Ubuntu repository .debs, bundler is found at /var/lib/gems/1.8/bin/bundle
## Getting Diaspora
@@ -182,6 +191,8 @@ If you installed the Ubuntu package, MongoDB should already be running (if not,
If you installed the Fedora package, MongoDB will need to be started via `service mongodb start`. If you installed the binary manually, run `sudo mongod` from where mongo is installed to start mongo.
+If you installed the OsX package through "brew", MongoDB will need to be started via `sudo launchctl load /Library/LaunchDaemons/org.mongodb.mongod.plist`. (before you have to go to /Library/LaunchDaemons and add a symlink to /usr/local/Cellar/mongodb/1.6.2-x86_64/org.mongodb.mongod.plist)
+
Diaspora will not run unless mongo is running. Mongo will not run by default, and will need to be started every time you wish to use or run the test suite for Diaspora.
### Run the app server
@@ -199,13 +210,15 @@ Diaspora's test suite uses [rspec](http://rspec.info/), a behavior driven testin
We are maintaining a [public tracker project](http://www.pivotaltracker.com/projects/61641) and a [roadmap](https://github.com/diaspora/diaspora/wiki/Roadmap). Also, you can file [bug reports](https://github.com/diaspora/diaspora/issues) right here on github.
Ongoing discussion:
-
- [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev)
- [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss)
+- [Diaspora Q&A site](http://diaspora.shapado.com/)
- [#diaspora-dev](irc://irc.freenode.net/#diaspora-dev)
More general info and updates about the project can be found on our [blog](http://joindiaspora.com), [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.
diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
index 5a75616d1..c4bab3d8a 100644
--- a/app/controllers/albums_controller.rb
+++ b/app/controllers/albums_controller.rb
@@ -46,7 +46,7 @@ class AlbumsController < ApplicationController
end
def update
- @album = Album.find_params_by_id params[:id]
+ @album = Album.find_by_id params[:id]
if @album.update_attributes params[:album]
flash[:notice] = "Album #{@album.name} successfully edited."
respond_with @album
diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb
index 87c41f097..ab144ad12 100644
--- a/app/controllers/aspects_controller.rb
+++ b/app/controllers/aspects_controller.rb
@@ -26,9 +26,15 @@ class AspectsController < ApplicationController
def destroy
@aspect = Aspect.find_by_id params[:id]
- @aspect.destroy
- flash[:notice] = "You are no longer sharing the aspect called #{@aspect.name}."
- respond_with :location => aspects_url
+
+ begin
+ current_user.drop_aspect @aspect
+ flash[:notice] = "#{@aspect.name} was successfully removed."
+ rescue RuntimeError => e
+ flash[:error] = e.message
+ end
+
+ respond_with :location => aspects_manage_path
end
def show
@@ -41,7 +47,7 @@ class AspectsController < ApplicationController
def manage
@aspect = :manage
- @remote_requests = Request.for_user current_user
+ @remote_requests = Request.for_user(current_user).all
end
def update
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6c4240578..f2a0a95fd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -10,6 +10,7 @@ module ApplicationHelper
end
def object_path(object, opts = {})
+ object = object.person if object.is_a? User
eval("#{object.class.to_s.underscore}_path(object, opts)")
end
diff --git a/app/helpers/aspects_helper.rb b/app/helpers/aspects_helper.rb
index adceab8fd..1c8f69b8a 100644
--- a/app/helpers/aspects_helper.rb
+++ b/app/helpers/aspects_helper.rb
@@ -7,4 +7,12 @@ module AspectsHelper
def link_for_aspect( aspect )
link_to aspect.name, aspect
end
+
+ def remove_link( aspect )
+ if aspect.people.size == 0
+ link_to "remove", aspect, :method => :delete
+ else
+ "remove"
+ end
+ end
end
diff --git a/app/models/person.rb b/app/models/person.rb
index bed5bb246..48e8b0816 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -85,6 +85,7 @@ class Person
local_person
elsif !identifier.include?("localhost") && !opts[:local]
begin
+ puts "begin finger"
f = Redfinger.finger(identifier)
rescue SocketError => e
raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/
diff --git a/app/models/user.rb b/app/models/user.rb
index 6a76ce772..718d23674 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -65,6 +65,15 @@ class User
Aspect.create(opts)
end
+ def drop_aspect( aspect )
+ if aspect.people.size == 0
+ aspect.destroy
+ else
+ raise "Aspect not empty"
+ end
+ end
+
+
def move_friend( opts = {})
return true if opts[:to] == opts[:from]
friend = Person.first(:_id => opts[:friend_id])
@@ -286,9 +295,13 @@ class User
###Helpers############
def self.instantiate!( opts = {} )
- opts[:person][:diaspora_handle] = "#{opts[:username]}@#{URI::parse(opts[:url]).host}"
+ hostname = opts[:url].gsub(/(https?:|www\.)\/\//, '')
+ hostname.chop! if hostname[-1, 1] == '/'
+
+ opts[:person][:diaspora_handle] = "#{opts[:username]}@#{hostname}"
+ puts opts[:person][:diaspora_handle]
opts[:person][:serialized_key] = generate_key
- User.create!(opts)
+ User.create(opts)
end
def seed_aspects
@@ -296,10 +309,6 @@ class User
aspect(:name => "Work")
end
- def self.create(opts ={})
- puts opts.inspect
- end
-
def terse_url
terse = self.url.gsub(/(https?:|www\.)\/\//, '')
terse = terse.chop! if terse[-1, 1] == '/'
diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml
index 8a6ed97ac..667196b85 100644
--- a/app/views/aspects/manage.html.haml
+++ b/app/views/aspects/manage.html.haml
@@ -12,7 +12,7 @@
Requests
.requests
- %ul
+ %ul.dropzone
- for request in @remote_requests
%li.requested_person{:id => request.person.id, :request_id => request.id}
= person_image_tag(request.person)
@@ -22,7 +22,7 @@
Ignore/Remove
%li.remove
- %ul
+ %ul.dropzone
- content_for :publish do
= link_to("add a new aspect", "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => "Add a new aspect")
@@ -36,12 +36,12 @@
.aspect_name
%h1{:contenteditable => true}= aspect.name
- .tools
- = link_to "add a new friend", "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
- |
- = link_to "show", aspect_path(aspect)
+ %ul.tools
+ %li= link_to "add a new friend", "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
+ %li= link_to "show", aspect_path(aspect)
+ %li!= remove_link(aspect)
- %ul{:id => aspect.id}
+ %ul.dropzone{:id => aspect.id}
-if aspect.people.size < 1
%li.grey Drag to add people
diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml
index 483621625..33af68cce 100644
--- a/app/views/js/_websocket_js.haml
+++ b/app/views/js/_websocket_js.haml
@@ -9,7 +9,7 @@
$(document).ready(function(){
function debug(str){ $("#debug").append("
" + str); };
- ws = new WebSocket("ws://#{request.host}:8080/#{CGI::escape(current_user.id.to_s)}");
+ ws = new WebSocket("ws://#{request.host}:#{APP_CONFIG[:socket_port]}/#{CGI::escape(current_user.id.to_s)}");
//Attach onmessage to websocket
ws.onmessage = function(evt) {
diff --git a/app/views/posts/_debug.haml b/app/views/posts/_debug.haml
index 27d508cf2..17d7baad8 100644
--- a/app/views/posts/_debug.haml
+++ b/app/views/posts/_debug.haml
@@ -7,6 +7,9 @@
%h5 DEBUG INFO
#debug_more{ :style => "display:none;" }
%ul
+ %li
+ %b
+ = GIT_INFO
%li
%b params
= params.inspect
@@ -14,3 +17,4 @@
%b websocket status
#debug
.msg
+
diff --git a/config/application.rb b/config/application.rb
index ef8a567a5..b409f91d3 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -6,9 +6,9 @@
require File.expand_path('../boot', __FILE__)
-require "action_controller/railtie"
-require "action_mailer/railtie"
-require "active_resource/railtie"
+require 'action_controller/railtie'
+require 'action_mailer/railtie'
+require 'active_resource/railtie'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
diff --git a/config/environment.rb b/config/environment.rb
index dc11087dd..385a96651 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -7,6 +7,7 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5
+Haml::Template.options[:escape_html] = true
# Initialize the rails application
Diaspora::Application.initialize!
diff --git a/config/initializers/git_info.rb b/config/initializers/git_info.rb
new file mode 100644
index 000000000..a6d767aa4
--- /dev/null
+++ b/config/initializers/git_info.rb
@@ -0,0 +1,6 @@
+# Copyright (c) 2010, Diaspora Inc. This file is
+# licensed under the Affero General Public License version 3. See
+# the COPYRIGHT file.
+
+
+GIT_INFO = `git show`
diff --git a/config/initializers/socket.rb b/config/initializers/socket.rb
index 1fd09fd93..0b1035001 100644
--- a/config/initializers/socket.rb
+++ b/config/initializers/socket.rb
@@ -5,7 +5,7 @@
require 'em-websocket'
require 'eventmachine'
-require "lib/diaspora/websocket"
+require 'lib/diaspora/websocket'
EM.next_tick {
Diaspora::WebSocket.initialize_channels
diff --git a/config/sprinkle/provision.rb b/config/sprinkle/provision.rb
index 9f983399e..ce0fd7374 100644
--- a/config/sprinkle/provision.rb
+++ b/config/sprinkle/provision.rb
@@ -7,11 +7,11 @@
-require "#{File.dirname(__FILE__)}/packages/essential"
-require "#{File.dirname(__FILE__)}/packages/database"
-require "#{File.dirname(__FILE__)}/packages/server"
-require "#{File.dirname(__FILE__)}/packages/scm"
-require "#{File.dirname(__FILE__)}/packages/ruby"
+require '#{File.dirname(__FILE__)}/packages/essential'
+require '#{File.dirname(__FILE__)}/packages/database'
+require '#{File.dirname(__FILE__)}/packages/server'
+require '#{File.dirname(__FILE__)}/packages/scm'
+require '#{File.dirname(__FILE__)}/packages/ruby'
policy :diaspora, :roles => [:tom,:backer] do
# requires :clean_dreamhost
diff --git a/lib/diaspora/user/friending.rb b/lib/diaspora/user/friending.rb
index cf55a2bf0..e79608381 100644
--- a/lib/diaspora/user/friending.rb
+++ b/lib/diaspora/user/friending.rb
@@ -62,7 +62,7 @@ module Diaspora
def receive_friend_request(friend_request)
Rails.logger.info("receiving friend request #{friend_request.to_json}")
- if request_from_me?(friend_request)
+ if request_from_me?(friend_request) && self.aspect_by_id(friend_request.aspect_id)
aspect = self.aspect_by_id(friend_request.aspect_id)
activate_friend(friend_request.person, aspect)
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index e1c0aac31..22f995325 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -22,6 +22,7 @@ namespace :db do
require 'db/seeds/backer'
create
end
+
end
desc 'Delete the collections in the current RAILS_ENV database'
@@ -53,4 +54,22 @@ namespace :db do
Rake::Task['db:seed:dev'].invoke
puts "you did it!"
end
+
+ task :fix_diaspora_handle do
+ puts "fixing the people in this seed"
+ require 'config/environment'
+
+ people = Person.all( '$where' => "function(){
+ return this.diaspora_handle.charAt(this.diaspora_handle.length-1) == '@'
+ }")
+
+ people.each do |person|
+ if person.owner
+ puts "Resetting diaspora handle for #{person.owner.username}"
+ person.diaspora_handle = person.owner.diaspora_handle
+ person.save
+ end
+ end
+ puts "everything should be peachy"
+ end
end
diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js
index e1d9b6c6c..86c61ba93 100644
--- a/public/javascripts/aspect-edit.js
+++ b/public/javascripts/aspect-edit.js
@@ -39,6 +39,7 @@ $(function() {
});
$(".aspect ul").droppable({
+ hoverClass: 'active',
drop: function(event, ui) {
if ($(ui.draggable[0]).hasClass('requested_person')){
@@ -69,6 +70,7 @@ $(function() {
});
$(".remove ul").droppable({
+ hoverClass: 'active',
drop: function(event, ui) {
if ($(ui.draggable[0]).hasClass('requested_person')){
@@ -91,7 +93,7 @@ $(function() {
});
});
-$(".aspect h1").live( 'click', function() {
+$(".aspect h1").live( 'focus', function() {
var $this = $(this);
var id = $this.closest("li").children("ul").attr("id");
diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.js
index 688f93aa3..e9b4f404b 100755
--- a/public/javascripts/fancybox/jquery.fancybox-1.3.1.js
+++ b/public/javascripts/fancybox/jquery.fancybox-1.3.1.js
@@ -262,6 +262,11 @@
close.show();
}
+ $("#fancybox-inner input[type='text'], #fancybox-inner textarea").focus(function() {
+ $(document).unbind('keydown.fb');
+ });
+
+
fancybox_set_navigation();
$(window).bind("resize.fb", $.fancybox.center);
@@ -1074,4 +1079,4 @@
fancybox_init();
});
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js
index 8421d53a6..8efd14070 100755
--- a/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js
+++ b/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js
@@ -14,31 +14,6 @@
* http://www.gnu.org/licenses/gpl.html
*/
-(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("