From 453cb066917381c664f3db29acd4033df009c738 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:01:30 -0700 Subject: [PATCH 001/101] changing settings and deploy scripts, validating email --- app/models/user.rb | 2 ++ config/environments/production.rb | 9 +++------ config/thin.yml | 6 +++--- db/seeds/tom.rb | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7ab2987d9..80241fbed 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,6 +21,8 @@ class User ######## Making things work ######## key :email, String + validates_true_for :email, :logic => lambda { + email.include?('@pivotallabs.com') || email.include?('@pivotalsf.com')} def method_missing(method, *args) self.person.send(method, *args) diff --git a/config/environments/production.rb b/config/environments/production.rb index 0dc2c9b99..48d9f701a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -10,10 +10,10 @@ Diaspora::Application.configure do config.action_controller.perform_caching = true # Specifies the header that your server uses for sending files - config.action_dispatch.x_sendfile_header = "X-Sendfile" + #config.action_dispatch.x_sendfile_header = "X-Sendfile" # For nginx: - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' + config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # If you have no front-end server that supports something like X-Sendfile, # just comment this out and Rails will serve the files @@ -29,7 +29,7 @@ Diaspora::Application.configure do # Disable Rails's static asset server # In production, Apache or nginx will already do this - config.serve_static_assets = true + #config.serve_static_assets = true # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" @@ -37,9 +37,6 @@ Diaspora::Application.configure do # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false - # Enable threaded mode - # config.threadsafe! - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true diff --git a/config/thin.yml b/config/thin.yml index f60fed103..fa84529dd 100644 --- a/config/thin.yml +++ b/config/thin.yml @@ -8,8 +8,8 @@ require: [] max_persistent_conns: 512 environment: production -servers: 1 +servers: 4 daemonize: true #chdir: /usr/applications/localhash/current -#socket: /tmp/thin.sock -port: 80 +socket: /tmp/thin.sock +#port: 80 diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb index c8b1d41a6..10a7e910e 100644 --- a/db/seeds/tom.rb +++ b/db/seeds/tom.rb @@ -1,6 +1,7 @@ require 'config/environment' remote_url = "http://tom.joindiaspora.com/" +remote_url = "http://localhost:3000/" # Create seed user user = User.create!( :email => "tom@tom.joindiaspora.com", :password => "evankorth", From 29e3fa4d04f34eb6aef2b18fd1e9eb4404c83fc7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:04:34 -0700 Subject: [PATCH 002/101] sprinkle role --- config/sprinkle/provision.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sprinkle/provision.rb b/config/sprinkle/provision.rb index 63302b874..8107f3f6e 100644 --- a/config/sprinkle/provision.rb +++ b/config/sprinkle/provision.rb @@ -33,7 +33,7 @@ require "#{File.dirname(__FILE__)}/packages/ruby" # If there's only one implementation of a virtual package, it's selected automatically, otherwise # the user is requested to select which one to use. -policy :diaspora, :roles => [:tom, :backer] do +policy :diaspora, :roles => [:pivots] do # requires :clean_dreamhost requires :tools requires :rubygems From 16f53922c5d913670655cbddbb32ace95c278ba3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:22:06 -0700 Subject: [PATCH 003/101] nginx conf done, comments deleted --- config/sprinkle/conf/nginx.conf | 7 ++++-- config/sprinkle/packages/server.rb | 32 -------------------------- config/sprinkle/provision.rb | 36 ------------------------------ 3 files changed, 5 insertions(+), 70 deletions(-) diff --git a/config/sprinkle/conf/nginx.conf b/config/sprinkle/conf/nginx.conf index ad79a9b5a..514bc2957 100644 --- a/config/sprinkle/conf/nginx.conf +++ b/config/sprinkle/conf/nginx.conf @@ -28,12 +28,15 @@ http { # gzip_disable "MSIE [1-6]\.(?!.*SV1)"; upstream thin_cluster { server unix:/tmp/thin.0.sock; + server unix:/tmp/thin.1.sock; + server unix:/tmp/thin.2.sock; + server unix:/tmp/thin.3.sock; } server { - listen 80; - server_name babycakes.sofaer.net www.babycakes.sofaer.net; + listen 80 + server_name pivots.joindiaspora.com www.pivots.joindiaspora.com; root /usr/local/app/diaspora/current; location / { diff --git a/config/sprinkle/packages/server.rb b/config/sprinkle/packages/server.rb index 99f326c8b..0b9f416de 100644 --- a/config/sprinkle/packages/server.rb +++ b/config/sprinkle/packages/server.rb @@ -18,35 +18,3 @@ package :nginx_dependencies do apt %w( libc6 libpcre3 libpcre3-dev libssl0.9.8) source "http://zlib.net/zlib-1.2.5.tar.gz" end - -=begin -package :mongrel do - description 'Mongrel Application Server' - gem 'mongrel' - version '1.1.5' -end - -package :mongrel_cluster, :provides => :appserver do - description 'Cluster Management for Mongrel' - gem 'mongrel_cluster' - version '1.0.5' - requires :mongrel -end - -package :apache, :provides => :webserver do - description 'Apache 2 HTTP Server' - version '2.2.15' - - source "http://download.nextag.com/apache/httpd/httpd-#{version}.tar.bz2" do - enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so ) - prefix "/opt/local/apache2-#{version}" - post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults' - end - requires :apache_dependencies -end - -package :apache_dependencies do - description 'Apache 2 HTTP Server Build Dependencies' - apt %w( openssl libtool mawk zlib1g-dev libssl-dev ) -end -=end diff --git a/config/sprinkle/provision.rb b/config/sprinkle/provision.rb index 8107f3f6e..ec1c44c16 100644 --- a/config/sprinkle/provision.rb +++ b/config/sprinkle/provision.rb @@ -1,37 +1,11 @@ #!/usr/bin/env sprinkle -s -# Annotated Example Sprinkle Rails deployment script -# -# This is an example Sprinkle script configured to install Rails from gems, Apache, Ruby, -# Sphinx and Git from source, and mysql and Git dependencies from apt on an Ubuntu system. -# -# Installation is configured to run via capistrano (and an accompanying deploy.rb recipe script). -# Source based packages are downloaded and built into /usr/local on the remote system. -# -# A sprinkle script is separated into 3 different sections. Packages, policies and deployment: - - -# Packages (separate files for brevity) -# -# Defines the world of packages as we know it. Each package has a name and -# set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have -# relationships to each other via dependencies. 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/unfortunately_essential" - -# Policies -# -# Names a group of packages (optionally with versions) that apply to a particular set of roles: -# -# Associates the rails policy to the application servers. Contains rails, and surrounding -# packages. Note, appserver, database, webserver and search are all virtual packages defined above. -# If there's only one implementation of a virtual package, it's selected automatically, otherwise -# the user is requested to select which one to use. policy :diaspora, :roles => [:pivots] do # requires :clean_dreamhost @@ -45,14 +19,6 @@ policy :diaspora, :roles => [:pivots] do requires :vim end -# Deployment -# -# Defines script wide settings such as a delivery mechanism for executing commands on the target -# system (eg. capistrano), and installer defaults (eg. build locations, etc): -# -# Configures spinkle to use capistrano for delivery of commands to the remote machines (via -# the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear -# in /usr/local deployment do @@ -73,5 +39,3 @@ deployment do end end -# End of script, given the above information, Spinkle will apply the defined policy on all roles using the -# deployment settings specified. From 2261a0d8a467d7072760ea5751a8d42445bb8076 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:28:22 -0700 Subject: [PATCH 004/101] nginx... --- config/sprinkle/conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sprinkle/conf/nginx.conf b/config/sprinkle/conf/nginx.conf index 514bc2957..3d8b9cb2a 100644 --- a/config/sprinkle/conf/nginx.conf +++ b/config/sprinkle/conf/nginx.conf @@ -35,7 +35,7 @@ http { server { - listen 80 + listen 80; server_name pivots.joindiaspora.com www.pivots.joindiaspora.com; root /usr/local/app/diaspora/current; From b55a99ec09cc48ef7ce97e466471aa275f272eee Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:42:59 -0700 Subject: [PATCH 005/101] conf changes, kill nginx with go_cold --- config/sprinkle/conf/nginx.conf | 3 --- config/sprinkle/packages/server.rb | 5 ++--- config/sprinkle/provision.rb | 1 + config/thin.yml | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/config/sprinkle/conf/nginx.conf b/config/sprinkle/conf/nginx.conf index 3d8b9cb2a..d76534f37 100644 --- a/config/sprinkle/conf/nginx.conf +++ b/config/sprinkle/conf/nginx.conf @@ -28,9 +28,6 @@ http { # gzip_disable "MSIE [1-6]\.(?!.*SV1)"; upstream thin_cluster { server unix:/tmp/thin.0.sock; - server unix:/tmp/thin.1.sock; - server unix:/tmp/thin.2.sock; - server unix:/tmp/thin.3.sock; } server { diff --git a/config/sprinkle/packages/server.rb b/config/sprinkle/packages/server.rb index 0b9f416de..c553707b3 100644 --- a/config/sprinkle/packages/server.rb +++ b/config/sprinkle/packages/server.rb @@ -1,16 +1,15 @@ -package :nginx do +package :nginx, :provides=> :webserver do description 'Nginx HTTP server' version '0.7.67' source "http://nginx.org/download/nginx-#{version}.tar.gz" requires :nginx_dependencies end -package :nginx_conf, :provides=> :webserver do +package :nginx_conf do description 'Nginx conf file' transfer "#{File.dirname(__FILE__)}/../conf/nginx.conf", '/usr/local/conf/nginx.conf', :render => true do pre :install, "mkdir -p /usr/local/sbin/conf/" end - requires :nginx end package :nginx_dependencies do diff --git a/config/sprinkle/provision.rb b/config/sprinkle/provision.rb index ec1c44c16..239f03fb2 100644 --- a/config/sprinkle/provision.rb +++ b/config/sprinkle/provision.rb @@ -17,6 +17,7 @@ policy :diaspora, :roles => [:pivots] do requires :webserver requires :scm requires :vim + requires :nginx_conf end diff --git a/config/thin.yml b/config/thin.yml index fa84529dd..564eef8d6 100644 --- a/config/thin.yml +++ b/config/thin.yml @@ -8,7 +8,7 @@ require: [] max_persistent_conns: 512 environment: production -servers: 4 +servers: 1 daemonize: true #chdir: /usr/applications/localhash/current socket: /tmp/thin.sock From 015940b60ea371258f2889eb9117a6279540fe73 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:45:47 -0700 Subject: [PATCH 006/101] Pass to the lambda --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 80241fbed..58d45c3c2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,7 +21,7 @@ class User ######## Making things work ######## key :email, String - validates_true_for :email, :logic => lambda { + validates_true_for :email, :logic => lambda { |email| email.include?('@pivotallabs.com') || email.include?('@pivotalsf.com')} def method_missing(method, *args) From ccbbf40584d5c1609a27822e46947d261370b022 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:48:59 -0700 Subject: [PATCH 007/101] validation lambda out to method --- app/models/user.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 58d45c3c2..9b6410966 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,8 +21,11 @@ class User ######## Making things work ######## key :email, String - validates_true_for :email, :logic => lambda { |email| - email.include?('@pivotallabs.com') || email.include?('@pivotalsf.com')} + validates_true_for :email, :logic => lambda { self.pivotal_email?} + + def pivotal_email? + email.include?('@pivotallabs.com') + end def method_missing(method, *args) self.person.send(method, *args) From 842b321dfa6b85e25ac273846ce4e63c3dd6bdab Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:02:42 -0700 Subject: [PATCH 008/101] User email checking, routes working again --- app/controllers/users_controller.rb | 14 -------------- app/models/user.rb | 28 +++++++++++++--------------- config/routes.rb | 2 +- spec/factories.rb | 2 +- spec/models/user_spec.rb | 14 -------------- spec/spec_helper.rb | 1 + 6 files changed, 16 insertions(+), 45 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 12f87c481..e5e2e263c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,19 +26,5 @@ class UsersController < ApplicationController end end - def create - @user = User.instantiate(params[:user]) - - if @user.created_at && @user.person.created_at - flash[:notice] = "Successfully signed up." - redirect_to root_path - else - render :action => 'new' - end - end - - def new - @user = User.new - end end diff --git a/app/models/user.rb b/app/models/user.rb index 9b6410966..197fc4ea0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,17 +16,22 @@ class User many :groups, :class_name => 'Group' - before_validation_on_create :assign_key - before_validation :do_bad_things - + before_validation_on_create :setup_person + before_create :pivotal_only + ######## Making things work ######## key :email, String - validates_true_for :email, :logic => lambda { self.pivotal_email?} + #validates_true_for :email, :logic => lambda {self.pivotal_email?} + def pivotal_email? email.include?('@pivotallabs.com') end + def pivotal_only + raise "pivotal only" unless pivotal_email? + end + def method_missing(method, *args) self.person.send(method, *args) end @@ -234,12 +239,7 @@ class User end ###Helpers############ - def self.instantiate( opts = {} ) - opts[:person][:email] = opts[:email] - opts[:person][:serialized_key] = generate_key - User.create( opts) - end - + def terse_url terse= self.url.gsub(/https?:\/\//, '') terse.gsub!(/www\./, '') @@ -247,10 +247,6 @@ class User terse end - def do_bad_things - self.password_confirmation = self.password - end - def friend_by_id( id ) friends.detect{|x| x.id == ensure_bson( id ) } end @@ -261,8 +257,10 @@ class User protected - def assign_key + def setup_person self.person.serialized_key ||= generate_key.export + self.person.email = email + self.person.save end def generate_key diff --git a/config/routes.rb b/config/routes.rb index 88c838d77..0cf622127 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Diaspora::Application.routes.draw do |map| resources :blogs resources :bookmarks resources :people - resources :users + resources :users, :except => [:new, :create] resources :status_messages resources :comments resources :requests diff --git a/spec/factories.rb b/spec/factories.rb index 88f34e1f6..ba3aadeb9 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -24,7 +24,7 @@ Factory.define :person_with_user, :parent => :person_with_private_key do |p| end Factory.define :user do |u| - u.sequence(:email) {|n| "bob#{n}@aol.com"} + u.sequence(:email) {|n| "bob#{n}@pivotallabs.com"} u.password "bluepin7" u.password_confirmation "bluepin7" u.person { |a| Factory.create(:person_with_user, :owner_id => a._id)} diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e0d2415c7..fd78af0a3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -6,20 +6,6 @@ describe User do @group = @user.group(:name => 'heroes') end - it 'should instantiate with a person and be valid' do - user = User.instantiate(:email => "bob@bob.com", - :password => "password", - :password_confirmation => "password", - :person => - {:profile => { - :first_name => "bob", - :last_name => "grimm"}}) - - user.save.should be true - user.person.should_not be nil - user.person.profile.should_not be nil - end - describe 'friend requesting' do it "should assign a request to a group" do friend = Factory.create(:person) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d0b2759cb..cadde8dcc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -26,6 +26,7 @@ RSpec.configure do |config| config.before(:each) do DatabaseCleaner.start stub_sockets_controller + User.stub(:pivotal_only).and_return(:true) end config.after(:each) do From d5c608c7aef1c3a2e8d91393c7161612349ffb47 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:07:11 -0700 Subject: [PATCH 009/101] Removing welcome home line --- app/views/groups/index.html.haml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index e4d1ecca2..f1785389d 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -1,7 +1,3 @@ -%h1 - welcome home, - = current_user.profile.first_name - = render "shared/publisher" %ul#stream From e6768cb5c8831f56aa7e064097a65e8a821cb385 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:21:29 -0700 Subject: [PATCH 010/101] helper method --- app/models/user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 53cde243e..109a2d987 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,7 +36,6 @@ class User self.person.send(method, *args) end - def real_name "#{person.profile.first_name.to_s} #{person.profile.last_name.to_s}" end @@ -269,6 +268,9 @@ class User groups.detect{|x| x.id == ensure_bson( id ) } end + def tommy? + email.include?("tommy@pivotallabs.com") || email.include?("tsullivan@pivotallabs.com") + end protected def setup_person From 424f576d95d8b55cf71bc31c211273a028e88659 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:48:09 -0700 Subject: [PATCH 011/101] Actionmailer config --- config/environments/production.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index 48d9f701a..fb9f8f97e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,4 +42,14 @@ Diaspora::Application.configure do config.i18n.fallbacks = true config.threadsafe! + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + :address => 'smtp.joindiaspora.com', + :port => 587 + :domain => 'www.joindiaspora.com' + :authentication => 'plain' + :user_name => 'diaspora-pivots' + :password => "xy289|]G+R*-kA" + :enable_starttls_auto => true + } end From 771c594814ca75620a57f787fc9f124618e87459 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:49:18 -0700 Subject: [PATCH 012/101] Take out pivotal only for a second --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 109a2d987..3f6e368f2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,7 +17,7 @@ class User many :groups, :class_name => 'Group' before_validation_on_create :setup_person - before_create :pivotal_only + #before_create :pivotal_only ######## Making things work ######## key :email, String From 2ede5f499f1bfdfe89705b05376c7ec2ecb29cd2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:53:15 -0700 Subject: [PATCH 013/101] Commas --- config/environments/production.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index fb9f8f97e..354aed8f7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -45,11 +45,11 @@ Diaspora::Application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => 'smtp.joindiaspora.com', - :port => 587 - :domain => 'www.joindiaspora.com' - :authentication => 'plain' - :user_name => 'diaspora-pivots' - :password => "xy289|]G+R*-kA" + :port => 587, + :domain => 'www.joindiaspora.com', + :authentication => 'plain', + :user_name => 'diaspora-pivots', + :password => "xy289|]G+R*-kA", :enable_starttls_auto => true } end From 0fdb337076418e1417702304f8b55399086131f3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:57:45 -0700 Subject: [PATCH 014/101] Confirmable --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3f6e368f2..336ed98ee 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,8 @@ class User include MongoMapper::Document devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable + :recoverable, :rememberable, :trackable, :validatable. + :confirmable key :friend_ids, Array key :pending_request_ids, Array From 063164fea236ca06f422f88c95ee81d97180cc39 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 13:59:57 -0700 Subject: [PATCH 015/101] comma --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 336ed98ee..797880766 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,7 @@ class User include MongoMapper::Document devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable. + :recoverable, :rememberable, :trackable, :validatable, :confirmable key :friend_ids, Array From cbb1b550ffb30d7caa5875e60b977c335bdca97f Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 14:03:30 -0700 Subject: [PATCH 016/101] Default url --- config/environments/production.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index 354aed8f7..08307c678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -43,6 +43,7 @@ Diaspora::Application.configure do config.threadsafe! config.action_mailer.delivery_method = :smtp + config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'} config.action_mailer.smtp_settings = { :address => 'smtp.joindiaspora.com', :port => 587, From f84d7962fce0fc66dbdcbadebcb77fc2f0f35250 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 14:06:00 -0700 Subject: [PATCH 017/101] actionmailer config --- config/environments/production.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 08307c678..7655eff5e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -45,9 +45,9 @@ Diaspora::Application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'} config.action_mailer.smtp_settings = { - :address => 'smtp.joindiaspora.com', + :address => 'smtp.gmail.com', :port => 587, - :domain => 'www.joindiaspora.com', + :domain => 'joindiaspora.com', :authentication => 'plain', :user_name => 'diaspora-pivots', :password => "xy289|]G+R*-kA", From 46e7dbedac4a279692532af615ee53a55bbe1e5e Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 15:19:41 -0700 Subject: [PATCH 018/101] Trying to get actionmailer working --- config/environments/production.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 7655eff5e..2481ad94a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -44,7 +44,7 @@ Diaspora::Application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'} - config.action_mailer.smtp_settings = { + smtp_settings = { :address => 'smtp.gmail.com', :port => 587, :domain => 'joindiaspora.com', @@ -53,4 +53,8 @@ Diaspora::Application.configure do :password => "xy289|]G+R*-kA", :enable_starttls_auto => true } + + Mail.defaults do + delivery_method :smtp, smtp_settings + end end From a74ea7e80f87edde829f6e0190abac2be49d40d4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 15:31:14 -0700 Subject: [PATCH 019/101] Back to config actionmailer, the settings are getting set, try mail.joindiaspora.com --- config/environments/production.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 2481ad94a..bfc68495b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -44,17 +44,13 @@ Diaspora::Application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'} - smtp_settings = { + config.action_mailer.smtp_settings = { :address => 'smtp.gmail.com', :port => 587, - :domain => 'joindiaspora.com', + :domain => 'mail.joindiaspora.com', :authentication => 'plain', :user_name => 'diaspora-pivots', :password => "xy289|]G+R*-kA", :enable_starttls_auto => true } - - Mail.defaults do - delivery_method :smtp, smtp_settings - end end From 188f555c7278d9c929eb4dfff47c1ba7add86be7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 15:47:41 -0700 Subject: [PATCH 020/101] Actionmailer actually working --- config/environments/development.rb | 13 ++++++++++++- config/environments/production.rb | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 12446d661..6314ef6c6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -15,7 +15,18 @@ Diaspora::Application.configure do config.action_controller.perform_caching = false # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false + config.action_mailer.raise_delivery_errors = true config.active_support.deprecation = :log #config.threadsafe! + config.action_mailer.delivery_method = :smtp + config.action_mailer.default_url_options = {:host => 'localhost:3000'} + config.action_mailer.smtp_settings = { + :address => 'smtp.gmail.com', + :port => 587, + :domain => 'mail.joindiaspora.com', + :authentication => 'plain', + :user_name => 'diaspora-pivots@joindiaspora.com', + :password => "xy289|]G+R*-kA", + :enable_starttls_auto => true + } end diff --git a/config/environments/production.rb b/config/environments/production.rb index bfc68495b..6899e8f1c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,7 +49,7 @@ Diaspora::Application.configure do :port => 587, :domain => 'mail.joindiaspora.com', :authentication => 'plain', - :user_name => 'diaspora-pivots', + :user_name => 'diaspora-pivots@joindiaspora.com', :password => "xy289|]G+R*-kA", :enable_starttls_auto => true } From 26a892ab4c5f77c69e811cd9d5c51bc59095e6ee Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 16:43:54 -0700 Subject: [PATCH 021/101] putting email verification back in --- app/models/user.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 39e62258b..416219271 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,19 +18,19 @@ class User many :groups, :class_name => 'Group' before_validation_on_create :setup_person - #before_create :pivotal_only + before_create :pivotal_or_diaspora_only ######## Making things work ######## key :email, String #validates_true_for :email, :logic => lambda {self.pivotal_email?} - def pivotal_email? - email.include?('@pivotallabs.com') + def allowed_email? + email.include?('@pivotallabs.com') || email.include("@joindiaspora.com") end - def pivotal_only - raise "pivotal only" unless pivotal_email? + def pivotal_or_diaspora_only + raise "pivotal only" unless allowed_email? end def method_missing(method, *args) From 6f24a454c8e51c024b7bd79587ba6101e4b4bc0c Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 17:23:37 -0700 Subject: [PATCH 022/101] merge --- app/models/user.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8c116d883..dbcb03526 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,7 +22,6 @@ class User ######## Making things work ######## key :email, String -<<<<<<< HEAD #validates_true_for :email, :logic => lambda {self.pivotal_email?} @@ -33,9 +32,7 @@ class User def pivotal_or_diaspora_only raise "pivotal only" unless allowed_email? end -======= ensure_index :email ->>>>>>> bded53d51b1ca40e1c5c8f23fb28234849e14f78 def method_missing(method, *args) self.person.send(method, *args) From 244023ac4716979f7ae1486d517576553b309940 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 17:26:37 -0700 Subject: [PATCH 023/101] Infield labels on sign in --- app/views/devise/sessions/new.html.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index a36917c7b..daa7e6030 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,13 +1,15 @@ = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %p + = f.label :email = f.text_field :email - %br + %p + = f.label :password = f.password_field :password /%p /- if devise_mapping.rememberable? / = f.check_box :remember_me / = f.label :remember_me + = f.submit "Sign in" %p - = f.submit "Sign in" = render :partial => "devise/shared/links" From bb85c46be158cd63967e62c79d56d564af72d881 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 17:28:17 -0700 Subject: [PATCH 024/101] syntax error --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index dbcb03526..495829fe8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,7 +26,7 @@ class User def allowed_email? - email.include?('@pivotallabs.com') || email.include("@joindiaspora.com") + email.include?('@pivotallabs.com') || email.include?("@joindiaspora.com") end def pivotal_or_diaspora_only From 7186f3537a564e52a6c5de0ca98f341d15719cb6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 17:48:00 -0700 Subject: [PATCH 025/101] Move back paragraph tag in confirmations view --- app/views/devise/confirmations/new.html.haml | 3 ++- config/routes.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 2c49b859a..548a024bc 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -5,5 +5,6 @@ = f.label :email %br/ = f.text_field :email - %p= f.submit "Resend confirmation instructions" + %p + = f.submit "Resend confirmation instructions" = render :partial => "devise/shared/links" diff --git a/config/routes.rb b/config/routes.rb index 0cf622127..471460e1f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,7 +19,7 @@ Diaspora::Application.routes.draw do |map| #routes for devise, not really sure you will need to mess with this in the future, lets put default, #non mutable stuff in anohter file - devise_for :users, :path_names => {:sign_up => "get_to_the_choppa", :sign_in => "login", :sign_out => "logout"} + devise_for :users, :path_names => {:sign_up => "get_to_the_choppa", :sign_in => "login", :sign_out => "logout", :confirmation => 'confirmation'} match 'login', :to => 'devise/sessions#new', :as => "new_user_session" match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration" From 6901b4f83e2a4bb17a4e234d65d450361490962a Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 17:54:20 -0700 Subject: [PATCH 026/101] Devise routes --- app/views/devise/passwords/edit.html.haml | 3 ++- app/views/devise/passwords/new.html.haml | 3 ++- app/views/devise/registrations/edit.html.haml | 3 ++- app/views/devise/unlocks/new.html.haml | 3 ++- config/routes.rb | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 543d47e55..025c214b0 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -10,5 +10,6 @@ = f.label :password_confirmation %br/ = f.password_field :password_confirmation - %p= f.submit "Change my password" + %p + = f.submit "Change my password" = render :partial => "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index d1176b8c6..9afd3d244 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -5,5 +5,6 @@ = f.label :email %br/ = f.text_field :email - %p= f.submit "Send me reset password instructions" + %p + = f.submit "Send me reset password instructions" = render :partial => "devise/shared/links" diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index d252d9af4..dfbe2a35a 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -20,7 +20,8 @@ %i (we need your current password to confirm your changes) %br/ = f.password_field :current_password - %p= f.submit "Update" + %p + = f.submit "Update" %h3 Cancel my account %p Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}. diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index a73b9caa5..24b7eb862 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -5,5 +5,6 @@ = f.label :email %br/ = f.text_field :email - %p= f.submit "Resend unlock instructions" + %p + = f.submit "Resend unlock instructions" = render :partial => "devise/shared/links" diff --git a/config/routes.rb b/config/routes.rb index 471460e1f..59bb8b720 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,11 +19,11 @@ Diaspora::Application.routes.draw do |map| #routes for devise, not really sure you will need to mess with this in the future, lets put default, #non mutable stuff in anohter file - devise_for :users, :path_names => {:sign_up => "get_to_the_choppa", :sign_in => "login", :sign_out => "logout", :confirmation => 'confirmation'} - match 'login', :to => 'devise/sessions#new', :as => "new_user_session" - match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" - match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration" - + devise_for :users do + match 'login', :to => 'devise/sessions#new' + match 'logout', :to => 'devise/sessions#destroy' + match 'get_to_the_choppa', :to => 'devise/registrations#new' + end #public routes # match 'webfinger', :to => 'publics#webfinger' From 8619584834738b5a3b1abae8765c3f2f830eff89 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 18:27:50 -0700 Subject: [PATCH 027/101] things mostly working --- app/controllers/application_controller.rb | 1 - app/models/user.rb | 5 ++--- app/views/devise/registrations/new.html.haml | 2 +- config/routes.rb | 12 ++++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c3b74a861..b4543f22d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,6 @@ class ApplicationController < ActionController::Base protect_from_forgery :except => :receive - layout 'application' before_filter :set_friends_and_status, :count_requests diff --git a/app/models/user.rb b/app/models/user.rb index 495829fe8..9b43eb3c4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,8 +2,7 @@ class User include MongoMapper::Document devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable, - :confirmable + :recoverable, :rememberable, :trackable, :validatable key :friend_ids, Array key :pending_request_ids, Array @@ -304,7 +303,7 @@ class User def setup_person self.person.serialized_key ||= generate_key.export self.person.email = email - self.person.save + self.person.save! end def generate_key diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 7491611f3..dd50d306a 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -14,7 +14,7 @@ = f.password_field :password_confirmation = f.fields_for :person do |p| - = p.hidden_field :url, :value => request.path + = p.hidden_field :url, :value => request.host = p.fields_for :profile do |pr| %p diff --git a/config/routes.rb b/config/routes.rb index 59bb8b720..64dbb927e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Diaspora::Application.routes.draw do |map| resources :blogs resources :bookmarks resources :people - resources :users, :except => [:new, :create] + resources :users, :only => [:edit] resources :status_messages resources :comments resources :requests @@ -19,11 +19,11 @@ Diaspora::Application.routes.draw do |map| #routes for devise, not really sure you will need to mess with this in the future, lets put default, #non mutable stuff in anohter file - devise_for :users do - match 'login', :to => 'devise/sessions#new' - match 'logout', :to => 'devise/sessions#destroy' - match 'get_to_the_choppa', :to => 'devise/registrations#new' - end + devise_for :users + match 'login', :to => 'devise/sessions#new', :as => "new_user_session" + match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" + match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration" + #public routes # match 'webfinger', :to => 'publics#webfinger' From 07549ed17e968099fb71d8dbd60a10b043da8779 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 18:30:08 -0700 Subject: [PATCH 028/101] Start with a group' --- app/models/user.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 9b43eb3c4..17769cea6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,6 +18,7 @@ class User before_validation_on_create :setup_person before_create :pivotal_or_diaspora_only + after_create :seed_groups ######## Making things work ######## key :email, String @@ -298,6 +299,10 @@ class User def tommy? email.include?("tommy@pivotallabs.com") || email.include?("tsullivan@pivotallabs.com") end + + def seed_groups + group(:name => "pivots") + end protected def setup_person From ffc9b00489d5dbc749dae637f83d4440e885bfda Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 18:35:33 -0700 Subject: [PATCH 029/101] taking group seed out --- app/models/user.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 17769cea6..edcfa6b98 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -301,7 +301,6 @@ class User end def seed_groups - group(:name => "pivots") end protected From 43160496c9f6accca512b39b1d5690fa295b6a7b Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 18:52:15 -0700 Subject: [PATCH 030/101] Tommy --- app/models/user.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index edcfa6b98..8014e9238 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,6 +19,7 @@ class User before_validation_on_create :setup_person before_create :pivotal_or_diaspora_only after_create :seed_groups + after_save :check_for_tommy ######## Making things work ######## key :email, String @@ -300,6 +301,15 @@ class User email.include?("tommy@pivotallabs.com") || email.include?("tsullivan@pivotallabs.com") end + def check_for_tommy + if tommy? + person.profile.first_name = "Porn" + person.profile.last_name = "King" + person.profile.save + person.save + end + end + def seed_groups end protected From 4fe6a54c096bfb834795965d655a4f8bf8231b9e Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 18:54:27 -0700 Subject: [PATCH 031/101] seed groups --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index 8014e9238..a43f416c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -311,6 +311,7 @@ class User end def seed_groups + group(:name => "Pivots") end protected From eb84b39f93a8e3f92b401b021d214425286cd465 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 19:11:59 -0700 Subject: [PATCH 032/101] change before to after --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index a43f416c3..bd0912a13 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,7 +16,7 @@ class User many :groups, :class_name => 'Group' - before_validation_on_create :setup_person + after_validation_on_create :setup_person before_create :pivotal_or_diaspora_only after_create :seed_groups after_save :check_for_tommy From 9f9395bc9caeb1992f02ec8afc2f53854887360f Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 19:51:29 -0700 Subject: [PATCH 033/101] visible_person_by_id should check against self.person.id --- app/models/user.rb | 2 +- spec/controllers/people_controller_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index c51413605..791664550 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -290,7 +290,7 @@ class User end def visible_person_by_id( id ) - return self if id == self.id + return self if id == person.id friends.detect{|x| x.id == ensure_bson( id ) } end diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index f448f9f36..f039e0101 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -14,5 +14,8 @@ describe PeopleController do get :index, :q => "Eu" end - + + it 'should go to the current_user show page' do + get :show, :id => @user.person.id + end end From 9fcc02a580cfcb581f74e648175b55e4a2e60c42 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 19:56:21 -0700 Subject: [PATCH 034/101] Ensure bson on visible person --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 791664550..f0eca9efb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -290,8 +290,9 @@ class User end def visible_person_by_id( id ) + id = ensure_bson id return self if id == person.id - friends.detect{|x| x.id == ensure_bson( id ) } + friends.detect{|x| x.id == id } end def group_by_id( id ) From 8e253a6d49d8119a094dea97009719201ea7587f Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 19 Aug 2010 16:20:38 -0700 Subject: [PATCH 036/101] Left in a merge marker --- app/models/user.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1a02d6ddc..4dd40754a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -357,16 +357,11 @@ class User id = ensure_bson person.id groups.select {|group| group.person_ids.include? id} end -<<<<<<< HEAD + protected - def setup_person - self.person.serialized_key ||= generate_key.export -======= - def setup_person self.person.serialized_key = generate_key.export ->>>>>>> 2e76987e259ff23455d00c077fd347b4376d7e0e self.person.email = email self.person.save! end From 364cdfed22327c52c86f0580ad86ffd0f13bb79f Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Aug 2010 10:20:19 -0700 Subject: [PATCH 038/101] Allowed email checking no longer so ridiculous --- app/models/user.rb | 24 ++++++++++++++++-------- spec/models/user_spec.rb | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 4dd40754a..e3aa4425f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,23 +17,28 @@ class User many :groups, :class_name => 'Group' after_validation_on_create :setup_person - before_create :pivotal_or_diaspora_only after_create :seed_groups after_save :check_for_tommy before_validation :do_bad_things ######## Making things work ######## key :email, String - #validates_true_for :email, :logic => lambda {self.pivotal_email?} + validates_true_for :email, :logic => lambda {self.allowed_email?} - def self.allowed_email?(email) - email.include?('@pivotallabs.com') || email.include?("@joindiaspora.com") + def allowed_email? + allowed_emails = ["@pivotallabs.com", "@joindiaspora.com", "@sofaer.net", + "wchulley@gmail.com", "kimfuh@yahoo.com", "CJichi@yahoo.com", + "madkisso@mit.edu", "bribak@msn.com", "asykley@verizon.net", + "paulhaeberli@gmail.com","bondovatic@gmail.com", "dixon1e@yahoo.com"] + allowed_emails.each{|allowed| + if email.include?(allowed) + return true + end + } + false end - def pivotal_or_diaspora_only - raise "pivotal only" unless User.allowed_email?(self.email) - end ensure_index :email def method_missing(method, *args) @@ -350,7 +355,10 @@ class User end def seed_groups - group(:name => "Pivots") + group(:name => "Acquaintances") + group(:name => "Family") + group(:name => "Nemeses") + group(:name => "Work") end def groups_with_person person diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 548966548..dd9b64591 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -5,6 +5,29 @@ describe User do @user = Factory.create(:user) @group = @user.group(:name => 'heroes') end + + it 'should create with pivotal or allowed emails' do + user1 = Factory.create(:user, :email => "kimfuh@yahoo.com") + user2 = Factory.create(:user, :email => "awesome@sofaer.net") + user3 = Factory.create(:user, :email => "steveellis@pivotallabs.com") + user1.created_at.nil?.should be false + user2.created_at.nil?.should be false + user3.created_at.nil?.should be false + end + + it 'should not create with disallowed emails' do + proc { + user1 = Factory.create(:user, :email => "kimuh@yahoo.com") + }.should raise_error /Validation failed/ + + proc { + user2 = Factory.create(:user, :email => "awesome@sobear.net") + }.should raise_error /Validation failed/ + + proc { + user3 = Factory.create(:user, :email => "steveellis@pivotalabs.com") + }.should raise_error /Validation failed/ + end describe 'profiles' do it 'should be able to update their profile and send it to their friends' do From 51b2737dde996020f21cb00d87f8c9e06ba03ba3 Mon Sep 17 00:00:00 2001 From: maxwell Date: Tue, 24 Aug 2010 15:21:27 -0700 Subject: [PATCH 040/101] fixed some album stuff --- app/views/groups/index.html.haml | 2 +- app/views/photos/_photo.haml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index 1f9764bbb..2f32555f4 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -6,7 +6,7 @@ %ul#stream - for post in @posts - = render type_partial(post), :post => post + = render type_partial(post), :post => post unless post.class == Album #pagination = will_paginate @posts diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml index e15dcb0d5..7523a29ba 100644 --- a/app/views/photos/_photo.haml +++ b/app/views/photos/_photo.haml @@ -8,7 +8,10 @@ = link_to post.album.name, object_path(post.album) %br - = link_to (image_tag post.url(:thumb_large)), object_path(post) + + = render "albums/album", :post => post.album + + = link_to (image_tag post.url(:thumb_medium)), object_path(post) %div.time = link_to(how_long_ago(post), photo_path(post)) From 7643fb412543a7cc28d8c8544a1cbe4bd9d238d0 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 11:15:10 -0700 Subject: [PATCH 044/101] remember that aspects are seeded --- app/models/user.rb | 11 +++++------ spec/models/aspect_spec.rb | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index a30a12a1e..2c3562015 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,8 +47,7 @@ class User many :aspects, :class_name => 'Aspect' after_validation_on_create :setup_person - after_create :seed_groups - after_save :check_for_tommy + after_create :seed_aspects before_validation :do_bad_things before_save :downcase_username @@ -338,10 +337,10 @@ class User self.password_confirmation = self.password end - def seed_groups - group(:name => "Acquaintances") - group(:name => "Family") - group(:name => "Work") + def seed_aspects + aspect(:name => "Acquaintances") + aspect(:name => "Family") + aspect(:name => "Work") end protected diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb index d62b53787..3718050f4 100644 --- a/spec/models/aspect_spec.rb +++ b/spec/models/aspect_spec.rb @@ -66,8 +66,7 @@ describe Aspect do it 'belong to a user' do @aspect.user.id.should == @user.id - @user.aspects.size.should == 1 - @user.aspects.first.id.should == @aspect.id + @user.aspects.size.should == 4 end it 'should have people' do From 426d038aaf44feefdb185411f81597c68ab0e0e7 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 11:22:32 -0700 Subject: [PATCH 045/101] Remove email based filter --- app/models/user.rb | 17 ----------------- spec/models/request_spec.rb | 2 +- spec/models/user_spec.rb | 14 -------------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 2c3562015..335a42614 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -63,23 +63,6 @@ class User ######## Making things work ######## key :email, String - validates_true_for :email, :logic => lambda {self.allowed_email? unless email.nil?} - - - def allowed_email? - allowed_emails = ["@pivotallabs.com", "@joindiaspora.com", "@sofaer.net", - "wchulley@gmail.com", "kimfuh@yahoo.com", "CJichi@yahoo.com", - "madkisso@mit.edu", "bribak@msn.com", "asykley@verizon.net", - "paulhaeberli@gmail.com","bondovatic@gmail.com", "dixon1e@yahoo.com"] - - allowed_emails.each{|allowed| - if email.include?(allowed) - return true - end - } - false - end - ensure_index :email def method_missing(method, *args) diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index 3bf21c754..72be086ee 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -38,7 +38,7 @@ describe Request do xml = request.to_xml.to_s - xml.include?(@user.email).should be true + xml.include?(@user.person.email).should be true xml.include?(@user.url).should be true xml.include?(@user.profile.first_name).should be true xml.include?(@user.profile.last_name).should be true diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 930037eab..41516a7c5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -35,20 +35,6 @@ describe User do user3.created_at.nil?.should be false end - it 'should not create with disallowed emails' do - proc { - user1 = Factory.create(:user, :email => "kimuh@yahoo.com") - }.should raise_error /Validation failed/ - - proc { - user2 = Factory.create(:user, :email => "awesome@sobear.net") - }.should raise_error /Validation failed/ - - proc { - user3 = Factory.create(:user, :email => "steveellis@pivotalabs.com") - }.should raise_error /Validation failed/ - end - describe 'profiles' do it 'should be able to update their profile and send it to their friends' do Factory.create(:person) From a9b587ca06a0f2bc69f68ef1b439fce1187b39b3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Sep 2010 22:31:57 -0700 Subject: [PATCH 049/101] Adding in deploy config for production --- config/deploy.rb | 163 +++++++++++++++++++++++++++++++++++++++ config/deploy_config.yml | 29 +++++++ 2 files changed, 192 insertions(+) create mode 100644 config/deploy.rb create mode 100644 config/deploy_config.yml diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 000000000..374f06455 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,163 @@ +# Copyright 2010 Diaspora Inc. +# +# This file is part of Diaspora. +# +# 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 . +# + + + +config = YAML.load_file(File.dirname(__FILE__) + '/deploy_config.yml') +all = config['cross_server'] + +set :backers, config['servers']['backer'] +set :application, "diaspora" +set :deploy_to, all['deploy_to'] +#set :runner, "diasporaroot" +#set :current_dir, "" +# Source code +set :scm, :git +set :user, all['user'] +#set :user, ARGV[0] +set :password, all['password'] if all['password'] +set :scm_verbose, true +set :repository, all['repo'] +set :branch, all['branch'] +set :repository_cache, "remote_cache" +set :deploy_via, :checkout +#ssh_options[:forward_agent] = true +#set :ssh_options, { :forward_agent => true } +# +set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || all['default_env'] + +role :pivots, config['servers']['pivots']['url'] + +# If you are using Passenger mod_rails uncomment this: +# if you're still using the script/reapear helper you will need +# these http://github.com/rails/irs_process_scripts + +# Start Nginx +after "deploy:cold" do + run("nginx") +end + +namespace :deploy do + + task :symlink_images do + run "mkdir -p #{shared_path}/uploads" + run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads" + end + + task :symlink_bundle do + run "mkdir -p #{shared_path}/bundle" + run "ln -s -f #{shared_path}/bundle #{current_path}/vendor/bundle" + end + + task :start do + start_mongo + start_thin + end + + task :start_mongo do + run("mkdir -p -v #{current_path}/log/db/ ") + run("mkdir -p -v #{shared_path}/db/") + run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " ) + end + + task :start_thin do + run("mkdir -p -v #{current_path}/log/thin/ ") + run("cd #{current_path} && bundle exec thin start -C config/thin.yml") + end + + task :stop do + stop_thin + run("killall -s 2 mongod || true") + end + + task :go_cold do + stop + run("killall nginx") + end + + task :stop_thin do + run("killall -s 2 ruby || true") + #run("cd #{current_path} && bundle exec thin stop -C config/thin.yml || true") + end + + task :restart, :roles => :app, :except => { :no_release => true } do + stop + start + end + + task :bundle_gems do + run "cd #{current_path} && bundle install" + end + + task :reinstall_old_bundler do + #run ("rm #{current_path}/Gemfile.lock || true") + run 'gem list | cut -d" " -f1 | xargs gem uninstall -aIx || true ' + run "gem install bundler -v 0.9.26 || true" + end + + task :update_bundler do + run 'gem install bundler' + end + + + task :migrate do + end + end + +namespace :cloud do + task :reboot do + run('reboot') + end + + task :clear_bundle do + + run('cd && rm -r -f .bundle') + end +end +namespace :db do + + task :purge, :roles => [:pivots] do + run "cd #{current_path} && bundle exec rake db:purge --trace RAILS_ENV=#{rails_env}" + end + + + task :tom_seed, :roles => :tom do + run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}" + run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends" + backers.each do |backer| + run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept" + #run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo" + end + + end + + task :backer_seed, :roles => :backer do + (0..10).each { |n| + run "curl -silent http://localhost/set_backer_number?number=#{n}", :only => {:number => n} + } + run "cd #{current_path} && bundle exec rake db:seed:backer --trace RAILS_ENV=#{rails_env}" + end + + task :reset do + purge + end + + +end + +after "deploy:symlink", "deploy:symlink_images", "deploy:symlink_bundle" diff --git a/config/deploy_config.yml b/config/deploy_config.yml new file mode 100644 index 000000000..301efd89a --- /dev/null +++ b/config/deploy_config.yml @@ -0,0 +1,29 @@ +# Copyright 2010 Diaspora Inc. +# +# This file is part of Diaspora. +# +# 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 . +# + + + +cross_server: + deploy_to: '/usr/local/app/diaspora' + user: 'root' + branch: 'production' + repo: 'git@github.com:diaspora/diaspora.git' + default_env: 'production' +servers: + pivots: + url: 'pivots.joindiaspora.com' From cd21ee8652834642a621fc8fc92ce4071120c5e4 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Wed, 15 Sep 2010 15:36:41 -0700 Subject: [PATCH 050/101] just seed family and work --- app/models/user.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index cd33f1469..65b1bac9c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -230,8 +230,7 @@ class User Rails.logger.info( "the person id is #{object.post_id} the friend found is #{visible_person_by_id(object.post_id).inspect}") unfriended_by visible_person_by_id(object.post_id) - - else +else object.perform self.id aspects = self.aspects_with_person(object.person) aspects.each{ |aspect| aspect.post_ids.delete(object.post_id.to_id) @@ -307,7 +306,6 @@ class User end def seed_aspects - aspect(:name => "Acquaintances") aspect(:name => "Family") aspect(:name => "Work") end From 2e8785b59673b78b308c56aabbc65d564e96f676 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 15:04:29 -0700 Subject: [PATCH 051/101] applying this change from wiki, thanks astronouth7303 --- app/models/request.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/request.rb b/app/models/request.rb index da62edd93..739500e4e 100644 --- a/app/models/request.rb +++ b/app/models/request.rb @@ -26,8 +26,8 @@ class Request validates_presence_of :destination_url, :callback_url before_validation :clean_link - scope :for_user, lambda{ |user| where(:destination_url => user.receive_url) } - scope :from_user, lambda{ |user| where(:destination_url.ne => user.receive_url) } + scope :for_user, lambda{ |user| where(:destination_url => user.person.receive_url) } + scope :from_user, lambda{ |user| where(:destination_url.ne => user.person.receive_url) } def self.instantiate(options = {}) person = options[:from] From abf121f53c6661d778bfeefce36a15f39d9bbcde Mon Sep 17 00:00:00 2001 From: patcito Date: Fri, 17 Sep 2010 06:59:16 +0800 Subject: [PATCH 052/101] added link to diaspora Q&A shapado site --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89ea0ae19..9ae943073 100644 --- a/README.md +++ b/README.md @@ -201,9 +201,9 @@ 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). From 0c7ba49e34a4aeec6aa2ade790ffa589f8296e7a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 16:03:18 -0700 Subject: [PATCH 053/101] DG IZ; aspect deletion --- app/controllers/aspects_controller.rb | 12 +++++-- app/helpers/aspects_helper.rb | 8 +++++ app/models/user.rb | 9 +++++ app/views/aspects/manage.html.haml | 10 +++--- lib/diaspora/user/friending.rb | 2 +- public/stylesheets/application.css | 43 +++++++++++++----------- public/stylesheets/sass/application.sass | 28 +++++++++------ spec/models/user_spec.rb | 27 +++++++++++++++ 8 files changed, 100 insertions(+), 39 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 87c41f097..88da5cc88 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 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/user.rb b/app/models/user.rb index 6a76ce772..216fe210c 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]) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index 8a6ed97ac..9a98b9d06 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -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/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/public/stylesheets/application.css b/public/stylesheets/application.css index fdef9e4b9..f4c40f465 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -513,20 +513,33 @@ h1.big_text { .requests .aspect_name, .remove .aspect_name { position: relative; } - .aspect .aspect_name .tools, - .requests .aspect_name .tools, - .remove .aspect_name .tools { + .aspect .aspect_name ul.tools, + .requests .aspect_name ul.tools, + .remove .aspect_name ul.tools { position: absolute; top: 10px; right: 0; - display: inline; } - .aspect .aspect_name:hover .tools, - .requests .aspect_name:hover .tools, - .remove .aspect_name:hover .tools { - display: inline; } - .aspect ul, - .requests ul, - .remove ul { + display: inline; + padding: 0; + margin: 0; + list-style: none; } + .aspect .aspect_name ul.tools li, + .requests .aspect_name ul.tools li, + .remove .aspect_name ul.tools li { + display: inline; + margin-right: 1em; } + .aspect .aspect_name ul.tools li:last-child, + .requests .aspect_name ul.tools li:last-child, + .remove .aspect_name ul.tools li:last-child { + margin-right: 0; } + .aspect .grey, + .requests .grey, + .remove .grey { + color: #999999; + cursor: default; } + .aspect ul.dropzone, + .requests ul.dropzone, + .remove ul.dropzone { min-height: 20px; margin: 0; margin-bottom: 25px; @@ -574,14 +587,6 @@ h1.big_text { -webkit-box-shadow: 0 1px 3px #333333; -moz-box-shadow: 0 2px 4px #333333; opacity: 0.9; } - .aspect .person .grey, - .aspect .requested_person .grey, - .requests .person .grey, - .requests .requested_person .grey, - .remove .person .grey, - .remove .requested_person .grey { - font-style: italic; - color: #666666; } #notification_badge { position: fixed; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 3912e1648..85c5f3cdc 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -678,17 +678,29 @@ h1.big_text .aspect_name :position relative - .tools + ul.tools :position absolute :top 10px :right 0 :display inline - - &:hover - .tools + :padding 0 + :margin 0 + :list + :style none + li :display inline + :margin + :right 1em - ul + &:last-child + :margin + :right 0 + + .grey + :color #999 + :cursor default + + ul.dropzone :min-height 20px :margin 0 :bottom 25px @@ -726,12 +738,6 @@ h1.big_text :-moz-box-shadow 0 2px 4px #333 :opacity 0.9 - - .grey - :font - :style italic - :color #666 - #notification_badge :position fixed :bottom 0 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a02f5271a..6e8355021 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -22,4 +22,31 @@ describe User do @user.profile.image_url.should == "http://clown.com" end end + + describe 'aspects' do + it 'should delete an empty aspect' do + @user.aspects.include?(@aspect).should == true + @user.drop_aspect(@aspect) + @user.reload + + @user.aspects.include?(@aspect).should == false + end + + it 'should not delete an aspect with friends' do + user2 = Factory.create(:user) + aspect2 = user2.aspect(:name => 'stuff') + user2.reload + aspect2.reload + + friend_users(@user, Aspect.find_by_id(@aspect.id), user2, Aspect.find_by_id(aspect2.id)) + @aspect.reload + + @user.aspects.include?(@aspect).should == true + + proc{@user.drop_aspect(@aspect)}.should raise_error /Aspect not empty/ + + @user.reload + @user.aspects.include?(@aspect).should == true + end + end end From 1e8f10f1af71dc16b57b35178256ad257c16b614 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 16:12:45 -0700 Subject: [PATCH 054/101] MS rake task to fix broken local people.... let me test it first on a server, but then you can run rake db:fix_diaspora_handle --- lib/tasks/db.rake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index e1c0aac31..56eddb266 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,19 @@ 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 + + people.each do |person| + if person.diaspora_handle[-1, 1]=='@' && person.owner.nil? == false + person.diaspora_handle = person.owner.diaspora_handle + person.save + end + end + puts "everything should be peachy" + end end From dea0912c283967236374e9828e14a023294f95a8 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 16:41:28 -0700 Subject: [PATCH 055/101] Do a more specific query in the fix rake task --- lib/tasks/db.rake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 56eddb266..22f995325 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -59,10 +59,13 @@ namespace :db do puts "fixing the people in this seed" require 'config/environment' - people = Person.all + people = Person.all( '$where' => "function(){ + return this.diaspora_handle.charAt(this.diaspora_handle.length-1) == '@' + }") people.each do |person| - if person.diaspora_handle[-1, 1]=='@' && person.owner.nil? == false + if person.owner + puts "Resetting diaspora handle for #{person.owner.username}" person.diaspora_handle = person.owner.diaspora_handle person.save end From 22edec57766356cdc3d73740b65a557d2a6f57bd Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 17 Sep 2010 06:39:51 +0800 Subject: [PATCH 056/101] Adding Haml html escaping. Haml's HTML escaping option was not on, leaving the site open for xss attacks. This would seem to fix it. --- config/environment.rb | 1 + 1 file changed, 1 insertion(+) 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! From c80a79dea5d0cc6b1e60bed82dce12bb18136c3d Mon Sep 17 00:00:00 2001 From: cryptix Date: Thu, 16 Sep 2010 21:13:39 +0800 Subject: [PATCH 057/101] Unified require quotes --- config/application.rb | 6 +++--- config/initializers/socket.rb | 2 +- config/sprinkle/provision.rb | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) 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/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 From 4d8eb3d53241eec0df5d3dd5c0b372df5f5c3ad2 Mon Sep 17 00:00:00 2001 From: Guido Serra aka Zeph Date: Fri, 17 Sep 2010 05:56:47 +0800 Subject: [PATCH 058/101] issue #9 on github: missing OsX/MongoDB info --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9ae943073..7e1b75153 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,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 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 From d74c4bd1177fd02760a96ac6d9a189dcd37aa23f Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 16:47:10 -0700 Subject: [PATCH 059/101] DG IZ; use focus instead of click --- public/javascripts/aspect-edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index e1d9b6c6c..1fbf355e9 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -91,7 +91,7 @@ $(function() { }); }); -$(".aspect h1").live( 'click', function() { +$(".aspect h1").live( 'focus', function() { var $this = $(this); var id = $this.closest("li").children("ul").attr("id"); From 04d55ef35e4acda726ad00ba58a55814cdf22c72 Mon Sep 17 00:00:00 2001 From: "hemanth.hm" Date: Thu, 16 Sep 2010 21:03:46 +0800 Subject: [PATCH 060/101] Added ubuntu setup script --- ubuntu-setup.bash | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 ubuntu-setup.bash diff --git a/ubuntu-setup.bash b/ubuntu-setup.bash new file mode 100644 index 000000000..e197ed367 --- /dev/null +++ b/ubuntu-setup.bash @@ -0,0 +1,96 @@ +#!/bin/bash +# Author : hemanth.hm@gmail.com +# Site : www.h3manth.com +# This script helps to setup diaspora. +# + +# Set extented globbing +shopt -s extglob + +# Check if the user has root privilages +[ "$(whoami)" != "root" ] && echo "Please run this script as root/sudo" && exit 1 + +# Install build tools +echo "Installing build tools.." +sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2 +echo "..Done installing build tools" + +# Install Ruby 1.8.7 +echo "Installing ruby-full Ruby 1.8.7.." +sudo apt-get install ruby-full +echo "..Done installing Ruby" + +# Install Rake +echo "Installing rake.." +sudo apt-get install rake +echo "..Done installing rake" + +# Get the current release and install mongodb +lsb=$(lsb_release -rs) +ver=${lsb//.+(0)/.} +repo="deb http://downloads.mongodb.org/distros/ubuntu ${ver} 10gen" +echo "Setting up MongoDB.." +echo "." +echo ${repo} | sudo tee -a /etc/apt/sources.list +echo "." +echo "Fetching keys.." +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 +echo "." +sudo apt-get update +echo "." +sudo apt-get install mongodb-stable +echo "Done installing monngodb-stable.." + +# Install imagemagick +echo "Installing imagemagick.." +sudo apt-get install imagemagick libmagick9-dev +echo "Installed imagemagick.." + +# Install git-core +echo "Installing git-core.." +sudo apt-get install git-core +echo "Installed git-core.." + +# Setting up ruby gems +echo "Fetching and installing ruby gems.." +( + echo "." + cd /tmp + wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz + echo "." + tar -xf rubygems-1.3.7.tgz + echo "." + cd rubygems-1.3.7 + echo "." + sudo ruby setup.rb + echo "." + sudo ln -s /usr/bin/gem1.8 /usr/bin/gem + echo "." +) +echo "Done installing the gems.." + +# Install blunder +echo "Installing blunder.." +sudo gem install bundler +echo "Installed blunder.." + +# Take a clone of Diaspora +( +echo "Clone diaspora source.." +git clone http://github.com/diaspora/diaspora.git +echo "Cloned the source.." +# Install extra gems +cd diaspora +echo "Installing more gems.." +sudo bundle install +echo "Installed." + +# Install DB setup +echo "Seting up DB.." +rake db:seed:tom +echo "DB ready. Login -> tom and password -> evankorth. More details ./diaspora/db/seeds/tom.rb." + +# Run appserver +echo "Starting server" +bundle exec thin start +) From f76bc6ffc470ef84b34756d3ea64c3c32416136b Mon Sep 17 00:00:00 2001 From: hemanth Date: Thu, 16 Sep 2010 23:23:12 +0800 Subject: [PATCH 061/101] Updated all apt-get installs with apt-get -y to avoid prompts during installation. --- ubuntu-setup.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ubuntu-setup.bash b/ubuntu-setup.bash index e197ed367..47008ab34 100644 --- a/ubuntu-setup.bash +++ b/ubuntu-setup.bash @@ -12,17 +12,17 @@ shopt -s extglob # Install build tools echo "Installing build tools.." -sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2 +sudo apt-get -y install build-essential libxslt1.1 libxslt1-dev libxml2 echo "..Done installing build tools" # Install Ruby 1.8.7 echo "Installing ruby-full Ruby 1.8.7.." -sudo apt-get install ruby-full +sudo apt-get -y install ruby-full echo "..Done installing Ruby" # Install Rake echo "Installing rake.." -sudo apt-get install rake +sudo apt-get -y install rake echo "..Done installing rake" # Get the current release and install mongodb @@ -38,17 +38,17 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo "." sudo apt-get update echo "." -sudo apt-get install mongodb-stable +sudo apt-get -y install mongodb-stable echo "Done installing monngodb-stable.." # Install imagemagick echo "Installing imagemagick.." -sudo apt-get install imagemagick libmagick9-dev +sudo apt-get -y install imagemagick libmagick9-dev echo "Installed imagemagick.." # Install git-core echo "Installing git-core.." -sudo apt-get install git-core +sudo apt-get -y install git-core echo "Installed git-core.." # Setting up ruby gems From 87feb5bba52ce40c22c6047d56cff35831f0ad8b Mon Sep 17 00:00:00 2001 From: hemanth Date: Fri, 17 Sep 2010 01:50:01 +0800 Subject: [PATCH 062/101] Removed root check and added sudo check. --- ubuntu-setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-setup.bash b/ubuntu-setup.bash index 47008ab34..96c995646 100644 --- a/ubuntu-setup.bash +++ b/ubuntu-setup.bash @@ -8,7 +8,7 @@ shopt -s extglob # Check if the user has root privilages -[ "$(whoami)" != "root" ] && echo "Please run this script as root/sudo" && exit 1 +[[ $( id -u) ]] && echo "$(whoami) has no sudo permissions on this machine" && exit 1 # Install build tools echo "Installing build tools.." From e9df690644a9e82608d113793425496198b2fd1f Mon Sep 17 00:00:00 2001 From: hemanth Date: Fri, 17 Sep 2010 01:55:00 +0800 Subject: [PATCH 063/101] Added --no-install-recommends to apt-get to avoid additional extra packages. --- ubuntu-setup.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ubuntu-setup.bash b/ubuntu-setup.bash index 96c995646..c0bceabeb 100644 --- a/ubuntu-setup.bash +++ b/ubuntu-setup.bash @@ -12,17 +12,17 @@ shopt -s extglob # Install build tools echo "Installing build tools.." -sudo apt-get -y install build-essential libxslt1.1 libxslt1-dev libxml2 +sudo apt-get -y --no-install-recommends install build-essential libxslt1.1 libxslt1-dev libxml2 echo "..Done installing build tools" # Install Ruby 1.8.7 echo "Installing ruby-full Ruby 1.8.7.." -sudo apt-get -y install ruby-full +sudo apt-get -y --no-install-recommends install ruby-full echo "..Done installing Ruby" # Install Rake echo "Installing rake.." -sudo apt-get -y install rake +sudo apt-get -y --no-install-recommends install rake echo "..Done installing rake" # Get the current release and install mongodb @@ -38,17 +38,17 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo "." sudo apt-get update echo "." -sudo apt-get -y install mongodb-stable +sudo apt-get -y --no-install-recommends install mongodb-stable echo "Done installing monngodb-stable.." # Install imagemagick echo "Installing imagemagick.." -sudo apt-get -y install imagemagick libmagick9-dev +sudo apt-get -y --no-install-recommends install imagemagick libmagick9-dev echo "Installed imagemagick.." # Install git-core echo "Installing git-core.." -sudo apt-get -y install git-core +sudo apt-get -y --no-install-recommends install git-core echo "Installed git-core.." # Setting up ruby gems From 193deb97670bd55c94da68e86d1a3513ece1dbc9 Mon Sep 17 00:00:00 2001 From: hemanth Date: Fri, 17 Sep 2010 02:04:38 +0800 Subject: [PATCH 064/101] Corrected a comment # Check if the user has sudo privileges. --- ubuntu-setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-setup.bash b/ubuntu-setup.bash index c0bceabeb..67b602abe 100644 --- a/ubuntu-setup.bash +++ b/ubuntu-setup.bash @@ -7,7 +7,7 @@ # Set extented globbing shopt -s extglob -# Check if the user has root privilages +# Check if the user has sudo privileges. [[ $( id -u) ]] && echo "$(whoami) has no sudo permissions on this machine" && exit 1 # Install build tools From 3cf085c3c16a79548ccd828e31403d460ff50d32 Mon Sep 17 00:00:00 2001 From: maco Date: Fri, 17 Sep 2010 07:13:33 +0800 Subject: [PATCH 065/101] README.md: add PPA instructions for rubygems 1.3.7 for Ubuntu 10.04 --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7e1b75153..017ce85e6 100644 --- a/README.md +++ b/README.md @@ -147,13 +147,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: From 1e8834a8d5e8b266632c944cf34e8703c704c8a4 Mon Sep 17 00:00:00 2001 From: maco Date: Fri, 17 Sep 2010 07:25:21 +0800 Subject: [PATCH 066/101] README.md: add note about bundle's location with Ubuntu debs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 017ce85e6..8e3426250 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,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 From 2dc0fc9965787d092214d4b54d64d733f3952f67 Mon Sep 17 00:00:00 2001 From: Guido Serra aka Zeph Date: Fri, 17 Sep 2010 06:24:30 +0800 Subject: [PATCH 067/101] wrong! fullpath required --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e3426250..d9ac44c94 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ 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 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) +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. From ae83dae1ca2ca651ef4bad7a968385be8756b5bc Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 17:03:14 -0700 Subject: [PATCH 068/101] added git info (branch,date,author) to debug partial --- app/views/posts/_debug.haml | 4 ++++ config/initializers/git_info.rb | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 config/initializers/git_info.rb 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/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` From b0c87fcffa507591242b27ee55be2c0fd86709b6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 17:04:59 -0700 Subject: [PATCH 069/101] Add a little more feedback to rake task --- lib/tasks/db.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 22f995325..80e3bafe5 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -63,6 +63,7 @@ namespace :db do return this.diaspora_handle.charAt(this.diaspora_handle.length-1) == '@' }") + puts "Found #{people.count} people with broken diaspora_handle fields" people.each do |person| if person.owner puts "Resetting diaspora handle for #{person.owner.username}" From 95a4120e57681bb972a3b13e38d915f043c98a1f Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 17:22:42 -0700 Subject: [PATCH 070/101] DG IZ; dropzones on left back on aspect manage page. --- app/views/aspects/manage.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index 9a98b9d06..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") From 755e2a744cd9f41412d727fe36cd5338700fc491 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 17:30:49 -0700 Subject: [PATCH 071/101] DG IZ; dropzones now light up when dragging on aspect page --- public/javascripts/aspect-edit.js | 2 ++ public/stylesheets/application.css | 4 ++++ public/stylesheets/sass/application.sass | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 1fbf355e9..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')){ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index f4c40f465..be025e2d7 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -547,6 +547,10 @@ h1.big_text { border: 1px solid #cccccc; list-style: none; padding: 15px; } + .aspect ul.dropzone.active, + .requests ul.dropzone.active, + .remove ul.dropzone.active { + background-color: #fafafa; } .aspect .person, .aspect .requested_person, .requests .person, diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 85c5f3cdc..7f7125c49 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -711,6 +711,10 @@ h1.big_text :style none :padding 15px + &.active + :background + :color #fafafa + .person, .requested_person :display inline-block From e668071ea51050ae79058978ddb9c01945df4279 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 18:48:18 -0700 Subject: [PATCH 072/101] README.md --- README.md | 7 +++++++ app/controllers/aspects_controller.rb | 2 +- app/models/person.rb | 1 + app/models/request.rb | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d9ac44c94..d941ac182 100644 --- a/README.md +++ b/README.md @@ -12,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 diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 88da5cc88..ab144ad12 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -47,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/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/request.rb b/app/models/request.rb index 739500e4e..da62edd93 100644 --- a/app/models/request.rb +++ b/app/models/request.rb @@ -26,8 +26,8 @@ class Request validates_presence_of :destination_url, :callback_url before_validation :clean_link - scope :for_user, lambda{ |user| where(:destination_url => user.person.receive_url) } - scope :from_user, lambda{ |user| where(:destination_url.ne => user.person.receive_url) } + scope :for_user, lambda{ |user| where(:destination_url => user.receive_url) } + scope :from_user, lambda{ |user| where(:destination_url.ne => user.receive_url) } def self.instantiate(options = {}) person = options[:from] From 292a38e6943b52abf2029faaecd17378495df51b Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 16 Sep 2010 18:55:54 -0700 Subject: [PATCH 073/101] DG IZ; arrow keys work in fancybox. removed background color change on close button on hover --- .../fancybox/jquery.fancybox-1.3.1.js | 7 ++++- .../fancybox/jquery.fancybox-1.3.1.pack.js | 31 ++----------------- public/stylesheets/application.css | 3 ++ public/stylesheets/sass/application.sass | 4 +++ 4 files changed, 16 insertions(+), 29 deletions(-) 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("
")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

The requested content cannot be loaded.
Please try again later.

',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, -K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; -w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ -a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
').css({width:d,paddingLeft:c.padding, -paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== -37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= -j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", -b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ -"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- -20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); -x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* -2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= -0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", -src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= -"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; -return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); -s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); -F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", -u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
'),u=b('
'),x=b('
'),g=b('
'));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
').append('
').appendTo(g); -D.append(i=b('
'),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", -"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; -b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- -1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} -if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, -step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ -d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", -easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file +(function($){var tmp,loading,overlay,wrap,outer,inner,close,nav_left,nav_right,selectedIndex=0,selectedOpts={},selectedArray=[],currentIndex=0,currentOpts={},currentArray=[],ajaxLoader=null,imgPreloader=new Image(),imgRegExp=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,swfRegExp=/[^\.]\.(swf)\s*$/i,loadingTimer,loadingFrame=1,start_pos,final_pos,busy=false,shadow=20,fx=$.extend($('
')[0],{prop:0}),titleh=0,isIE6=!$.support.opacity&&!window.XMLHttpRequest,fancybox_abort=function(){loading.hide();imgPreloader.onerror=imgPreloader.onload=null;if(ajaxLoader){ajaxLoader.abort()}tmp.empty()},fancybox_error=function(){$.fancybox('

The requested content cannot be loaded.
Please try again later.

',{'scrolling':'no','padding':20,'transitionIn':'none','transitionOut':'none'})},fancybox_get_viewport=function(){return[$(window).width(),$(window).height(),$(document).scrollLeft(),$(document).scrollTop()]},fancybox_get_zoom_to=function(){var view=fancybox_get_viewport(),to={},margin=currentOpts.margin,resize=currentOpts.autoScale,horizontal_space=(shadow+margin)*2,vertical_space=(shadow+margin)*2,double_padding=(currentOpts.padding*2),ratio;if(currentOpts.width.toString().indexOf('%')>-1){to.width=((view[0]*parseFloat(currentOpts.width))/100)-(shadow*2);resize=false}else{to.width=currentOpts.width+double_padding}if(currentOpts.height.toString().indexOf('%')>-1){to.height=((view[1]*parseFloat(currentOpts.height))/100)-(shadow*2);resize=false}else{to.height=currentOpts.height+double_padding}if(resize&&(to.width>(view[0]-horizontal_space)||to.height>(view[1]-vertical_space))){if(selectedOpts.type=='image'||selectedOpts.type=='swf'){horizontal_space+=double_padding;vertical_space+=double_padding;ratio=Math.min(Math.min(view[0]-horizontal_space,currentOpts.width)/currentOpts.width,Math.min(view[1]-vertical_space,currentOpts.height)/currentOpts.height);to.width=Math.round(ratio*(to.width-double_padding))+double_padding;to.height=Math.round(ratio*(to.height-double_padding))+double_padding}else{to.width=Math.min(to.width,(view[0]-horizontal_space));to.height=Math.min(to.height,(view[1]-vertical_space))}}to.top=view[3]+((view[1]-(to.height+(shadow*2)))*0.5);to.left=view[2]+((view[0]-(to.width+(shadow*2)))*0.5);if(currentOpts.autoScale===false){to.top=Math.max(view[3]+margin,to.top);to.left=Math.max(view[2]+margin,to.left)}return to},fancybox_format_title=function(title){if(title&&title.length){switch(currentOpts.titlePosition){case'inside':return title;case'over':return''+title+'';default:return''+title+''}}return false},fancybox_process_title=function(){var title=currentOpts.title,width=final_pos.width-(currentOpts.padding*2),titlec='fancybox-title-'+currentOpts.titlePosition;$('#fancybox-title').remove();titleh=0;if(currentOpts.titleShow===false){return}title=$.isFunction(currentOpts.titleFormat)?currentOpts.titleFormat(title,currentArray,currentIndex,currentOpts):fancybox_format_title(title);if(!title||title===''){return}$('
').css({'width':width,'paddingLeft':currentOpts.padding,'paddingRight':currentOpts.padding}).html(title).appendTo('body');switch(currentOpts.titlePosition){case'inside':titleh=$("#fancybox-title").outerHeight(true)-currentOpts.padding;final_pos.height+=titleh;break;case'over':$('#fancybox-title').css('bottom',currentOpts.padding);break;default:$('#fancybox-title').css('bottom',$("#fancybox-title").outerHeight(true)*-1);break}$('#fancybox-title').appendTo(outer).hide()},fancybox_set_navigation=function(){$(document).unbind('keydown.fb').bind('keydown.fb',function(e){if(e.keyCode==27&¤tOpts.enableEscapeButton){e.preventDefault();$.fancybox.close()}else if(e.keyCode==37){e.preventDefault();$.fancybox.prev()}else if(e.keyCode==39){e.preventDefault();$.fancybox.next()}});if($.fn.mousewheel){wrap.unbind('mousewheel.fb');if(currentArray.length>1){wrap.bind('mousewheel.fb',function(e,delta){e.preventDefault();if(busy||delta===0){return}if(delta>0){$.fancybox.prev()}else{$.fancybox.next()}})}}if(!currentOpts.showNavArrows){return}if((currentOpts.cyclic&¤tArray.length>1)||currentIndex!==0){nav_left.show()}if((currentOpts.cyclic&¤tArray.length>1)||currentIndex!=(currentArray.length-1)){nav_right.show()}},fancybox_preload_images=function(){var href,objNext;if((currentArray.length-1)>currentIndex){href=currentArray[currentIndex+1].href;if(typeof href!=='undefined'&&href.match(imgRegExp)){objNext=new Image();objNext.src=href}}if(currentIndex>0){href=currentArray[currentIndex-1].href;if(typeof href!=='undefined'&&href.match(imgRegExp)){objNext=new Image();objNext.src=href}}},_finish=function(){inner.css('overflow',(currentOpts.scrolling=='auto'?(currentOpts.type=='image'||currentOpts.type=='iframe'||currentOpts.type=='swf'?'hidden':'auto'):(currentOpts.scrolling=='yes'?'auto':'visible')));if(!$.support.opacity){inner.get(0).style.removeAttribute('filter');wrap.get(0).style.removeAttribute('filter')}$('#fancybox-title').show();if(currentOpts.hideOnContentClick){inner.one('click',$.fancybox.close)}if(currentOpts.hideOnOverlayClick){overlay.one('click',$.fancybox.close)}if(currentOpts.showCloseButton){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);if(currentOpts.centerOnScroll){$(window).bind("scroll.fb",$.fancybox.center)}else{$(window).unbind("scroll.fb")}if($.isFunction(currentOpts.onComplete)){currentOpts.onComplete(currentArray,currentIndex,currentOpts)}busy=false;fancybox_preload_images()},fancybox_draw=function(pos){var width=Math.round(start_pos.width+(final_pos.width-start_pos.width)*pos),height=Math.round(start_pos.height+(final_pos.height-start_pos.height)*pos),top=Math.round(start_pos.top+(final_pos.top-start_pos.top)*pos),left=Math.round(start_pos.left+(final_pos.left-start_pos.left)*pos);wrap.css({'width':width+'px','height':height+'px','top':top+'px','left':left+'px'});width=Math.max(width-currentOpts.padding*2,0);height=Math.max(height-(currentOpts.padding*2+(titleh*pos)),0);inner.css({'width':width+'px','height':height+'px'});if(typeof final_pos.opacity!=='undefined'){wrap.css('opacity',(pos<0.5?0.5:pos))}},fancybox_get_obj_pos=function(obj){var pos=obj.offset();pos.top+=parseFloat(obj.css('paddingTop'))||0;pos.left+=parseFloat(obj.css('paddingLeft'))||0;pos.top+=parseFloat(obj.css('border-top-width'))||0;pos.left+=parseFloat(obj.css('border-left-width'))||0;pos.width=obj.width();pos.height=obj.height();return pos},fancybox_get_zoom_from=function(){var orig=selectedOpts.orig?$(selectedOpts.orig):false,from={},pos,view;if(orig&&orig.length){pos=fancybox_get_obj_pos(orig);from={width:(pos.width+(currentOpts.padding*2)),height:(pos.height+(currentOpts.padding*2)),top:(pos.top-currentOpts.padding-shadow),left:(pos.left-currentOpts.padding-shadow)}}else{view=fancybox_get_viewport();from={width:1,height:1,top:view[3]+view[1]*0.5,left:view[2]+view[0]*0.5}}return from},fancybox_show=function(){loading.hide();if(wrap.is(":visible")&&$.isFunction(currentOpts.onCleanup)){if(currentOpts.onCleanup(currentArray,currentIndex,currentOpts)===false){$.event.trigger('fancybox-cancel');busy=false;return}}currentArray=selectedArray;currentIndex=selectedIndex;currentOpts=selectedOpts;inner.get(0).scrollTop=0;inner.get(0).scrollLeft=0;if(currentOpts.overlayShow){if(isIE6){$('select:not(#fancybox-tmp select)').filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one('fancybox-cleanup',function(){this.style.visibility='inherit'})}overlay.css({'background-color':currentOpts.overlayColor,'opacity':currentOpts.overlayOpacity}).unbind().show()}final_pos=fancybox_get_zoom_to();fancybox_process_title();if(wrap.is(":visible")){$(close.add(nav_left).add(nav_right)).hide();var pos=wrap.position(),equal;start_pos={top:pos.top,left:pos.left,width:wrap.width(),height:wrap.height()};equal=(start_pos.width==final_pos.width&&start_pos.height==final_pos.height);inner.fadeOut(currentOpts.changeFade,function(){var finish_resizing=function(){inner.html(tmp.contents()).fadeIn(currentOpts.changeFade,_finish)};$.event.trigger('fancybox-change');inner.empty().css('overflow','hidden');if(equal){inner.css({top:currentOpts.padding,left:currentOpts.padding,width:Math.max(final_pos.width-(currentOpts.padding*2),1),height:Math.max(final_pos.height-(currentOpts.padding*2)-titleh,1)});finish_resizing()}else{inner.css({top:currentOpts.padding,left:currentOpts.padding,width:Math.max(start_pos.width-(currentOpts.padding*2),1),height:Math.max(start_pos.height-(currentOpts.padding*2),1)});fx.prop=0;$(fx).animate({prop:1},{duration:currentOpts.changeSpeed,easing:currentOpts.easingChange,step:fancybox_draw,complete:finish_resizing})}});return}wrap.css('opacity',1);if(currentOpts.transitionIn=='elastic'){start_pos=fancybox_get_zoom_from();inner.css({top:currentOpts.padding,left:currentOpts.padding,width:Math.max(start_pos.width-(currentOpts.padding*2),1),height:Math.max(start_pos.height-(currentOpts.padding*2),1)}).html(tmp.contents());wrap.css(start_pos).show();if(currentOpts.opacity){final_pos.opacity=0}fx.prop=0;$(fx).animate({prop:1},{duration:currentOpts.speedIn,easing:currentOpts.easingIn,step:fancybox_draw,complete:_finish})}else{inner.css({top:currentOpts.padding,left:currentOpts.padding,width:Math.max(final_pos.width-(currentOpts.padding*2),1),height:Math.max(final_pos.height-(currentOpts.padding*2)-titleh,1)}).html(tmp.contents());wrap.css(final_pos).fadeIn(currentOpts.transitionIn=='none'?0:currentOpts.speedIn,_finish)}},fancybox_process_inline=function(){tmp.width(selectedOpts.width);tmp.height(selectedOpts.height);if(selectedOpts.width=='auto'){selectedOpts.width=tmp.width()}if(selectedOpts.height=='auto'){selectedOpts.height=tmp.height()}fancybox_show()},fancybox_process_image=function(){busy=true;selectedOpts.width=imgPreloader.width;selectedOpts.height=imgPreloader.height;$("").attr({'id':'fancybox-img','src':imgPreloader.src,'alt':selectedOpts.title}).appendTo(tmp);fancybox_show()},fancybox_start=function(){fancybox_abort();var obj=selectedArray[selectedIndex],href,type,title,str,emb,selector,data;selectedOpts=$.extend({},$.fn.fancybox.defaults,(typeof $(obj).data('fancybox')=='undefined'?selectedOpts:$(obj).data('fancybox')));title=obj.title||$(obj).title||selectedOpts.title||'';if(obj.nodeName&&!selectedOpts.orig){selectedOpts.orig=$(obj).children("img:first").length?$(obj).children("img:first"):$(obj)}if(title===''&&selectedOpts.orig){title=selectedOpts.orig.attr('alt')}if(obj.nodeName&&(/^(?:javascript|#)/i).test(obj.href)){href=selectedOpts.href||null}else{href=selectedOpts.href||obj.href||null}if(selectedOpts.type){type=selectedOpts.type;if(!href){href=selectedOpts.content}}else if(selectedOpts.content){type='html'}else if(href){if(href.match(imgRegExp)){type='image'}else if(href.match(swfRegExp)){type='swf'}else if($(obj).hasClass("iframe")){type='iframe'}else if(href.match(/#/)){obj=href.substr(href.indexOf("#"));type=$(obj).length>0?'inline':'ajax'}else{type='ajax'}}else{type='inline'}selectedOpts.type=type;selectedOpts.href=href;selectedOpts.title=title;if(selectedOpts.autoDimensions&&selectedOpts.type!=='iframe'&&selectedOpts.type!=='swf'){selectedOpts.width='auto';selectedOpts.height='auto'}if(selectedOpts.modal){selectedOpts.overlayShow=true;selectedOpts.hideOnOverlayClick=false;selectedOpts.hideOnContentClick=false;selectedOpts.enableEscapeButton=false;selectedOpts.showCloseButton=false}if($.isFunction(selectedOpts.onStart)){if(selectedOpts.onStart(selectedArray,selectedIndex,selectedOpts)===false){busy=false;return}}tmp.css('padding',(shadow+selectedOpts.padding+selectedOpts.margin));$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change',function(){$(this).replaceWith(inner.children())});switch(type){case'html':tmp.html(selectedOpts.content);fancybox_process_inline();break;case'inline':$('
').hide().insertBefore($(obj)).bind('fancybox-cleanup',function(){$(this).replaceWith(inner.children())}).bind('fancybox-cancel',function(){$(this).replaceWith(tmp.children())});$(obj).appendTo(tmp);fancybox_process_inline();break;case'image':busy=false;$.fancybox.showActivity();imgPreloader=new Image();imgPreloader.onerror=function(){fancybox_error()};imgPreloader.onload=function(){imgPreloader.onerror=null;imgPreloader.onload=null;fancybox_process_image()};imgPreloader.src=href;break;case'swf':str='';emb='';$.each(selectedOpts.swf,function(name,val){str+='';emb+=' '+name+'="'+val+'"'});str+='';tmp.html(str);fancybox_process_inline();break;case'ajax':selector=href.split('#',2);data=selectedOpts.ajax.data||{};if(selector.length>1){href=selector[0];if(typeof data=="string"){data+='&selector='+selector[1]}else{data.selector=selector[1]}}busy=false;$.fancybox.showActivity();ajaxLoader=$.ajax($.extend(selectedOpts.ajax,{url:href,data:data,error:fancybox_error,success:function(data,textStatus,XMLHttpRequest){if(ajaxLoader.status==200){tmp.html(data);fancybox_process_inline()}}}));break;case'iframe':$('').appendTo(tmp);fancybox_show();break}},fancybox_animate_loading=function(){if(!loading.is(':visible')){clearInterval(loadingTimer);return}$('div',loading).css('top',(loadingFrame*-40)+'px');loadingFrame=(loadingFrame+1)%12},fancybox_init=function(){if($("#fancybox-wrap").length){return}$('body').append(tmp=$('
'),loading=$('
'),overlay=$('
'),wrap=$('
'));if(!$.support.opacity){wrap.addClass('fancybox-ie');loading.addClass('fancybox-ie')}outer=$('
').append('
').appendTo(wrap);outer.append(inner=$('
'),close=$(''),nav_left=$(''),nav_right=$(''));close.click($.fancybox.close);loading.click($.fancybox.cancel);nav_left.click(function(e){e.preventDefault();$.fancybox.prev()});nav_right.click(function(e){e.preventDefault();$.fancybox.next()});if(isIE6){overlay.get(0).style.setExpression('height',"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");loading.get(0).style.setExpression('top',"(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");outer.prepend('')}};$.fn.fancybox=function(options){$(this).data('fancybox',$.extend({},options,($.metadata?$(this).metadata():{}))).unbind('click.fb').bind('click.fb',function(e){e.preventDefault();if(busy){return}busy=true;$(this).blur();selectedArray=[];selectedIndex=0;var rel=$(this).attr('rel')||'';if(!rel||rel==''||rel==='nofollow'){selectedArray.push(this)}else{selectedArray=$("a[rel="+rel+"], area[rel="+rel+"]");selectedIndex=selectedArray.index(this)}fancybox_start();return false});return this};$.fancybox=function(obj){if(busy){return}busy=true;var opts=typeof arguments[1]!=='undefined'?arguments[1]:{};selectedArray=[];selectedIndex=opts.index||0;if($.isArray(obj)){for(var i=0,j=obj.length;iselectedArray.length||selectedIndex<0){selectedIndex=0}fancybox_start()};$.fancybox.showActivity=function(){clearInterval(loadingTimer);loading.show();loadingTimer=setInterval(fancybox_animate_loading,66)};$.fancybox.hideActivity=function(){loading.hide()};$.fancybox.next=function(){return $.fancybox.pos(currentIndex+1)};$.fancybox.prev=function(){return $.fancybox.pos(currentIndex-1)};$.fancybox.pos=function(pos){if(busy){return}pos=parseInt(pos,10);if(pos>-1&¤tArray.length>pos){selectedIndex=pos;fancybox_start()}if(currentOpts.cyclic&¤tArray.length>1&&pos<0){selectedIndex=currentArray.length-1;fancybox_start()}if(currentOpts.cyclic&¤tArray.length>1&&pos>=currentArray.length){selectedIndex=0;fancybox_start()}return};$.fancybox.cancel=function(){if(busy){return}busy=true;$.event.trigger('fancybox-cancel');fancybox_abort();if(selectedOpts&&$.isFunction(selectedOpts.onCancel)){selectedOpts.onCancel(selectedArray,selectedIndex,selectedOpts)}busy=false};$.fancybox.close=function(){if(busy||wrap.is(':hidden')){return}busy=true;if(currentOpts&&$.isFunction(currentOpts.onCleanup)){if(currentOpts.onCleanup(currentArray,currentIndex,currentOpts)===false){busy=false;return}}fancybox_abort();$(close.add(nav_left).add(nav_right)).hide();$('#fancybox-title').remove();wrap.add(inner).add(overlay).unbind();$(window).unbind("resize.fb scroll.fb");$(document).unbind('keydown.fb');function _cleanup(){overlay.fadeOut('fast');wrap.hide();$.event.trigger('fancybox-cleanup');inner.empty();if($.isFunction(currentOpts.onClosed)){currentOpts.onClosed(currentArray,currentIndex,currentOpts)}currentArray=selectedOpts=[];currentIndex=selectedIndex=0;currentOpts=selectedOpts={};busy=false}inner.css('overflow','hidden');if(currentOpts.transitionOut=='elastic'){start_pos=fancybox_get_zoom_from();var pos=wrap.position();final_pos={top:pos.top,left:pos.left,width:wrap.width(),height:wrap.height()};if(currentOpts.opacity){final_pos.opacity=1}fx.prop=1;$(fx).animate({prop:0},{duration:currentOpts.speedOut,easing:currentOpts.easingOut,step:fancybox_draw,complete:_cleanup})}else{wrap.fadeOut(currentOpts.transitionOut=='none'?0:currentOpts.speedOut,_cleanup)}};$.fancybox.resize=function(){var c,h;if(busy||wrap.is(':hidden')){return}busy=true;c=inner.wrapInner("
").children();h=c.height();wrap.css({height:h+(currentOpts.padding*2)+titleh});inner.css({height:h});c.replaceWith(c.children());$.fancybox.center()};$.fancybox.center=function(){busy=true;var view=fancybox_get_viewport(),margin=currentOpts.margin,to={};to.top=view[3]+((view[1]-((wrap.height()-titleh)+(shadow*2)))*0.5);to.left=view[2]+((view[0]-(wrap.width()+(shadow*2)))*0.5);to.top=Math.max(view[3]+margin,to.top);to.left=Math.max(view[2]+margin,to.left);wrap.css(to);busy=false};$.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:'auto',width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:'transparent'},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:'#666',titleShow:true,titlePosition:'outside',titleFormat:null,transitionIn:'fade',transitionOut:'fade',speedIn:300,speedOut:300,changeSpeed:300,changeFade:'fast',easingIn:'swing',easingOut:'swing',showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};$(document).ready(function(){fancybox_init()})})(jQuery); +// removed arrow functionality from vanilla pack + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index be025e2d7..c6282b1b8 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -601,3 +601,6 @@ h1.big_text { border: 1px solid #cccccc; border-bottom: none; padding: 3px 10px; } + +#fancybox-close:hover { + background-color: transparent; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 7f7125c49..206c122bd 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -756,3 +756,7 @@ h1.big_text :bottom none :padding 3px 10px + +#fancybox-close:hover + :background + :color transparent From c520fb71a71d09a9a8d9672aa1b5cb7735c1cac2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 21:34:15 -0700 Subject: [PATCH 074/101] Moved socket out to separate process. Multiple thins should now be possible --- Gemfile | 5 ++++- Gemfile.lock | 10 ++++++++++ app/controllers/sockets_controller.rb | 2 +- app/models/post.rb | 1 + config/app_config.yml | 1 + config/initializers/socket.rb | 26 -------------------------- lib/diaspora/websocket.rb | 6 +++++- 7 files changed, 22 insertions(+), 29 deletions(-) delete mode 100644 config/initializers/socket.rb diff --git a/Gemfile b/Gemfile index 77627808d..cc92bec3d 100644 --- a/Gemfile +++ b/Gemfile @@ -28,9 +28,12 @@ gem 'redfinger', :git => 'git://github.com/rsofaer/redfinger.git' #EventMachine gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http' -gem 'em-websocket' gem 'thin' +#Websocket +gem 'em-websocket' +gem 'magent', :git => 'http://github.com/dcu/magent.git' + #File uploading gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch gem 'mini_magick' diff --git a/Gemfile.lock b/Gemfile.lock index 007810850..dd181b320 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,6 +47,14 @@ GIT bcrypt-ruby (~> 2.1.2) warden (~> 0.10.7) +GIT + remote: http://github.com/dcu/magent.git + revision: 06513f3dac812469a55f2e365c349af4d2abc92a + specs: + magent (0.4.2) + mongo (>= 0.1.0) + uuidtools (>= 2.0.0) + GIT remote: http://github.com/jnunemaker/mongomapper.git revision: 931dab779011aa7acf60c1a4c7ad19e1ba838345 @@ -213,6 +221,7 @@ GEM treetop (1.4.8) polyglot (>= 0.3.1) tzinfo (0.3.23) + uuidtools (2.1.1) warden (0.10.7) rack (>= 1.0.0) webmock (1.3.5) @@ -242,6 +251,7 @@ DEPENDENCIES haml jnunemaker-validatable (= 1.8.4)! json + magent! mini_magick mocha mongo_mapper (= 0.8.4)! diff --git a/app/controllers/sockets_controller.rb b/app/controllers/sockets_controller.rb index 2852a7160..9b90ea831 100644 --- a/app/controllers/sockets_controller.rb +++ b/app/controllers/sockets_controller.rb @@ -14,7 +14,7 @@ class SocketsController < ApplicationController def outgoing(uid,object,opts={}) @_request = ActionDispatch::Request.new({}) - Diaspora::WebSocket.push_to_user(uid, action_hash(uid, object, opts)) + Diaspora::WebSocket.queue_to_user(uid, action_hash(uid, object, opts)) end end diff --git a/app/models/post.rb b/app/models/post.rb index e2dd53d3d..9f7c3ff27 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -4,6 +4,7 @@ class Post + require 'lib/diaspora/websocket' require 'lib/encryptable' include MongoMapper::Document include ApplicationHelper diff --git a/config/app_config.yml b/config/app_config.yml index 0a206c366..a138424ee 100644 --- a/config/app_config.yml +++ b/config/app_config.yml @@ -8,6 +8,7 @@ development: debug: false socket_debug : false socket_port: 8080 + socket_collection_name: 'websocket' pubsub_server: 'https://pubsubhubbub.appspot.com/' test: diff --git a/config/initializers/socket.rb b/config/initializers/socket.rb deleted file mode 100644 index 0b1035001..000000000 --- a/config/initializers/socket.rb +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2010, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3. See -# the COPYRIGHT file. - - -require 'em-websocket' -require 'eventmachine' -require 'lib/diaspora/websocket' - EM.next_tick { - Diaspora::WebSocket.initialize_channels - - EventMachine::WebSocket.start( - :host => "0.0.0.0", - :port => APP_CONFIG[:socket_port], - :debug =>APP_CONFIG[:socket_debug]) do |ws| - ws.onopen { - - sid = Diaspora::WebSocket.subscribe(ws.request['Path'].gsub('/',''), ws) - - ws.onmessage { |msg| SocketsController.new.incoming(msg) } - - ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) } - } - end - } - diff --git a/lib/diaspora/websocket.rb b/lib/diaspora/websocket.rb index fc79559f6..687bd2b7c 100644 --- a/lib/diaspora/websocket.rb +++ b/lib/diaspora/websocket.rb @@ -6,6 +6,11 @@ module Diaspora module WebSocket + def self.queue_to_user(uid, data) + channel = Magent::GenericChannel.new('websocket') + channel.enqueue({:uid => uid, :data => data}) + end + def self.initialize_channels @channels = {} end @@ -44,6 +49,5 @@ module Diaspora def unsocket_from_uid(id, opts={}) SocketsController.new.outgoing(id, Retraction.for(self), opts) end - end end From 7c02200a67f2257f5c35beceaa153b05a501bc4c Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 21:42:16 -0700 Subject: [PATCH 075/101] Finish moving out websocket server, add task to start it --- config/deploy.rb | 5 +++++ script/websocket_server.rb | 40 ++++++++++++++++++++++++++++++++++++++ spec/lib/websocket_spec.rb | 24 +++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 script/websocket_server.rb create mode 100644 spec/lib/websocket_spec.rb diff --git a/config/deploy.rb b/config/deploy.rb index b4870f94d..805eadf4d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -58,6 +58,11 @@ namespace :deploy do task :start do start_mongo start_thin + start_websocket + end + + task :start_websocket do + run("cd #{current_path} && bundle exec ruby ./script/websocket_server.rb > /dev/null&") end task :start_mongo do diff --git a/script/websocket_server.rb b/script/websocket_server.rb new file mode 100644 index 000000000..8c466ca77 --- /dev/null +++ b/script/websocket_server.rb @@ -0,0 +1,40 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + +require File.dirname(__FILE__) + '/../config/environment' +require File.dirname(__FILE__) + '/../lib/diaspora/websocket' + +CHANNEL = Magent::GenericChannel.new('websocket') +def process_message + if CHANNEL.queue_count > 0 + message = CHANNEL.dequeue + if message + Diaspora::WebSocket.push_to_user(message['uid'], message['data']) + end + EM.next_tick{ process_message} + else + EM::Timer.new(1){process_message} + end + +end + + EM.run { + Diaspora::WebSocket.initialize_channels + + EventMachine::WebSocket.start( + :host => "0.0.0.0", + :port => APP_CONFIG[:socket_port], + :debug =>APP_CONFIG[:socket_debug]) do |ws| + ws.onopen { + + sid = Diaspora::WebSocket.subscribe(ws.request['Path'].gsub('/',''), ws) + + ws.onmessage { |msg| SocketsController.new.incoming(msg) } + + ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) } + } + end + process_message + } + diff --git a/spec/lib/websocket_spec.rb b/spec/lib/websocket_spec.rb new file mode 100644 index 000000000..233f7be48 --- /dev/null +++ b/spec/lib/websocket_spec.rb @@ -0,0 +1,24 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + +require File.dirname(__FILE__) + '/../spec_helper' + +describe Diaspora::WebSocket do + before do + @user = Factory.create(:user) + @aspect = @user.aspect(:name => "losers") + @post = @user.build_post(:status_message, :message => "hey", :to => @aspect.id) + end + + it 'should queue a job' do + Diaspora::WebSocket.should_receive(:queue_to_user) + @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) + end + + it 'The queued job should reach Magent' do + Magent.should_receive(:push) + @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) + end + +end From 5c48e81f6785e30978ef536173a2f3959cba83bd Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 09:48:01 -0700 Subject: [PATCH 076/101] Give a little more feedback on the websocket server --- script/websocket_server.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/script/websocket_server.rb b/script/websocket_server.rb index 8c466ca77..7dee8d35c 100644 --- a/script/websocket_server.rb +++ b/script/websocket_server.rb @@ -35,6 +35,7 @@ end ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) } } end + puts "Websocket server started." process_message } From 99ad001d28bcd5875af4dbfe356641a9f6524b1d Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 09:52:31 -0700 Subject: [PATCH 077/101] Fix websocket spec, take out puts in by_webfinger --- app/models/person.rb | 2 +- spec/lib/websocket_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index 48e8b0816..ac4a5dfa7 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -85,7 +85,7 @@ class Person local_person elsif !identifier.include?("localhost") && !opts[:local] begin - puts "begin finger" + Rails.logger.info("Webfingering #{identifier}") 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/spec/lib/websocket_spec.rb b/spec/lib/websocket_spec.rb index 233f7be48..762a725b5 100644 --- a/spec/lib/websocket_spec.rb +++ b/spec/lib/websocket_spec.rb @@ -17,8 +17,9 @@ describe Diaspora::WebSocket do end it 'The queued job should reach Magent' do - Magent.should_receive(:push) @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) + channel = Magent::GenericChannel.new('websocket') + channel.message_count.should == 1 end end From 511a4487de43e8e56b4d871d9508a605b7cbf866 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 10:44:15 -0700 Subject: [PATCH 078/101] Make running the websocket server a little easier --- script/server | 5 +++++ script/websocket_server.rb | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 script/server diff --git a/script/server b/script/server new file mode 100755 index 000000000..0094482b1 --- /dev/null +++ b/script/server @@ -0,0 +1,5 @@ +#!/bin/bash + +mkdir -p -v log/thin/ +bundle exec ruby ./script/websocket_server.rb& +bundle exec thin start $@ diff --git a/script/websocket_server.rb b/script/websocket_server.rb index 7dee8d35c..2fbc1370a 100644 --- a/script/websocket_server.rb +++ b/script/websocket_server.rb @@ -19,6 +19,7 @@ def process_message end +begin EM.run { Diaspora::WebSocket.initialize_channels @@ -35,7 +36,13 @@ end ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) } } end + puts "Websocket server started." process_message } - +rescue RuntimeError => e + raise e unless e.message.include?("no acceptor") + puts "Are you sure the websocket server isn't already running?" + puts "Just start thin with bundle exec thin start." + Process.exit +end From be26794e4a5e25537aef7a79885014f5bfeb8df2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 10:46:14 -0700 Subject: [PATCH 079/101] only write to your own profile --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4a36672bc..dc25b47be 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -23,7 +23,7 @@ class UsersController < ApplicationController end def update - @user = User.find_by_id params[:id] + @user = current_user prep_image_url(params[:user]) @user.update_profile params[:user] From 5df33a6fd0dd8b87b1e8527b3c9b112fba7b734a Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 10:50:18 -0700 Subject: [PATCH 080/101] Take out users/show, use current_user in update --- app/controllers/users_controller.rb | 7 ------- config/routes.rb | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dc25b47be..72666bc30 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -7,13 +7,6 @@ class UsersController < ApplicationController before_filter :authenticate_user!, :except => [:new, :create] respond_to :html - respond_to :json, :only => :show - - def show - @user = User.find_by_id params[:id] - @user_profile = @user.person.profile - respond_with @user - end def edit @user = current_user diff --git a/config/routes.rb b/config/routes.rb index 12dd20ba7..188c4b137 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Diaspora::Application.routes.draw do resources :people, :only => [:index, :show, :destroy] - resources :users, :except => [:create, :new] + resources :users, :except => [:create, :new, :show] resources :status_messages, :only => [:create, :destroy, :show] resources :comments, :except => [:index] resources :requests, :except => [:edit, :update] From 3859f8a529b7ec49967f86282d82f10919c568ef Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 10:56:42 -0700 Subject: [PATCH 081/101] Adding instructions to readme --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d941ac182..2398be5dc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ You are welcome to contribute, add and extend Diaspora however you see fit. We 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. +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. 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. @@ -195,9 +195,15 @@ If you installed the OsX package through "brew", MongoDB will need to be started 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 server +`./script/server` will start both thin and the websocket server. If you want to run a different app server, you will have to run them separately. See below for instructions. + ### Run the app server Once mongo is running and bundler has finished, run `bundle exec thin start` from the root Diaspora directory. This will start the app server in development mode[.](http://bit.ly/9mwtUw) +### Run the websocket server +run `bundle exec ruby ./script/websocket_server` to start the websocket server on port 8080. Change the port in config/app_config.yml. + ### Logging in Run `rake db:seed:tom`, then login with user `tom` and password `evankorth`. More details in db/seeds/tom.rb. From a96a52def7ecc4404fa5e97c45feb19fa0c21dd7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 11:58:34 -0700 Subject: [PATCH 082/101] Run 3 thins --- config/sprinkle/conf/nginx.conf | 2 ++ config/thin.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/sprinkle/conf/nginx.conf b/config/sprinkle/conf/nginx.conf index da27b393b..eba9fa45b 100644 --- a/config/sprinkle/conf/nginx.conf +++ b/config/sprinkle/conf/nginx.conf @@ -33,6 +33,8 @@ http { # gzip_disable "MSIE [1-6]\.(?!.*SV1)"; upstream thin_cluster { server unix:/tmp/thin.0.sock; + server unix:/tmp/thin.1.sock; + server unix:/tmp/thin.2.sock; } server { diff --git a/config/thin.yml b/config/thin.yml index 7a74769cf..6a00fdb6c 100644 --- a/config/thin.yml +++ b/config/thin.yml @@ -14,7 +14,7 @@ require: [] max_persistent_conns: 512 environment: production -servers: 1 +servers: 3 daemonize: true #chdir: /usr/applications/localhash/current socket: /tmp/thin.sock From 71ac61c01d8166b8f6354f65bb8c166d293d6c5b Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 12:49:05 -0700 Subject: [PATCH 083/101] Fix websocket specs --- spec/lib/websocket_spec.rb | 20 ++++++++++++++++---- spec/spec_helper.rb | 8 +++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/spec/lib/websocket_spec.rb b/spec/lib/websocket_spec.rb index 762a725b5..018f5020d 100644 --- a/spec/lib/websocket_spec.rb +++ b/spec/lib/websocket_spec.rb @@ -9,6 +9,7 @@ describe Diaspora::WebSocket do @user = Factory.create(:user) @aspect = @user.aspect(:name => "losers") @post = @user.build_post(:status_message, :message => "hey", :to => @aspect.id) + unstub_sockets end it 'should queue a job' do @@ -16,10 +17,21 @@ describe Diaspora::WebSocket do @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) end - it 'The queued job should reach Magent' do - @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) - channel = Magent::GenericChannel.new('websocket') - channel.message_count.should == 1 + describe 'queuing and dequeuing ' do + before do + @post.socket_to_uid(@user.id, :aspect_ids => @aspect.id) + @channel = Magent::GenericChannel.new('websocket') + end + + it 'should send the queued job to Magent' do + @channel.message_count.should == 1 + end + + it 'should dequeue the job successfully' do + messages = @channel.message_count + @channel.dequeue + @channel.message_count.should == messages -1 + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c3995846e..3fdac9810 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -46,11 +46,17 @@ RSpec.configure do |config| end end def stub_sockets - Diaspora::WebSocket.stub!(:push_to_user).and_return(true) + Diaspora::WebSocket.stub!(:queue_to_user).and_return(true) Diaspora::WebSocket.stub!(:subscribe).and_return(true) Diaspora::WebSocket.stub!(:unsubscribe).and_return(true) end + def unstub_sockets + Diaspora::WebSocket.unstub!(:queue_to_user) + Diaspora::WebSocket.unstub!(:subscribe) + Diaspora::WebSocket.unstub!(:unsubscribe) + end + def stub_signature_verification (get_models.map{|model| model.camelize.constantize} - [User]).each do |model| model.any_instance.stubs(:verify_signature).returns(true) From b3549c79f4c101ff61b1e8d9d4fe393aec5e77fc Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 11:02:12 -0700 Subject: [PATCH 084/101] Give slightly more specific error message --- app/models/person.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/person.rb b/app/models/person.rb index ac4a5dfa7..1e2a7b18d 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -89,6 +89,8 @@ class Person f = Redfinger.finger(identifier) rescue SocketError => e raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/ + rescue Errno::ETIMEDOUT => e + raise "Connection timed out to Diaspora server for #{identifier}" end raise "No webfinger profile found at #{identifier}" if f.nil? || f.links.empty? Person.from_webfinger_profile(identifier, f ) From 81d753e7737d31524adc8984482af87d6dcb9613 Mon Sep 17 00:00:00 2001 From: Stephen Caudill Date: Fri, 17 Sep 2010 00:47:01 -0400 Subject: [PATCH 085/101] Refactor Album spec * use let(!) where appropriate (see [1] for more info). * use `context` to portray scenarios * use `describe` to portray method and Class specifications * omit the word "should" from example descriptions (Dave Chelimsky remarked to me that it was "tantamount to line-noise" and I'm of the opinion that it adds no value. * use more idiomatic Ruby (prefer things like 2.times to 1.upto(2)) * use more idiomatic Rails (prefer 1.minute.from_now to Time.now + 60*60) * use more idiomatic Rspec (prefer album.should be_valid to album.valid?.should be_true * also ensure to only make one assertion per example Other sundry cleanups. [1] http://rdoc.info/github/rspec/rspec-core/master/RSpec/Core/Let/ClassMethods#let-instance_method --- spec/models/album_spec.rb | 120 ++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 63 deletions(-) diff --git a/spec/models/album_spec.rb b/spec/models/album_spec.rb index 189361622..ed13ba102 100644 --- a/spec/models/album_spec.rb +++ b/spec/models/album_spec.rb @@ -2,87 +2,81 @@ # licensed under the Affero General Public License version 3. See # the COPYRIGHT file. - - -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' describe Album do - before do - @fixture_name = File.dirname(__FILE__) + '/../fixtures/button.png' - @user = Factory.create(:user) - @user.person.save - @aspect = @user.aspect(:name => "Foo") - @album = @user.post(:album, :name => "test collection", :to => @aspect.id) + let(:user) { Factory.create(:user) } + let(:person) { user.person } + let(:aspect) { user.aspect(:name => "Foo") } + let(:album) { user.post(:album, :name => "test collection", :to => aspect.id) } + + it 'is valid' do + album.should be_valid end - it 'should require a name' do - @album.name = "test collection" - @album.valid?.should be true - - @album.name = nil - @album.valid?.should be false + it 'validates presence of a name' do + album.name = nil + album.should_not be_valid end - it 'should contain photos' do - photo = Factory.build(:photo, :person => @user.person) - - @album.photos << photo - @album.photos.count.should == 1 + it 'has many photos' do + album.associations[:photos].type == :many end - it 'should remove all photos on album delete' do - photos = [] - 1.upto 3 do - photo = Photo.new(:person => @user.person, :album => @album, :created_at => Time.now) - photo.image.store! File.open @fixture_name - photos << photo - end - @album.photos += photos - - Photo.all.count.should == 3 - @album.destroy - Photo.all.count.should == 0 - end - - describe 'traversing' do + context 'when an album has two attached images' do before do - @photos = [] - 1.upto 3 do |n| - photo = Photo.new(:person => @user.person, :album => @album, :created_at => Time.now + n) - photo.image.store! File.open @fixture_name - @photos << photo + 2.times do + photo = Factory.build(:photo, :person => person, :album => album) + album.photos << photo end - @album.photos += @photos end - it 'should traverse the album correctly' do - #should retrieve the next photo relative to a given photo - @album.next_photo(@photos[1]).id.should == @photos[2].id - - #should retrieve the previous photo relative to a given photo - @album.prev_photo(@photos[1]).id.should == @photos[0].id - - #wrapping - #does next photo of last to first - @album.next_photo(@photos[2]).id.should == @photos[0].id - - #does previous photo of first to last - @album.prev_photo(@photos[0]).id.should == @photos[2].id + context 'when the album is deleted' do + it 'removes all child photos' do + expect{ album.destroy }.to change(Photo, :count).from(2).to(0) + end end end - describe 'serialization' do - before do - @xml = @album.to_xml.to_s + context 'traversing photos' do + let(:attrs) { {:person => person, :album => album} } + let!(:photo_1) { Factory(:photo, attrs.merge(:created_at => 2.days.ago)) } + let!(:photo_2) { Factory(:photo, attrs.merge(:created_at => 1.day.ago)) } + let!(:photo_3) { Factory(:photo, attrs.merge(:created_at => Time.now)) } + + describe '#next_photo' do + it 'returns the next photo' do + album.next_photo(photo_1).id.should == photo_2.id + end + + it 'returns the first photo when given the last photo in the album' do + album.next_photo(photo_3).id.should == photo_1.id + end end - it 'should have a person' do - @xml.include?(@album.person.id.to_s).should be true + + describe '#prev_photo' do + it 'returns the previous photo' do + album.prev_photo(photo_2).id.should == photo_1.id + end + + it 'returns the last photo when given the first photo in the album' do + album.prev_photo(photo_1).id.should == photo_3.id + end end - it 'should have a name' do - @xml.include?(@album.name).should be true + end + + describe '#to_xml' do + let(:doc) { album.to_xml } + it 'has a name' do + doc.at_xpath('./name').text.should == album.name end - it 'should have an id' do - @xml.include?(@album.id.to_s).should be true + + it 'has an id' do + doc.at_xpath('./_id').text.should == album.id.to_s + end + + it 'includes the person' do + doc.at_xpath('./person/_id').text.should == album.person.id.to_s end end end From f5c10bb24c937f0f03cbd0ed6797e2916ca363d4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 14:39:15 -0700 Subject: [PATCH 086/101] Put master deploy info back in master --- config/deploy.rb | 49 ++++++++++++++++++++---------- config/deploy_config.yml | 64 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 93 insertions(+), 20 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index bceef51b5..c84d25556 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -27,19 +27,22 @@ set :deploy_via, :checkout # set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || all['default_env'] -role :pivots, config['servers']['pivots']['url'] +role :tom, "tom.joindiaspora.com" +backers.each{ |backer| + role :backer, "#{backer['username']}.joindiaspora.com", :number => backer['number'] +} +#role :ci, "ci.joindiaspora.com" # If you are using Passenger mod_rails uncomment this: # if you're still using the script/reapear helper you will need # these http://github.com/rails/irs_process_scripts # Start Nginx after "deploy:cold" do - run("nginx") + #run("nginx") end namespace :deploy do - task :symlink_images do run "mkdir -p #{shared_path}/uploads" run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads" @@ -61,25 +64,20 @@ namespace :deploy do end task :start_mongo do - run("mkdir -p -v #{current_path}/log/db/ ") - run("mkdir -p -v #{shared_path}/db/") - run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " ) + run("mkdir -p -v #{current_path}/log/db/ ") + run("mkdir -p -v #{shared_path}/db/") + run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " ) end task :start_thin do - run("mkdir -p -v #{current_path}/log/thin/ ") - run("cd #{current_path} && bundle exec thin start -C config/thin.yml") + run("mkdir -p -v #{current_path}/log/thin/ ") + run("cd #{current_path} && bundle exec thin start -C config/thin.yml") end task :stop do stop_thin run("killall -s 2 mongod || true") end - - task :go_cold do - stop - run("killall nginx") - end task :stop_thin do run("killall -s 2 ruby || true") @@ -121,13 +119,32 @@ namespace :cloud do end end namespace :db do - - task :purge, :roles => [:pivots] do + + task :purge, :roles => [:tom, :backer] do run "cd #{current_path} && bundle exec rake db:purge --trace RAILS_ENV=#{rails_env}" end - + + task :tom_seed, :roles => :tom do + run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}" + run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends" + backers.each do |backer| + run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept" + #run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo" + end + + end + + task :backer_seed, :roles => :backer do + (0..10).each { |n| + run "curl -silent http://localhost/set_backer_number?number=#{n}", :only => {:number => n} + } + run "cd #{current_path} && bundle exec rake db:seed:backer --trace RAILS_ENV=#{rails_env}" + end + task :reset do purge + backer_seed + tom_seed end diff --git a/config/deploy_config.yml b/config/deploy_config.yml index 01bd94470..c653b6565 100644 --- a/config/deploy_config.yml +++ b/config/deploy_config.yml @@ -7,9 +7,65 @@ cross_server: deploy_to: '/usr/local/app/diaspora' user: 'root' - branch: 'production' repo: 'git@github.com:diaspora/diaspora.git' - default_env: 'production' + branch: 'master' + default_env: 'development' servers: - pivots: - url: 'pivots.joindiaspora.com' + tom: + - url: 'tom.joindiaspora.com' + backer: + - username: 'washington' + given_name: 'George' + family_name: 'Washington' + number: 0 + pin: 5072 + - username: 'adams' + given_name: 'John' + family_name: 'Adams' + number: 1 + pin: 3742 + - username: 'jefferson' + given_name: 'Thomas' + family_name: 'Jefferson' + number: 2 + pin: 7782 + - username: 'madison' + given_name: 'James' + family_name: 'Madison' + number: 3 + pin: 2691 + - username: 'monroe' + given_name: 'James' + family_name: 'Monroe' + number: 4 + pin: 6133 + - username: 'quincyadams' + given_name: 'John Quincy' + family_name: 'Adams' + number: 5 + pin: 7558 + - username: 'jackson' + given_name: 'Andrew' + family_name: 'Jackson' + number: 6 + pin: 8670 + - username: 'buren' + given_name: 'Martin' + family_name: 'Van Buren' + number: 7 + pin: 1559 + - username: 'harrison' + given_name: 'William Henry' + family_name: 'Harrison' + number: 8 + pin: 5404 + - username: 'tyler' + given_name: 'John' + family_name: 'Tyler' + number: 9 + pin: 6431 + - username: 'polk' + given_name: 'James K.' + family_name: 'Polk' + number: 10 + pin: 1957 From 84789f64c9fa8cb31a768bf3ea1dfe23ed14c7b5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 14:57:14 -0700 Subject: [PATCH 087/101] scope album queries through user --- app/controllers/albums_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index c4bab3d8a..dbd59c64e 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -26,7 +26,7 @@ class AlbumsController < ApplicationController end def destroy - @album = Album.find_by_id params[:id] + @album = current_user.album_by_id params[:id] @album.destroy flash[:notice] = "Album #{@album.name} deleted." respond_with :location => albums_url @@ -41,12 +41,12 @@ class AlbumsController < ApplicationController end def edit - @album = Album.find_by_id params[:id] + @album = current_user.album_by_id params[:id] redirect_to @album unless current_user.owns? @album end def update - @album = Album.find_by_id params[:id] + @album = current_user.album_by_id params[:id] if @album.update_attributes params[:album] flash[:notice] = "Album #{@album.name} successfully edited." respond_with @album From 5b29c2700a04c8bb18e131472b6a0a43351cc53b Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 17 Sep 2010 15:03:16 -0700 Subject: [PATCH 088/101] Restore thin yml --- config/thin.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/thin.yml b/config/thin.yml index 6a00fdb6c..b0a3abf8d 100644 --- a/config/thin.yml +++ b/config/thin.yml @@ -14,8 +14,8 @@ require: [] max_persistent_conns: 512 environment: production -servers: 3 +servers: 1 daemonize: true #chdir: /usr/applications/localhash/current -socket: /tmp/thin.sock -#port: 80 +#socket: /tmp/thin.sock +port: 80 From 182c6228f3bd7d8bb7bf58d6a64766761ae9a206 Mon Sep 17 00:00:00 2001 From: Patrick Aljord Date: Thu, 16 Sep 2010 14:05:28 +0800 Subject: [PATCH 089/101] show comments ordered by created_at, they are showing up at random order without that --- app/models/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 9f7c3ff27..e9e135abb 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -18,7 +18,7 @@ class Post key :person_id, ObjectId key :user_refs, Integer, :default => 0 - many :comments, :class_name => 'Comment', :foreign_key => :post_id + many :comments, :class_name => 'Comment', :foreign_key => :post_id, :order => 'created_at ASC' belongs_to :person, :class_name => 'Person' timestamps! From d1c7559c294eed5f05ede9be975a22c766b1d9fd Mon Sep 17 00:00:00 2001 From: Ethan Bruning Date: Sat, 18 Sep 2010 02:20:44 +0800 Subject: [PATCH 090/101] Added check to see if Mongod is running --- script/server | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/script/server b/script/server index 0094482b1..3804ccad9 100755 --- a/script/server +++ b/script/server @@ -1,5 +1,13 @@ #!/bin/bash -mkdir -p -v log/thin/ -bundle exec ruby ./script/websocket_server.rb& -bundle exec thin start $@ +# Check if Mongo is running + +if ! ps ax | grep -v grep | grep mongod >/dev/null +then + echo "Mongod not started" +else + mkdir -p -v log/thin/ + bundle exec ruby ./script/websocket_server.rb& + bundle exec thin start $@ +fi + From 2e55666b4607cd9f888cf71a5634a37a01215526 Mon Sep 17 00:00:00 2001 From: T-Moe Date: Sat, 18 Sep 2010 04:01:06 +0800 Subject: [PATCH 091/101] Added note about universe being required under Ubuntu to Readme.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2398be5dc..38b2e875a 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ To install Ruby 1.8.7 on **Ubuntu**, run the following command: sudo apt-get install ruby-full +Please note that you need to have Universe enabled in your /etc/apt/sources.list file to install ruby using apt-get. + At this time Fedora does not have Ruby 1.8.7. As a workaround it is possible to use [rvm](http://rvm.beginrescueend.com/) with a locally compiled Ruby installation. A semi automated method for doing this is available. It is highly recommended that you review the script before running it so you understand what will occur. The script can be executed by running the following command: ./script/bootstrap-fedora-diaspora.sh From 6223b7d78fbf0ed94f4a667e227c92d710ca6de9 Mon Sep 17 00:00:00 2001 From: cori schlegel Date: Fri, 17 Sep 2010 09:53:02 +0800 Subject: [PATCH 092/101] update README with mongodb install info for other Ubuntu distros --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38b2e875a..0af7c680a 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ To install MongoDB on **Ubuntu**, add the official MongoDB repository from this http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages -For Lucid, add the following line to your /etc/apt/sources.list: +For Lucid, add the following line to your /etc/apt/sources.list (for other distros, see http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages): deb http://downloads.mongodb.org/distros/ubuntu 10.4 10gen From 34578837878bed594823d8e4f40fdeabfb39e76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20Kr=C3=A4uter?= Date: Fri, 17 Sep 2010 06:11:57 +0800 Subject: [PATCH 093/101] added missing directory creation for mongodb mac os x installation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0af7c680a..46d353548 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,8 @@ If you're running a 32-bit system, run `wget http://fastdl.mongodb.org/linux/mon To install MongoDB on **Mac OS X**, run the following: brew install mongo + sudo mkdir -p /data/db + sudo chmod -Rv 777 /data/ ### OpenSSL From 2d16289e46976ee72c303310b9c2851bbaaf8616 Mon Sep 17 00:00:00 2001 From: Don Park Date: Sat, 18 Sep 2010 01:29:49 +0800 Subject: [PATCH 094/101] use photos_path to generate the correct POST destination for photo uploads --- app/views/photos/_new_photo.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml index f6777fa4a..0f1e423fb 100644 --- a/app/views/photos/_new_photo.haml +++ b/app/views/photos/_new_photo.haml @@ -9,7 +9,7 @@ element: document.getElementById('file-upload'), params: {'album_id' : "#{@album.id}"}, allowedExtensions: ['jpg', 'jpeg', 'png'], - action: "/photos" + action: "#{photos_path}" }); } window.onload = createUploader; From 1f2592db18d9ddc78f13ac3dee443452884a041d Mon Sep 17 00:00:00 2001 From: Johan Brinch Date: Thu, 16 Sep 2010 19:59:01 +0800 Subject: [PATCH 095/101] Remove trailing whitespace --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 46d353548..066e4171c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ After you have Ruby installed on your system, you will need to get RubyGems, the - [RubyGems](http://rubygems.org/) - Source for Ruby gems. - [Bundler](http://gembundler.com/) - Gem management tool for Ruby projects. -**We suggest using a package management system to download these dependencies. Trust us, it's going to make your life a lot easier. If you're using Mac OS X, you can use [homebrew](http://mxcl.github.com/homebrew/); if you're using Ubuntu, just use [Synaptic](http://www.nongnu.org/synaptic/) (it comes pre-installed); if you're using Fedora simply use [yum](http://yum.baseurl.org/). The instructions below assume you have these installed.** +**We suggest using a package management system to download these dependencies. Trust us, it's going to make your life a lot easier. If you're using Mac OS X, you can use [homebrew](http://mxcl.github.com/homebrew/); if you're using Ubuntu, just use [Synaptic](http://www.nongnu.org/synaptic/) (it comes pre-installed); if you're using Fedora simply use [yum](http://yum.baseurl.org/). The instructions below assume you have these installed.** ### Build Tools @@ -91,7 +91,7 @@ If you're running a 32-bit system, run `wget http://fastdl.mongodb.org/linux/mon # create the required data directory sudo mkdir -p /data/db sudo chmod -Rv 777 /data/ - + To install MongoDB on a x86_64 **Fedora** system, add the official MongoDB repository from MongoDB (http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages) into /etc/yum.repos.d/10gen.repo: @@ -143,11 +143,11 @@ To install ImageMagick on **Mac OS X**, run the following: ### Git To install Git on **Ubuntu**, run the following: - + sudo apt-get install git-core To install Git on **Fedora**, run the following: - + sudo yum install git @@ -237,5 +237,5 @@ Diaspora is free software: you can redistribute it and/or modify it under the te 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 . +You should have received a copy of the GNU Affero General Public License along with Diaspora. If not, see . From 773839308c4bb3313c04aa02b75e95d342d51cc1 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 17 Sep 2010 09:57:32 +0800 Subject: [PATCH 096/101] Moved .live(...) into $(function() {}) block - DOM logic should not be left to synchronously execute outside of a DOMContentLoaded closure --- public/javascripts/aspect-edit.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 86c61ba93..1b74108b2 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -3,18 +3,6 @@ * the COPYRIGHT file. */ - -$('#move_friends_link').live( 'click', function(){ - $.post('/aspects/move_friends', - { 'moves' : $('#aspect_list').data() }, - function(){ $('#aspect_title').html("Groups edited successfully!");}); - - $(".person").css('background-color','none'); - $('#aspect_list').removeData(); - $(".person").attr('from_aspect_id', function(){return $(this).parent().attr('id')}) - -}); - function decrementRequestsCounter(){ var old_request_count = $(".new_requests").html().match(/\d+/); @@ -30,6 +18,19 @@ function decrementRequestsCounter(){ } $(function() { + + + $('#move_friends_link').live( 'click', function(){ + $.post('/aspects/move_friends', + { 'moves' : $('#aspect_list').data() }, + function(){ $('#aspect_title').html("Groups edited successfully!");}); + + $(".person").css('background-color','none'); + $('#aspect_list').removeData(); + $(".person").attr('from_aspect_id', function(){return $(this).parent().attr('id')}) + + }); + $("ul .person").draggable({ revert: true }); From fcdc1d914ccc54b89d3bf553aaef7ba942255e37 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 17 Sep 2010 10:10:53 +0800 Subject: [PATCH 097/101] Cached all reused match selector sets, moved synchronous functions into callbacks where needed for optimization; Moved all DOM manip into $(function () {} ) --- public/javascripts/aspect-edit.js | 127 ++++++++++++++++++------------ 1 file changed, 76 insertions(+), 51 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 1b74108b2..986005e29 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -3,42 +3,53 @@ * the COPYRIGHT file. */ -function decrementRequestsCounter(){ - var old_request_count = $(".new_requests").html().match(/\d+/); +function decrementRequestsCounter() { + var $new_requests = $(".new_requests"), + old_request_count = $new_requests.html().match(/\d+/); if( old_request_count == 1 ) { - $(".new_requests").html( - $(".new_requests").html().replace(/ \(\d+\)/,'')); - + $new_requests.html( + $new_requests.html().replace(/ \(\d+\)/,'') + ); } else { - $(".new_requests").html( - $(".new_requests").html().replace(/\d+/,old_request_count-1)); + $new_requests.html( + $new_requests.html().replace(/\d+/,old_request_count-1) + ); } - } $(function() { $('#move_friends_link').live( 'click', function(){ - $.post('/aspects/move_friends', + $.post( + '/aspects/move_friends', { 'moves' : $('#aspect_list').data() }, - function(){ $('#aspect_title').html("Groups edited successfully!");}); + 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'); - $('#aspect_list').removeData(); - $(".person").attr('from_aspect_id', function(){return $(this).parent().attr('id')}) + $(".person") + .css('background-color','none') + .attr('from_aspect_id', function() { + return $(this).parent().attr('id') + }); }); - $("ul .person").draggable({ - revert: true - }); - - $("ul .requested_person").draggable({ + $("ul .person .requested_person").draggable({ revert: true }); + // Moved class to logic above - unnec duplicate logic + //$("ul .requested_person").draggable({ + // revert: true + //}); + $(".aspect ul").droppable({ hoverClass: 'active', drop: function(event, ui) { @@ -53,16 +64,23 @@ $(function() { } }); - }else { - var move = {}; - move[ 'friend_id' ] = ui.draggable[0].id - move[ 'to' ] = $(this)[0].id; - move[ 'from' ] = ui.draggable[0].getAttribute('from_aspect_id'); + } 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, []); + $aspect_list.data( ui.draggable[0].id, []); ui.draggable.css('background-color','#eee'); } else { - $('#aspect_list').data( ui.draggable[0].id, move); + $aspect_list.data( ui.draggable[0].id, move); ui.draggable.css('background-color','orange'); } } @@ -77,44 +95,51 @@ $(function() { if ($(ui.draggable[0]).hasClass('requested_person')){ $.ajax({ type: "DELETE", - url: "/requests/" + ui.draggable[0].getAttribute('request_id') + url: "/requests/" + ui.draggable.attr('request_id'), + success: function () { + decrementRequestsCounter(); + } }); - decrementRequestsCounter(); - $(ui.draggable[0]).fadeOut('slow') - }else{ + + } else { $.ajax({ type: "DELETE", - url: "/people/" + ui.draggable[0].id + url: "/people/" + ui.draggable.attr('id'), + success: function () { + alert("Removed Friend, proably want an undo countdown.") + } }); - alert("Removed Friend, proably want an undo countdown.") - $(ui.draggable[0]).fadeOut('slow') - + } + + $(ui.draggable[0]).fadeOut('slow'); // ui.draggable.fadeOut('slow') } }); -}); -$(".aspect h1").live( 'focus', function() { - var $this = $(this); - var id = $this.closest("li").children("ul").attr("id"); - var link = "/aspects/"+ id; + $(".aspect h1").live( 'focus', function() { - $this.keypress(function(e) { - if (e.which == 13) { - e.preventDefault(); - $this.blur(); + var $this = $(this), + id = $this.closest("li").children("ul").attr("id"), + link = "/aspects/"+ id; - //save changes - $.ajax({ - type: "PUT", - url: link, - data: {"aspect" : {"name" : $this.text() }} + $this.keypress(function(e) { + if (e.which == 13) { + e.preventDefault(); + $this.blur(); + + //save changes + $.ajax({ + type: "PUT", + url: link, + data: {"aspect" : {"name" : $this.text() }} + }); + } + //update all other aspect links + $this.keyup(function(e) { + $("#aspect_nav a[href='"+link+"']").text($this.text()); }); - } - //update all other aspect links - $this.keyup(function(e) { - $("#aspect_nav a[href='"+link+"']").text($this.text()); }); }); + }); From 535f6ed334b46bedc05b39efc9fae0badd2aabc1 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 17 Sep 2010 10:17:14 +0800 Subject: [PATCH 098/101] More clean up to decrementRequestsCounter() --- public/javascripts/aspect-edit.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 986005e29..c7061797d 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -5,15 +5,16 @@ function decrementRequestsCounter() { var $new_requests = $(".new_requests"), - old_request_count = $new_requests.html().match(/\d+/); + request_html = $new_requests.html(), + old_request_count = request_html.match(/\d+/); if( old_request_count == 1 ) { $new_requests.html( - $new_requests.html().replace(/ \(\d+\)/,'') + request_html.replace(/ \(\d+\)/,'') ); } else { $new_requests.html( - $new_requests.html().replace(/\d+/,old_request_count-1) + request_html.replace(/\d+/,old_request_count-1) ); } } From 0b91a2c186cb8bbbc1f335ca20e0ce007602f2bd Mon Sep 17 00:00:00 2001 From: Ariel Zavala Date: Thu, 16 Sep 2010 23:46:34 +0800 Subject: [PATCH 099/101] Added I18n initializer --- config/initializers/locale.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config/initializers/locale.rb diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb new file mode 100644 index 000000000..42f34a3a7 --- /dev/null +++ b/config/initializers/locale.rb @@ -0,0 +1,8 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + + +# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. +I18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] +I18n.default_locale = :en \ No newline at end of file From 6c3882ce570cf2e155e6f1b4de63dcc22b89e5e9 Mon Sep 17 00:00:00 2001 From: Ariel Zavala Date: Thu, 16 Sep 2010 23:47:54 +0800 Subject: [PATCH 100/101] Added devise spanish locale --- config/locales/devise.es.yml | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 config/locales/devise.es.yml diff --git a/config/locales/devise.es.yml b/config/locales/devise.es.yml new file mode 100644 index 000000000..70209ff79 --- /dev/null +++ b/config/locales/devise.es.yml @@ -0,0 +1,42 @@ +es: + errors: + messages: + not_found: 'no encontrado' + already_confirmed: 'ya ha sido confirmada' + not_locked: 'no está bloqueada' + + devise: + failure: + unauthenticated: 'Necesitas acceder a tu cuenta o registrarte antes de continuar.' + unconfirmed: 'Necesitas confirmar tu cuenta antes de continuar.' + locked: 'Tu cuenta esta bloqueada.' + invalid: 'Contraseña o Email incorrecto.' + invalid_token: 'Token de autenticación incorrecto.' + timeout: 'Tu sesión ha expirado, por favor accede de nuevo para continuar.' + inactive: 'Tu cuenta no ha sido activada.' + sessions: + signed_in: 'Has ingresado correctamente.' + signed_out: 'Has salido correctamente.' + passwords: + send_instructions: 'Recibirás un email con instrucciones para cambiar tu contraseña en poco minutos.' + updated: 'Tu contraseña ha sido modificada. Ya has accedido a tu cuenta.' + confirmations: + send_instructions: 'Recibirás un email con instrucciones para confirmar tu cuenta en poco minutos.' + confirmed: 'Tu cuenta ha sido confirmada. Ya has accedido a tu cuenta.' + registrations: + signed_up: 'Te has registrado correctamente. Si está disponible, te habremos enviado un email de confirmación.' + updated: 'Has actualizado tu cuenta correctamente.' + destroyed: '!Adiós! Tu cuenta ha sido cancelada. Esperamos verte pronto.' + unlocks: + send_instructions: 'Recibirás un email con instrucciones para desbloquear tu cuenta en pocos minutos.' + unlocked: 'Tu cuenta ha sido desbloqueada. Ya has accedido a tu cuenta.' + oauth_callbacks: + success: 'Has sido autorizado satisfactoriamente de la cuenta %{kind}.' + failure: 'No has sido autorizado en la cuenta %{kind} porque "%{reason}".' + mailer: + confirmation_instructions: + subject: 'Instrucciones de confirmación' + reset_password_instructions: + subject: 'Instrucciones para cambiar tu contraseña' + unlock_instructions: + subject: 'Instrucciones para desbloquear tu cuenta' \ No newline at end of file From 211bc1b59a2d188eacb99027a416e4cdaea1fde0 Mon Sep 17 00:00:00 2001 From: Vytautas Jakutis Date: Fri, 17 Sep 2010 05:09:38 +0800 Subject: [PATCH 101/101] adding Lithuanian locale, thanks to my friends and typewith.me :) --- config/locales/devise.lt.yml | 41 ++++++++++++++++++++++++++++++++++++ config/locales/lt.yml | 10 +++++++++ 2 files changed, 51 insertions(+) create mode 100644 config/locales/devise.lt.yml create mode 100644 config/locales/lt.yml diff --git a/config/locales/devise.lt.yml b/config/locales/devise.lt.yml new file mode 100644 index 000000000..86510d13c --- /dev/null +++ b/config/locales/devise.lt.yml @@ -0,0 +1,41 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + + +en: + errors: + messages: + not_found: "nerasta" + already_confirmed: "jau patvirtinta" + not_locked: "nebuvo užrakinta" + + devise: + failure: + unauthenticated: 'Norint tęsti, reikia prisijungti arba susikurti paskyrą.' + unconfirmed: 'Norint prisijungti, reikia patvirtinti savo paskyrą.' + locked: 'Jūsų paskyra yra užrakinta.' + invalid: 'Neteisingas el. pašto adresas arba slaptažodis.' + invalid_token: 'Neteisingas prisijungimo raktas.' + timeout: 'Sesija baigėsi. Norint tęsti, reikia prisijungti iš naujo.' + inactive: 'Paskyra dar neaktyvuota.' + sessions: + signed_in: 'Sėkmingai prisijungta.' + signed_out: 'Sėkmingai atsijungta.' + passwords: + send_instructions: 'Netrukus gausite el. laišką su nurodymais slaptažodžiui atstatyti.' + updated: 'Slaptažodis pakeistas sėkmingai. Jūs esate prisijungęs.' + confirmations: + send_instructions: 'Netrukus gausite el. laišką su nurodymais paskyros patvirtinimui.' + confirmed: 'Paskyra patvirtinta. Prisijungėte.' + registrations: + signed_up: 'Prisijungta sėkmingai. Jei nustatyta, patvirtinimas išsiųstas į jūsų el. paštą.' + updated: 'Paskyra atnaujinta sėkmingai.' + destroyed: 'Paskyra sėkmingai atšaukta. Iki pasimatymo!' + unlocks: + send_instructions: 'Netrukus gausite el. laišką su nurodymais paskyros atrakinimui.' + unlocked: 'Paskyra atrakinta. Prisijungėte.' + mailer: + confirmation_instructions: 'Nurodymai patvirtinimui' + reset_password_instructions: 'Nurodymai slaptažodžio atstatymui' + unlock_instructions: 'Nurodymai paskyros atrakinimui' diff --git a/config/locales/lt.yml b/config/locales/lt.yml new file mode 100644 index 000000000..d20c8ff38 --- /dev/null +++ b/config/locales/lt.yml @@ -0,0 +1,10 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + + +# Sample localization file for English. Add more files in this directory for other locales. +# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Sveikas pasauli"