Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
cbb692b6a3
7 changed files with 41 additions and 10 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
## Commit Guidlines
|
## 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.
|
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.
|
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.
|
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.
|
||||||
|
|
@ -199,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.
|
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:
|
Ongoing discussion:
|
||||||
|
|
||||||
- [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev)
|
- [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev)
|
||||||
- [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss)
|
- [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)
|
- [#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).
|
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).
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class AlbumsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@album = Album.find_params_by_id params[:id]
|
@album = Album.find_by_id params[:id]
|
||||||
if @album.update_attributes params[:album]
|
if @album.update_attributes params[:album]
|
||||||
flash[:notice] = "Album #{@album.name} successfully edited."
|
flash[:notice] = "Album #{@album.name} successfully edited."
|
||||||
respond_with @album
|
respond_with @album
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def object_path(object, opts = {})
|
def object_path(object, opts = {})
|
||||||
|
object = object.person if object.is_a? User
|
||||||
eval("#{object.class.to_s.underscore}_path(object, opts)")
|
eval("#{object.class.to_s.underscore}_path(object, opts)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ class Request
|
||||||
validates_presence_of :destination_url, :callback_url
|
validates_presence_of :destination_url, :callback_url
|
||||||
before_validation :clean_link
|
before_validation :clean_link
|
||||||
|
|
||||||
scope :for_user, lambda{ |user| where(:destination_url => 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.receive_url) }
|
scope :from_user, lambda{ |user| where(:destination_url.ne => user.person.receive_url) }
|
||||||
|
|
||||||
def self.instantiate(options = {})
|
def self.instantiate(options = {})
|
||||||
person = options[:from]
|
person = options[:from]
|
||||||
|
|
|
||||||
|
|
@ -295,9 +295,13 @@ class User
|
||||||
|
|
||||||
###Helpers############
|
###Helpers############
|
||||||
def self.instantiate!( opts = {} )
|
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
|
opts[:person][:serialized_key] = generate_key
|
||||||
User.create!(opts)
|
User.create(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def seed_aspects
|
def seed_aspects
|
||||||
|
|
@ -305,10 +309,6 @@ class User
|
||||||
aspect(:name => "Work")
|
aspect(:name => "Work")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(opts ={})
|
|
||||||
puts opts.inspect
|
|
||||||
end
|
|
||||||
|
|
||||||
def terse_url
|
def terse_url
|
||||||
terse = self.url.gsub(/(https?:|www\.)\/\//, '')
|
terse = self.url.gsub(/(https?:|www\.)\/\//, '')
|
||||||
terse = terse.chop! if terse[-1, 1] == '/'
|
terse = terse.chop! if terse[-1, 1] == '/'
|
||||||
|
|
|
||||||
23
spec/controllers/albums_controller_spec.rb
Normal file
23
spec/controllers/albums_controller_spec.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -22,6 +22,11 @@ Factory.define :person do |p|
|
||||||
p.serialized_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
p.serialized_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
||||||
end
|
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|
|
Factory.define :person_with_private_key, :parent => :person do |p|
|
||||||
p.serialized_key OpenSSL::PKey::RSA.generate(1024).export
|
p.serialized_key OpenSSL::PKey::RSA.generate(1024).export
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue