From 05808456d842cfe7035ebcc882d5e2f97bd8cdf8 Mon Sep 17 00:00:00 2001 From: Federico Brubacher Date: Thu, 16 Sep 2010 12:21:08 -0300 Subject: [PATCH 1/7] fixed small issue in albums#update anad added corressponding controller test --- app/controllers/albums_controller.rb | 2 +- spec/controllers/albums_controller_spec.rb | 23 ++++++++++++++++++++++ spec/factories.rb | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 spec/controllers/albums_controller_spec.rb diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index f4d797a46..6432e2a88 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -45,7 +45,7 @@ class AlbumsController < ApplicationController end def update - @album = Album.find_params_by_id params[:id] + @album = Album.find_by_id params[:id] if @album.update_attributes params[:album] flash[:notice] = "Album #{@album.name} successfully edited." respond_with @album diff --git a/spec/controllers/albums_controller_spec.rb b/spec/controllers/albums_controller_spec.rb new file mode 100644 index 000000000..ce2bd305d --- /dev/null +++ b/spec/controllers/albums_controller_spec.rb @@ -0,0 +1,23 @@ +# 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' +include ApplicationHelper +describe AlbumsController do + render_views + before do + @user = Factory.create(:user) + @user.aspect(:name => "lame-os") + @album = Factory.create(:album) + sign_in :user, @user + end + + it "should update the name of an album" do + sign_in :user, @user + put :update, :id => @album._id, :album => { :name => "new_name"} + @album.reload.name.should eql("new_name") + end + +end diff --git a/spec/factories.rb b/spec/factories.rb index 918a210f2..4c59631d8 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -22,6 +22,11 @@ Factory.define :person do |p| p.serialized_key OpenSSL::PKey::RSA.generate(1024).public_key.export end +Factory.define :album do |p| + p.name "my first album" + p.person { |a| Factory.create(:person) } +end + Factory.define :person_with_private_key, :parent => :person do |p| p.serialized_key OpenSSL::PKey::RSA.generate(1024).export end From 1d8d35cb98aaa71345875b649cde412dcc3f65ba Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 14:36:35 -0700 Subject: [PATCH 2/7] Add contributor agreement to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cadceb2c0..28dab1d20 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ## Commit Guidlines You are welcome to contribute, add and extend Diaspora however you see fit. We will do our best to incorporate everything that meets our guidelines. +We need you to fill out a [contributor agreement form|https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq] before we can accept your patches. The agreement gives Diaspora joint ownership of the patch so the copyright isn't scattered. You can find it [here|https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq]. + All commits must be tested, and after each commit, all tests should be green before a pull request is sent. Please write your tests in Rspec or Test-Unit. GEMS: We would like to keep external dependencies unduplicated. We're using Nokogiri, and Mongomapper, and EM::HttpRequest as much as possible. We have a few gems in the project we'd rather not use, but if you can, use dependencies we already have. From 9827f02874a9ba9c02b1add0c2c9da8fc9834e42 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 14:38:08 -0700 Subject: [PATCH 3/7] I'm still learning markdown --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28dab1d20..89ea0ae19 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Commit Guidlines You are welcome to contribute, add and extend Diaspora however you see fit. We will do our best to incorporate everything that meets our guidelines. -We need you to fill out a [contributor agreement form|https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq] before we can accept your patches. The agreement gives Diaspora joint ownership of the patch so the copyright isn't scattered. You can find it [here|https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq]. +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. From 6f867d60c43038d6e6ee251c286f3166bbf9bb9d Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 14:38:24 -0700 Subject: [PATCH 4/7] MS fixed the nil hostname on user --- app/models/user.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6a76ce772..ddb8036fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -286,9 +286,13 @@ class User ###Helpers############ def self.instantiate!( opts = {} ) - opts[:person][:diaspora_handle] = "#{opts[:username]}@#{URI::parse(opts[:url]).host}" + hostname = opts[:url].gsub(/(https?:|www\.)\/\//, '') + hostname.chop! if hostname[-1, 1] == '/' + + opts[:person][:diaspora_handle] = "#{opts[:username]}@#{hostname}" + puts opts[:person][:diaspora_handle] opts[:person][:serialized_key] = generate_key - User.create!(opts) + User.create(opts) end def seed_aspects @@ -296,10 +300,6 @@ class User aspect(:name => "Work") end - def self.create(opts ={}) - puts opts.inspect - end - def terse_url terse = self.url.gsub(/(https?:|www\.)\/\//, '') terse = terse.chop! if terse[-1, 1] == '/' From 0eb2c97aef1b7e3269ed5a7fdf9fbd057b015ae6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 16 Sep 2010 14:51:27 -0700 Subject: [PATCH 5/7] object_path shouldn't create links to users --- app/helpers/application_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6c4240578..f2a0a95fd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,6 +10,7 @@ module ApplicationHelper end def object_path(object, opts = {}) + object = object.person if object.is_a? User eval("#{object.class.to_s.underscore}_path(object, opts)") end From 2e8785b59673b78b308c56aabbc65d564e96f676 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 15:04:29 -0700 Subject: [PATCH 6/7] 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 7/7] 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).