From 7ecc94d7b2f4b772fb770f28c0a375b460463173 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 7 Oct 2010 14:03:18 -0700 Subject: [PATCH 1/6] added the password route to make email reset password work --- config/routes.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 2827c4cc7..bcb237671 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,7 +9,9 @@ Diaspora::Application.routes.draw do resources :requests, :except => [:edit, :update] resources :photos, :except => [:index] resources :albums - + + devise_for :users, :controllers => {:registrations => "registrations", + :password => "devise/passwords"} # added public route to user match 'public/:username', :to => 'users#public' resources :users, :except => [:create, :new, :show] @@ -31,7 +33,6 @@ Diaspora::Application.routes.draw do match 'set_profile_photo', :to => "dev_utilities#set_profile_photo" #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, :controllers => {:registrations => "registrations"} match 'login', :to => 'devise/sessions#new', :as => "new_user_session" match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" match 'signup', :to => 'registrations#new', :as => "new_user_registration" From 09dad2d80fafa5fd7e5aea02bc31f26ed11efcfd Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 7 Oct 2010 14:10:14 -0700 Subject: [PATCH 2/6] DG MS; exporter includes comments. exporter spec --- lib/diaspora/exporter.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/diaspora/exporter.rb b/lib/diaspora/exporter.rb index 9e2f719a5..106c94bb0 100644 --- a/lib/diaspora/exporter.rb +++ b/lib/diaspora/exporter.rb @@ -4,11 +4,6 @@ module Diaspora - def self.bone(user) - exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML) - exporter.execute(user) - end - class Exporter def initialize(strategy) self.class.send(:include, strategy) @@ -22,7 +17,7 @@ module Diaspora xml.user { xml.username user.username xml.serialized_private_key user.serialized_private_key - xml.person user.person.to_xml + xml.parent << user.person.to_xml xml.aspects { user.aspects.each do |aspect| @@ -36,8 +31,14 @@ module Diaspora end } xml.posts { - aspect.posts.each do |post| - xml.post post.to_xml if post.respond_to? :to_xml + aspect.posts.find_all_by_person_id(user.person.id).each do |post| + post_doc = post.to_xml + + post.comments.each do |comment| + post_doc << comment.to_xml + end + + xml.post post_doc end } } From 2451ac49575c58391cbafcc14b5fabb2e48a4266 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 7 Oct 2010 14:20:31 -0700 Subject: [PATCH 3/6] moved the SMTP setting into app_config.yml --- config/environments/development.rb | 16 ++++++++-------- config/environments/production.rb | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 15d1fc2bb..d848ad4e9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -24,15 +24,15 @@ Diaspora::Application.configure do config.active_support.deprecation = :log config.middleware.use MongoMapper::ClearDevMemory #config.threadsafe! - config.action_mailer.delivery_method = :smtp - config.action_mailer.default_url_options = {:host => 'localhost:3000'} + config.action_mailer.delivery_method = :smtp + config.action_mailer.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} 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", + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain], + :authentication => APP_CONFIG[:smtp_authentication], + :user_name => APP_CONFIG[:smtp_username], + :password => APP_CONFIG[:smtp_password], :enable_starttls_auto => true } end diff --git a/config/environments/production.rb b/config/environments/production.rb index cb13c1d1c..6b081b164 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,14 +49,14 @@ 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.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} 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", + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain], + :authentication => APP_CONFIG[:smtp_authentication], + :user_name => APP_CONFIG[:smtp_username], + :password => APP_CONFIG[:smtp_password], :enable_starttls_auto => true } end From 8f1973815e9dbe32ed6c9e4dbee1461b2a601e24 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 7 Oct 2010 14:21:53 -0700 Subject: [PATCH 4/6] DG MS; added route for exported xml --- app/controllers/users_controller.rb | 6 ++++++ config/routes.rb | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9b41b1fc9..0ee354dfb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,6 +4,7 @@ class UsersController < ApplicationController require File.expand_path('../../../lib/diaspora/ostatus_builder', __FILE__) + require File.expand_path('../../../lib/diaspora/exporter', __FILE__) before_filter :authenticate_user!, :except => [:new, :create, :public] @@ -56,6 +57,11 @@ class UsersController < ApplicationController end end + def export + exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML) + render :xml => exporter.execute(current_user) + end + private def prep_image_url(params) url = APP_CONFIG[:pod_url].chop if APP_CONFIG[:pod_url][-1,1] == '/' diff --git a/config/routes.rb b/config/routes.rb index bcb237671..6f9f529db 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,8 @@ Diaspora::Application.routes.draw do :password => "devise/passwords"} # added public route to user match 'public/:username', :to => 'users#public' - resources :users, :except => [:create, :new, :show] + match 'users/export', :to => 'users#export' + resources :users, :except => [:create, :new, :show] match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' From 2a104ea62240eab7b888a8b425be0436bffe0c15 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 7 Oct 2010 14:26:59 -0700 Subject: [PATCH 5/6] Revert "moved the SMTP setting into app_config.yml" This reverts commit 2451ac49575c58391cbafcc14b5fabb2e48a4266. --- config/environments/development.rb | 16 ++++++++-------- config/environments/production.rb | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index d848ad4e9..15d1fc2bb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -24,15 +24,15 @@ Diaspora::Application.configure do config.active_support.deprecation = :log config.middleware.use MongoMapper::ClearDevMemory #config.threadsafe! - config.action_mailer.delivery_method = :smtp - config.action_mailer.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} + config.action_mailer.delivery_method = :smtp + config.action_mailer.default_url_options = {:host => 'localhost:3000'} config.action_mailer.smtp_settings = { - :address => APP_CONFIG[:smtp_address], - :port => APP_CONFIG[:smtp_port], - :domain => APP_CONFIG[:smtp_domain], - :authentication => APP_CONFIG[:smtp_authentication], - :user_name => APP_CONFIG[:smtp_username], - :password => APP_CONFIG[:smtp_password], + :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 6b081b164..cb13c1d1c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,14 +49,14 @@ Diaspora::Application.configure do config.threadsafe! config.action_mailer.delivery_method = :smtp - config.action_mailer.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} + config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'} config.action_mailer.smtp_settings = { - :address => APP_CONFIG[:smtp_address], - :port => APP_CONFIG[:smtp_port], - :domain => APP_CONFIG[:smtp_domain], - :authentication => APP_CONFIG[:smtp_authentication], - :user_name => APP_CONFIG[:smtp_username], - :password => APP_CONFIG[:smtp_password], + :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 From 0f5a09783d912e953612ee7776ddfbb71574e850 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 7 Oct 2010 14:32:45 -0700 Subject: [PATCH 6/6] positioning --- lib/diaspora/exporter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/diaspora/exporter.rb b/lib/diaspora/exporter.rb index 106c94bb0..f23ed7681 100644 --- a/lib/diaspora/exporter.rb +++ b/lib/diaspora/exporter.rb @@ -16,9 +16,9 @@ module Diaspora builder = Nokogiri::XML::Builder.new do |xml| xml.user { xml.username user.username - xml.serialized_private_key user.serialized_private_key xml.parent << user.person.to_xml - + xml.serialized_private_key user.serialized_private_key + xml.aspects { user.aspects.each do |aspect| xml.aspect {