Merge branch 'upstream'

Conflicts:
	app/controllers/aspects_controller.rb
This commit is contained in:
Jeffry Degrande
2010-09-29 02:11:20 -03:00
249 changed files with 3086 additions and 1362 deletions

4
.gitignore vendored
View File

@@ -13,4 +13,8 @@ gpg/diaspora-production/*.gpg
gpg/*/random_seed
public/uploads/*
.rvmrc
.DS_Store
config/app_config.yml
bin/*
nbproject
config/initializers/secret_token.rb

View File

@@ -16,8 +16,8 @@ including the two.
You must obey the GNU Affero General Public License V3 or later in all respects
for all of the code used other than OpenSSL or the components mentioned
above. If you modify file(s) with this exception, you may extend this
exception to your version of the file(s), but you are not obligated to
above. If you modify file(s) with this exception, you may extend this
exception to your version of the file(s), but you are not obligated to
do so. If you do not wish to do so, delete this exception statement from your
version. If you delete this exception statement from all source files in the
version. If you delete this exception statement from all source files in the
program, then also delete it here.

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

18
Gemfile
View File

@@ -3,13 +3,11 @@ source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'bundler', '1.0.0'
#Security
gem 'devise', :git => 'http://github.com/BadMinus/devise.git'
#Mongo
gem 'mongo_mapper', '0.8.4', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'jnunemaker-validatable', '1.8.4', :git => 'http://github.com/jnunemaker/validatable.git'
gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'bson_ext', '1.0.7'
gem 'bson', '1.0.7'
@@ -21,6 +19,7 @@ gem 'will_paginate', '3.0.pre2'
gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
gem 'addressable', :require => 'addressable/uri'
gem 'json'
gem 'mini_fb'
#Standards
gem 'pubsubhubbub'
@@ -40,24 +39,23 @@ gem 'mini_magick'
group :test, :development do
gem 'factory_girl_rails'
gem 'ruby-debug' if RUBY_VERSION.include? "1.8"
end
group :test do
gem 'rspec', '>= 2.0.0.beta.17'
gem 'rspec-rails', '2.0.0.beta.17'
gem 'capybara', '~> 0.3.9'
gem 'cucumber-rails', '0.3.2'
gem 'rspec', '>= 2.0.0.beta.17'
gem 'rspec-rails', '2.0.0.beta.17'
gem 'mocha'
gem 'webrat', '0.7.2.beta.1'
gem 'redgreen'
gem 'redgreen' if RUBY_VERSION.include? "1.8"
gem 'autotest'
gem 'database_cleaner'
gem 'saucelabs-adapter', '= 0.8.12'
gem 'selenium-rc'
gem 'webmock'
end
group :development do
gem 'nifty-generators'
gem 'ruby-debug'
end
group :deployment do

View File

@@ -57,20 +57,14 @@ GIT
GIT
remote: http://github.com/jnunemaker/mongomapper.git
revision: 931dab779011aa7acf60c1a4c7ad19e1ba838345
revision: b0eac421ef5b3bee782e15d391eca372a189d414
branch: rails3
specs:
mongo_mapper (0.8.4)
activesupport (>= 2.3.4)
jnunemaker-validatable (~> 1.8.4)
activemodel (~> 3.0.0)
activesupport (~> 3.0.0)
plucky (~> 0.3.5)
GIT
remote: http://github.com/jnunemaker/validatable.git
revision: 8d7c3ce14133760e748a0e34b99dfe6ec4d69153
specs:
jnunemaker-validatable (1.8.4)
activesupport (>= 2.3.4)
GEM
remote: http://rubygems.org/
specs:
@@ -115,8 +109,24 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.0.0)
capybara (0.3.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3)
columnize (0.3.1)
crack (0.1.8)
cucumber (0.9.0)
builder (~> 2.1.2)
diff-lcs (~> 1.1.2)
gherkin (~> 2.2.2)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.12)
daemons (1.1.0)
database_cleaner (0.5.2)
diff-lcs (1.1.2)
@@ -130,18 +140,27 @@ GEM
factory_girl_rails (1.0)
factory_girl (~> 1.3)
rails (>= 3.0.0.beta4)
ffi (0.6.3)
rake (>= 0.8.7)
gherkin (2.2.4)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
trollop (~> 1.16.2)
haml (3.0.18)
hashie (0.4.0)
highline (1.6.1)
i18n (0.4.1)
json (1.4.6)
json_pure (1.4.6)
linecache (0.43)
lsof (0.3.0)
mail (2.2.6.1)
activesupport (>= 2.3.6)
mime-types
treetop (>= 1.4.5)
mime-types (1.16)
mini_fb (1.1.3)
hashie
rest-client
mini_magick (2.1)
subexec (~> 0.0.4)
mocha (0.9.8)
@@ -203,16 +222,13 @@ GEM
ruby-debug-base (~> 0.10.3.0)
ruby-debug-base (0.10.3)
linecache (>= 0.3)
saucelabs-adapter (0.8.12)
lsof (>= 0.3.0)
net-ssh (>= 2.0.12)
net-ssh-gateway (>= 1.0.1)
rest-client (>= 1.2.0)
selenium-client (>= 1.2.17)
selenium-client (1.2.18)
selenium-rc (2.2.4)
selenium-client (>= 1.2.18)
rubyzip (0.9.4)
selenium-webdriver (0.0.28)
ffi (>= 0.6.1)
json_pure
rubyzip
subexec (0.0.4)
term-ansicolor (1.0.5)
thin (1.2.7)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -220,6 +236,7 @@ GEM
thor (0.14.0)
treetop (1.4.8)
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.23)
uuidtools (2.1.1)
warden (0.10.7)
@@ -242,19 +259,21 @@ DEPENDENCIES
bson (= 1.0.7)
bson_ext (= 1.0.7)
bundler (= 1.0.0)
capybara (~> 0.3.9)
carrierwave!
cucumber-rails (= 0.3.2)
database_cleaner
devise!
em-http-request!
em-websocket
factory_girl_rails
haml
jnunemaker-validatable (= 1.8.4)!
json
magent!
mini_fb
mini_magick
mocha
mongo_mapper (= 0.8.4)!
mongo_mapper!
nifty-generators
pubsubhubbub
rails (= 3.0.0)
@@ -264,10 +283,7 @@ DEPENDENCIES
rspec (>= 2.0.0.beta.17)
rspec-rails (= 2.0.0.beta.17)
ruby-debug
saucelabs-adapter (= 0.8.12)
selenium-rc
sprinkle!
thin
webmock
webrat (= 0.7.2.beta.1)
will_paginate (= 3.0.pre2)

View File

@@ -1,3 +1,18 @@
# Diaspora
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**
Initial installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora).
We are continuing to build features and improve the code base.
When we think it is ready for general use, we will post more final
instructions.
## Commit Guidlines
You are welcome to contribute, add to and extend Diaspora however you see fit. We
@@ -17,23 +32,6 @@ Nokogiri, 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.
# Diaspora
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**
Some initial installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora).
We are continuing to build features and improve the code base.
When we think it is ready for general use, we will post more final
instructions.
## Resources
We are maintaining a

View File

@@ -2,12 +2,11 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
ENV['GNUPGHOME'] = File.expand_path("../../gpg/diaspora-#{Rails.env}/", __FILE__)
Diaspora::Application.load_tasks

View File

@@ -2,13 +2,13 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class ApplicationController < ActionController::Base
protect_from_forgery :except => :receive
before_filter :set_friends_and_status, :except => [:create, :update]
before_filter :count_requests
before_filter :fb_user_info
layout :layout_by_resource
@@ -22,7 +22,9 @@ class ApplicationController < ActionController::Base
def set_friends_and_status
if current_user
if params[:aspect] == nil || params[:aspect] == 'all'
if params[:action] == 'public'
@aspect = :public
elsif params[:aspect] == nil || params[:aspect] == 'all'
@aspect = :all
else
@aspect = current_user.aspect_by_id( params[:aspect])
@@ -37,4 +39,11 @@ class ApplicationController < ActionController::Base
@request_count = Request.for_user(current_user).size if current_user
end
def fb_user_info
if current_user
@access_token = warden.session[:access_token]
@logged_in = @access_token.present?
end
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class AspectsController < ApplicationController
before_filter :authenticate_user!
@@ -15,8 +14,12 @@ class AspectsController < ApplicationController
end
def create
@aspect = current_user.aspect params[:aspect]
flash[:notice] = I18n.t('aspects.create.success')
@aspect = current_user.aspect(params[:aspect])
if @aspect.valid?
flash[:notice] = I18n.t('aspects.create.success')
else
flash[:error] = I18n.t('aspects.create.failure')
end
respond_with :location => aspects_manage_path
end
@@ -45,6 +48,15 @@ class AspectsController < ApplicationController
respond_with @aspect
end
def public
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
:scope=>MiniFB.scopes.join(","))
@posts = current_user.visible_posts(:public => true).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
respond_with @aspect
end
def manage
@aspect = :manage
@remote_requests = Request.for_user(current_user).all

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class CommentsController < ApplicationController
before_filter :authenticate_user!

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class DevUtilitiesController < ApplicationController
before_filter :authenticate_user!, :except => [:set_backer_number]
include ApplicationHelper
@@ -16,7 +15,7 @@ class DevUtilitiesController < ApplicationController
bkr_info.each do |backer|
backer_email = "#{backer['username']}@#{backer['username']}.joindiaspora.com"
rel_hash = relationship_flow(backer_email)
logger.info "Zombefriending #{backer['given_name']} #{backer['family_name']}"
logger.info "Zombiefriending #{backer['given_name']} #{backer['family_name']}"
logger.info "Calling send_friend_request with #{rel_hash[:friend]} and #{current_user.aspects.first}"
current_user.send_friend_request_to(rel_hash[:friend], current_user.aspects.first)
end
@@ -30,11 +29,6 @@ class DevUtilitiesController < ApplicationController
}
end
def backer_info
config = YAML.load_file(File.dirname(__FILE__) + '/../../config/deploy_config.yml')
config['servers']['backer']
end
def set_backer_number
render :nothing => true
seed_num_hash = {:seed_number => params[:number]}
@@ -44,7 +38,6 @@ class DevUtilitiesController < ApplicationController
end
def set_profile_photo
render :nothing => true
album = Album.create(:person => current_user.person, :name => "Profile Photos")
current_user.raw_visible_posts << album
@@ -53,7 +46,7 @@ class DevUtilitiesController < ApplicationController
backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase
@fixture_name = File.dirname(__FILE__) + "/../../public/images/user/#{username}.jpg"
@fixture_name = File.join(File.dirname(__FILE__), "..", "..", "public", "images", "user", "#{username}.jpg")
photo = Photo.new(:person => current_user.person, :album => album)
photo.image.store! File.open(@fixture_name)
@@ -63,7 +56,6 @@ class DevUtilitiesController < ApplicationController
current_user.raw_visible_posts << photo
current_user.save
current_user.update_profile(:image_url => photo.url(:thumb_medium))
current_user.save
end
@@ -73,4 +65,11 @@ class DevUtilitiesController < ApplicationController
render "shared/log"
end
protected
def backer_info
config = YAML.load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "deploy_config.yml"))
config['servers']['backer']
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class PeopleController < ApplicationController
before_filter :authenticate_user!
@@ -22,7 +21,7 @@ class PeopleController < ApplicationController
@profile = @person.profile
@aspects_with_person = current_user.aspects_with_person(@person)
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
@posts = current_user.visible_posts(:from => @person).paginate :page => params[:page], :order => 'created_at DESC'
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
@latest_status_message = current_user.raw_visible_posts.find_all_by__type_and_person_id("StatusMessage", params[:id]).last
@post_count = @posts.count
respond_with @person

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class PhotosController < ApplicationController
before_filter :authenticate_user!
@@ -19,9 +18,15 @@ class PhotosController < ApplicationController
# get file content type
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
# create temporal file
file = Tempfile.new(file_name)
begin
file = Tempfile.new(file_name, {:encoding => 'BINARY'})
file.print request.raw_post.force_encoding('BINARY')
rescue RuntimeError => e
raise e unless e.message.include?('cannot generate tempfile')
file = Tempfile.new(file_name) # Ruby 1.8 compatibility
file.print request.raw_post
end
# put data into this file from raw post request
file.print request.raw_post
# create several required methods for this temporal file
Tempfile.send(:define_method, "content_type") {return att_content_type}
@@ -29,12 +34,10 @@ class PhotosController < ApplicationController
##############
params[:user_file] = file
data = clean_hash(params)
@photo = current_user.post(:photo, data)
respond_to do |format|
@@ -97,7 +100,6 @@ class PhotosController < ApplicationController
end
end
private
def clean_hash(params)
if params[:photo]

View File

@@ -2,10 +2,10 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class PublicsController < ApplicationController
require 'lib/diaspora/parser'
require File.expand_path('../../../lib/diaspora/parser', __FILE__)
include Diaspora::Parser
layout false
def hcard

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class RequestsController < ApplicationController
before_filter :authenticate_user!
include RequestsHelper
@@ -42,8 +41,6 @@ class RequestsController < ApplicationController
return
end
# rel_hash = {:friend => params[:friend_handle]}
Rails.logger.debug("Sending request: #{rel_hash}")

View File

@@ -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.
class ServicesController < ApplicationController
def create
puts 'services/create'
p params
code = params['code'] # Facebooks verification string
if code
access_token_hash = MiniFB.oauth_access_token(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create", FB_SECRET, code)
p access_token_hash
@access_token = access_token_hash["access_token"]
# TODO: This is where you'd want to store the token in your database
# but for now, we'll just keep it in the session so we don't need a database
warden.session[:access_token] = @access_token
flash[:success] = "Authentication successful."
end
redirect_to edit_user_url current_user
end
def destroy
warden.session[:access_token] = nil
warden.session[:user_id] = nil
redirect_to edit_user_url current_user
end
def fb_post
id = 'me'
type = 'feed'
@res = MiniFB.post(@access_token, id, :type=>type, :metadata=>true, :params=>params)
redirect_to edit_user_url current_user
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class SocketsController < ApplicationController
include ApplicationHelper
include SocketsHelper

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class StatusMessagesController < ApplicationController
before_filter :authenticate_user!
@@ -13,6 +12,15 @@ class StatusMessagesController < ApplicationController
params[:status_message][:to] = params[:aspect_ids]
data = clean_hash params[:status_message]
if @logged_in && params[:status_message][:public] == 'true'
id = 'me'
type = 'feed'
Rails.logger.info("Sending a message: #{params[:status_message][:message]} to Facebook")
@res = MiniFB.post(@access_token, id, :type=>type,
:metadata=>true, :params=>{:message => params[:status_message][:message]})
end
@status_message = current_user.post(:status_message, data)
respond_with @status_message
@@ -33,7 +41,8 @@ class StatusMessagesController < ApplicationController
def clean_hash(params)
return {
:message => params[:message],
:to => params[:to]
:to => params[:to],
:public => params[:public]
}
end
end

View File

@@ -2,17 +2,21 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class UsersController < ApplicationController
before_filter :authenticate_user!, :except => [:new, :create]
require File.expand_path('../../../lib/diaspora/ostatus_builder', __FILE__)
before_filter :authenticate_user!, :except => [:new, :create, :public]
respond_to :html
def edit
@user = current_user
@person = @user.person
@profile = @user.profile
@profile = @user.person.profile
@photos = Photo.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
:scope=>MiniFB.scopes.join(","))
end
def update
@@ -25,12 +29,31 @@ class UsersController < ApplicationController
respond_with(@user, :location => root_url)
end
def public
user = User.find_by_username(params[:username])
if user
director = Diaspora::Director.new
ostatus_builder = Diaspora::OstatusBuilder.new(user)
render :xml => director.build(ostatus_builder)
else
flash[:error] = "User #{params[:username]} does not exist!"
redirect_to root_url
end
end
private
def prep_image_url(params)
url = APP_CONFIG[:pod_url].chop if APP_CONFIG[:pod_url][-1,1] == '/'
if params[:profile][:image_url].empty?
params[:profile].delete(:image_url)
else
params[:profile][:image_url] = "http://" + request.host + ":" + request.port.to_s + params[:profile][:image_url]
if /^http:\/\// =~ params[:profile][:image_url]
params[:profile][:image_url] = params[:profile][:image_url]
else
params[:profile][:image_url] = url + params[:profile][:image_url]
end
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module AlbumsHelper
def friends_albums_link
if params[:friends]

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module ApplicationHelper
def current_aspect?(aspect)
!@aspect.is_a?(Symbol) && @aspect.id == aspect.id
@@ -67,4 +66,9 @@ module ApplicationHelper
def post_yield_tag(post)
(':' + post.id.to_s).to_sym
end
def connected_fb_as token
response_hash = MiniFB.get(token, 'me')
"Connected to facebook as #{response_hash[:name]}"
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module AspectsHelper
def link_for_aspect( aspect )
link_to aspect.name, aspect

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module DashboardsHelper
def title_for_page
I18n.t('dashboards.helper.home')

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module ErrorMessagesHelper
# Render error messages for the given objects. The :message and :header_message options are allowed.
def error_messages_for(*objects)

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module PeopleHelper
def search_or_index

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module PhotosHelper
def linked_scaled_photo(photo, album)
link_to (image_tag photo.url(:scaled_full)), photo_path(album.next_photo(photo)), :rel => "prefetch"

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module PublicsHelper
def subscribe(opts = {})
subscriber = Subscriber.first(:url => opts[:callback], :topic => opts[:topic])

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module RequestsHelper
def subscription_mode(profile)
if diaspora?(profile)

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module SocketsHelper
include ApplicationHelper

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
module StatusMessagesHelper
def my_latest_message
unless @latest_status_message.nil?

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Album < Post
xml_reader :name
@@ -17,7 +16,6 @@ class Album < Post
before_destroy :destroy_photos
def self.mine_or_friends(friend_param, current_user)
friend_param ? Album.find_all_by_person_id(current_user.friend_ids) : current_user.person.albums
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Aspect
include MongoMapper::Document

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Comment
include MongoMapper::Document
include ROXML
@@ -19,7 +18,6 @@ class Comment
key :post_id, ObjectId
key :person_id, ObjectId
belongs_to :post, :class_name => "Post"
belongs_to :person, :class_name => "Person"

31
app/models/fb_status.rb Normal file
View File

@@ -0,0 +1,31 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class FbStatus
include MongoMapper::Document
key :graph_id, String
key :author_id, String
key :author_name, String
key :message, String
key :updated_time, Time
timestamps!
validates_presence_of :graph_id,:author_id,:author_name,:message,:updated_time
def self.from_api(hash)
#just keeping them in memory for now
self.new(
:graph_id => hash['id'],
:author_id => hash['from']['id'],
:author_name => hash['from']['name'],
:message => hash['message'],
:updated_time => Time.parse(hash['updated_time'])
)
end
end

View File

@@ -2,8 +2,7 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
require 'lib/hcard'
require File.expand_path('../../../lib/hcard', __FILE__)
class Person
include MongoMapper::Document
@@ -18,7 +17,7 @@ class Person
key :url, String
key :diaspora_handle, String, :unique => true
key :serialized_key, String
key :serialized_public_key, String
key :owner_id, ObjectId
@@ -30,7 +29,7 @@ class Person
before_destroy :remove_all_traces
before_validation :clean_url
validates_presence_of :url, :profile, :serialized_key
validates_presence_of :url, :profile, :serialized_public_key
validates_format_of :url, :with =>
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
@@ -50,36 +49,32 @@ class Person
"#{self.url}receive/users/#{self.id}/"
end
def encryption_key
OpenSSL::PKey::RSA.new( serialized_key )
def public_url
"#{self.url}users/#{self.owner.username}/public"
end
def encryption_key= new_key
raise TypeError unless new_key.class == OpenSSL::PKey::RSA
serialized_key = new_key.export
end
def public_key_hash
Base64.encode64 OpenSSL::Digest::SHA256.new(self.exported_key).to_s
end
def public_key
encryption_key.public_key
OpenSSL::PKey::RSA.new( serialized_public_key )
end
def exported_key
encryption_key.public_key.export
serialized_public_key
end
def exported_key= new_key
raise "Don't change a key" if serialized_key
@serialized_key = new_key
raise "Don't change a key" if serialized_public_key
@serialized_public_key = new_key
end
def self.by_webfinger( identifier, opts = {})
#need to check if this is a valid email structure, maybe should do in JS
local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', '').to_s.downcase)
if local_person
Rails.logger.info("Do not need to webfinger, found a local person #{local_person.real_name}")
local_person
@@ -101,9 +96,9 @@ class Person
new_person = Person.new
public_key_entry = profile.links.select{|x| x.rel == 'diaspora-public-key'}
return nil unless public_key_entry
pubkey = public_key_entry.first.href
new_person.exported_key = Base64.decode64 pubkey

View File

@@ -2,7 +2,13 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class PhotoAlbumValidator < ActiveModel::Validator
def validate(document)
unless document.album.person_id == document.person_id
document.errors[:base] << "You post photos to that album"
end
end
end
class Photo < Post
require 'carrierwave/orm/mongomapper'
include MongoMapper::Document
@@ -22,7 +28,7 @@ class Photo < Post
timestamps!
validates_presence_of :album
validates_true_for :album_id, :logic => lambda {self.validate_album_person}
validates_with PhotoAlbumValidator
before_destroy :ensure_user_picture
@@ -36,10 +42,6 @@ class Photo < Post
photo
end
def validate_album_person
album.person_id == person_id
end
def remote_photo
image.url.nil? ? (remote_photo_path + '/' + remote_photo_name) : image.url
end
@@ -70,3 +72,4 @@ class Photo < Post
{:thumb_url => url(:thumb_medium), :id => id, :album_id => album_id}
end
end

View File

@@ -2,10 +2,9 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Post
require 'lib/diaspora/websocket'
require 'lib/encryptable'
require File.expand_path('../../../lib/encryptable', __FILE__)
require File.expand_path('../../../lib/diaspora/websocket', __FILE__)
include MongoMapper::Document
include ApplicationHelper
include ROXML
@@ -14,6 +13,9 @@ class Post
xml_accessor :_id
xml_accessor :person, :as => Person
xml_reader :public
key :public , Boolean, :default => false
key :person_id, ObjectId
key :user_refs, Integer, :default => 0
@@ -33,7 +35,6 @@ class Post
self.create params.to_hash
end
def as_json(opts={})
{
:post => {

View File

@@ -2,10 +2,9 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Profile
include MongoMapper::EmbeddedDocument
require 'lib/diaspora/webhooks'
require File.expand_path('../../../lib/diaspora/webhooks', __FILE__)
include Diaspora::Webhooks
include ROXML

View File

@@ -2,9 +2,8 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Request
require 'lib/diaspora/webhooks'
require File.expand_path('../../../lib/diaspora/webhooks', __FILE__)
include MongoMapper::Document
include Diaspora::Webhooks
include ROXML

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class Retraction
include ROXML
include Diaspora::Webhooks

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class StatusMessage < Post
xml_name :status_message
@@ -11,7 +10,6 @@ class StatusMessage < Post
key :message, String
validates_presence_of :message
def to_activity
<<-XML
<entry>

View File

@@ -2,11 +2,10 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
require 'lib/diaspora/user/friending.rb'
require 'lib/diaspora/user/querying.rb'
require 'lib/diaspora/user/receiving.rb'
require 'lib/salmon/salmon'
require File.expand_path('../../../lib/diaspora/user/friending', __FILE__)
require File.expand_path('../../../lib/diaspora/user/querying', __FILE__)
require File.expand_path('../../../lib/diaspora/user/receiving', __FILE__)
require File.expand_path('../../../lib/salmon/salmon', __FILE__)
class User
include MongoMapper::Document
@@ -19,6 +18,7 @@ class User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
key :username, :unique => true
key :serialized_private_key, String
key :friend_ids, Array
key :pending_request_ids, Array
@@ -36,7 +36,7 @@ class User
after_create :seed_aspects
before_validation_on_create :downcase_username
before_validation :downcase_username, :on => :create
def self.find_for_authentication(conditions={})
if conditions[:username] =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i # email regex
@@ -67,12 +67,11 @@ class User
def drop_aspect( aspect )
if aspect.people.size == 0
aspect.destroy
else
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])
@@ -108,17 +107,10 @@ class User
intitial_post(class_name, aspect_ids, options)
end
def intitial_post(class_name, aspect_ids, options = {})
def intitial_post(class_name, aspect_ids, options = {})
post = build_post(class_name, options)
post.socket_to_uid(id, :aspect_ids => aspect_ids) if post.respond_to?(:socket_to_uid)
push_to_aspects(post, aspect_ids)
post
end
def repost( post, options = {} )
aspect_ids = validate_aspect_permissions(options[:to])
push_to_aspects(post, aspect_ids)
post
end
@@ -129,16 +121,20 @@ class User
end
def validate_aspect_permissions(aspect_ids)
aspect_ids = [aspect_ids.to_s] if aspect_ids.is_a? BSON::ObjectId
if aspect_ids == "all"
return aspect_ids
end
aspect_ids = [aspect_ids.to_s] unless aspect_ids.is_a? Array
if aspect_ids.nil? || aspect_ids.empty?
raise ArgumentError.new("You must post to someone.")
end
aspect_ids.each do |aspect_id|
unless aspect_id == "all" || self.aspects.find(aspect_id)
unless self.aspects.find(aspect_id)
raise ArgumentError.new("Cannot post to an aspect you do not own.")
end
end
end
aspect_ids
@@ -250,7 +246,9 @@ class User
def self.instantiate!( opts = {} )
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}"
opts[:person][:url] = APP_CONFIG[:pod_url]
opts[:person][:serialized_key] = generate_key
opts[:serialized_private_key] = generate_key
opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key
User.create(opts)
end
@@ -258,7 +256,6 @@ class User
aspect(:name => "Family")
aspect(:name => "Work")
end
def diaspora_handle
"#{self.username}@#{APP_CONFIG[:terse_pod_url]}"
@@ -268,7 +265,6 @@ class User
username.downcase! if username
end
def as_json(opts={})
{
:user => {
@@ -279,7 +275,14 @@ class User
}
}
end
def self.generate_key
OpenSSL::PKey::RSA::generate 4096
end
def self.generate_key
OpenSSL::PKey::RSA::generate 4096
end
def encryption_key
OpenSSL::PKey::RSA.new( serialized_private_key )
end
end

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick

View File

@@ -15,4 +15,4 @@
%div.image_cycle
- for photo in post.photos[0..3]
= link_to (image_tag photo.url(:thumb_large)), album_path(post, :aspect => @aspect)

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h1=t('.add_a_new_album')
= form_for Album.new do |f|

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
.back= link_to "⇧ #{@album.name}", @album
%h1.big_text

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :head do
:javascript
$(document).ready(function(){

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
:javascript
$(document).ready(function(){
$(".image_thumb img").load( function() {
@@ -25,8 +24,6 @@
= @album.name
="#{t('.updated')} #{how_long_ago(@album)}"
.album_id{:id => @album.id, :style => "display:hidden;"}
-unless current_user.owns? @album

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h1=t('.add_a_new_aspect')
= form_for Aspect.new do |f|
= f.error_messages

View File

@@ -2,10 +2,8 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :page_title do
= link_to t('.photos'), albums_path(:aspect => @aspect)
- content_for :left_pane do
= render "shared/aspect_friends"

View File

@@ -2,8 +2,7 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :head do
- content_for :head do
= javascript_include_tag 'jquery-ui-1.8.4.custom.min.js'
= javascript_include_tag 'aspect-edit.js'
@@ -29,12 +28,10 @@
- content_for :publish do
= link_to(t('.add_a_new_aspect'), "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => t('.add_a_new_aspect'))
%ul#aspect_list
- for aspect in @aspects
%li.aspect
.aspect_name
%span.edit_name_field
%h1{:contenteditable => true}= aspect.name
@@ -44,9 +41,9 @@
%li= link_to t('.add_a_new_friend'), "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
%li= link_to t('.show'), aspect_path(aspect)
%li!= remove_link(aspect)
%ul.dropzone{:id => aspect.id}
-if aspect.people.size < 1
%li.grey Drag to add people

View File

@@ -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.
- content_for :page_title do
= link_to "photos", albums_path(:aspect => @aspect)
- content_for :left_pane do
= render "shared/aspect_friends"
- content_for :publish do
- if @logged_in
= render "shared/publisher", :aspect_ids => :public
- else
= render "shared/publisher", :aspect_ids => :all
%ul#stream
- for post in @posts
= render type_partial(post), :post => post unless post.class == Album
#pagination
= will_paginate @posts

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :page_title do
= link_to t('.photos'), albums_path(:aspect => @aspect)

View File

@@ -2,8 +2,7 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%li.comment{:id => post.id}
%li.comment{:id => post.id}
= person_image_tag(post.person)
%span.from
= link_to post.person.real_name, post.person

View File

@@ -2,11 +2,10 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%div.comments
%ul.comment_set{:id => post.id}
- for comment in post.comments
= render 'comments/comment', :post => comment
%li.comment.show
= render 'comments/new_comment', :post => post

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
= form_for Comment.new, :remote => true do |f|
%p
%label{:for => "comment_text_on_#{post.id}"} Comment

View File

@@ -1,7 +1,7 @@
%h1
This is a technology preview, do not provide any private information.
%h3
your account may be deleted until we move into a more stable development period.
%h3
your account may be deleted until we move into a more stable development period.
%h3
USE AT YOUR OWN RISK!!
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
= javascript_include_tag 'FABridge', 'swfobject', 'web_socket'
:javascript
WebSocket.__swfLocation = "/javascripts/WebSocketMain.swf";
@@ -19,25 +18,23 @@
if (obj['class']=="retractions"){
processRetraction(obj['post_id']);
}else if (obj['class']=="comments"){
processComment(obj['post_id'], obj['html'])
processComment(obj['post_id'], obj['html'])
}else if (obj['class']=='photos' && onPageForClass('albums')){
processPhotoInAlbum(obj['photo_hash'])
}else{
processPost(obj['class'], obj['html'], obj['aspect_ids'])
}
};
};
ws.onclose = function() { debug("socket closed"); };
ws.onopen = function() {
ws.send(location.pathname);
debug("connected...");
};
});
function processRetraction(post_id){
$('#' + post_id ).fadeOut(500, function(){
@@ -66,7 +63,7 @@
$(html).fadeIn("fast", function(){
$("#stream label:first").inFieldLabels();
})
);
);
}
}
@@ -77,13 +74,13 @@
html = "<div class=\'image_thumb\' id=\'"+photoHash['id']+"\' style=\'padding-right:3px;\'> \
<a href=\"/photos/"+ photoHash['id'] +"\"> \
<img alt=\"New thumbnail\" src=\""+ photoHash['thumb_url'] +"\" /> \
</a> </div>"
</a> </div>"
$("#thumbnails").append( $(html) )
$("#"+ photoHash['id'] + " img").load( function() {
$(this).fadeIn("slow");
});
}
function onPageForClass(className){
return (location.href.indexOf(className) != -1 );
}
@@ -100,9 +97,9 @@
}
function onPageForAspect(aspectId){
return (location.href.indexOf(aspectId) != -1 )
return (location.href.indexOf(aspectId) != -1 )
}
function onPageOne() {
var c = document.location.search.charAt(document.location.search.length-1);
return ((c =='') || (c== '1'));

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
!!!
%html
%head
@@ -10,24 +9,24 @@
= "#{current_user.real_name} | diaspora" if current_user
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
= stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "application", "ui"
= stylesheet_link_tag "/../javascripts/fancybox/jquery.fancybox-1.3.1"
= stylesheet_link_tag "fileuploader"
= stylesheet_link_tag "/../javascripts/fancybox/jquery.fancybox-1.3.1"
= stylesheet_link_tag "fileuploader"
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery-1.4.2.min', 'rails'
= javascript_include_tag 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'
= javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
= javascript_include_tag 'fileuploader'
= javascript_include_tag 'view', 'image_picker', 'stream'
= render 'js/websocket_js'
= csrf_meta_tag
= yield(:head)

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
!!!
%html
%head
@@ -10,7 +9,7 @@
DIASPORA | login
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%meta{"http-equiv"=> "X-UA-Compatible", :content =>"chrome=1" }
= stylesheet_link_tag "sessions"
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery142'
@@ -18,10 +17,10 @@
:javascript
$(document).ready(function(){
$("#user_username").focus();
$("#user_username").focus();
$("label").inFieldLabels();
});
= csrf_meta_tag
= yield(:head)
@@ -44,11 +43,11 @@
</div>
</div>
<![endif]-->
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}"
%div#huge_text
DIASPORA*
= yield
/= link_to "signup", "/signup"

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :publish do
%h1
Search
@@ -21,5 +20,5 @@
%ul#stream
- for person in @people
= render 'people/person', :person => person
= will_paginate @people

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- title=t('.new_person')
= form_for @person do |f|
@@ -15,18 +14,17 @@
= f.label :url
%br
= f.text_field :url
=f.fields_for :profile do |p|
%p
= p.label :first_name
%br
= p.text_field :first_name
%p
= p.label :last_name
%br
= p.text_field :last_name
= f.submit
%p= link_to t('.back_to_list'), people_path

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- content_for :page_title do
profile
@@ -28,7 +27,7 @@
= link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
.span-20.last
.span-19.last
- if @posts
%ul#stream

View File

@@ -2,16 +2,15 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
:javascript
function createUploader(){
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-upload'),
params: {'album_id' : "#{@album.id}"},
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
action: "#{photos_path}"
});
});
}
window.onload = createUploader;
window.onload = createUploader;
#file-upload

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%li.message{:id => post.id}
= person_image_tag(post.person)
@@ -17,9 +16,19 @@
%br
= render "albums/album", :post => post.album, :current_user => current_user
= link_to (image_tag post.url(:thumb_medium)), object_path(post)
.info
= link_to(how_long_ago(post), photo_path(post))
\--
= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post
= render "comments/comments", :post => post
- if post.public?
.public_aspect_tag
public
- else
.aspect_tag
%ul
- for aspect in current_user.aspects_with_post( post.id )
%li= aspect.name

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h1.big_text
.back
= link_to "⇧ #{@album.name}", album_path(@album)
@@ -14,6 +13,7 @@
= linked_scaled_photo @photo, @album
= form_for @photo do |p|
= p.label :caption
= p.text_field :caption, :value => @photo.caption
= p.submit

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
- title t('.new_photo')
= form_for( @photo, :html => {:multipart => true}) do |f|

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
:javascript
$(document).keydown(function(e){
switch(e.keyCode) {
@@ -35,7 +34,6 @@
-if current_user.owns? @album
= link_to t('.edit_photo'), edit_photo_path(@photo), :class => "button"
%div{:id => @photo.id}
#show_photo
= linked_scaled_photo @photo, @album
@@ -53,4 +51,4 @@
%h4{:class => "show_post_comments"}
= "#{t('.comments')} (#{@photo.comments.count})"
= render "comments/comments", :post => @photo

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
#debug_info
%h5 DEBUG INFO
#debug_more{ :style => "display:none;" }

View File

@@ -2,8 +2,7 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%ul
%h3= link_to post.class, object_path(post)
%h3= link_to post.class, object_path(post)
- for field in object_fields(post)
%li= "#{field}: #{post.attributes[field]}"
%li= "#{field}: #{post.attributes[field]}"

View File

@@ -1,42 +1,42 @@
<div id="content">
<h1><%=@person.real_name%></h1>
<div id="content_inner">
<div id="i" class="entity_profile vcard author">
<h2>User profile</h2>
<dl class="entity_nickname">
<dt>Nickname</dt>
<dd>
<a href="<%=@person.url%>" rel="me" class="nickname url uid"><%= @person.real_name%></a>
</dd>
</dl>
<dl class="entity_given_name">
<dt>Full name</dt>
<dd>
<span class="given_name" ><%= @person.profile.first_name %></span>
</dd>
<div id="content">
<h1><%=@person.real_name%></h1>
<div id="content_inner">
<div id="i" class="entity_profile vcard author">
<h2>User profile</h2>
<dl class="entity_nickname">
<dt>Nickname</dt>
<dd>
<a href="<%=@person.url%>" rel="me" class="nickname url uid"><%= @person.real_name%></a>
</dd>
</dl>
<dl class="entity_given_name">
<dt>Full name</dt>
<dd>
<span class="given_name" ><%= @person.profile.first_name %></span>
</dd>
</dl>
<dl class="entity_family_name">
<dt>Full name</dt>
<dd>
<span class="family_name" ><%= @person.profile.last_name %></span>
</dd>
<dl class="entity_family_name">
<dt>Full name</dt>
<dd>
<span class="family_name" ><%= @person.profile.last_name %></span>
</dd>
</dl>
<dl class="entity_fn">
<dt>Full name</dt>
<dd>
<span class="fn" ><%= @person.real_name %></span>
</dd>
</dl>
<dl class="entity_url">
<dt>URL</dt>
<dd>
<a href="<%= @person.url%>" rel="me" id="pod_location" class="url"><%= @person.url%></a>
</dd>
</dl>
<dl class="entity_note">
<dt>Note</dt>
<dd class="note">Diaspora is awesome! vi is better than emacs!</dd>
</dl>
</div>
</div>
</div>
<dl class="entity_fn">
<dt>Full name</dt>
<dd>
<span class="fn" ><%= @person.real_name %></span>
</dd>
</dl>
<dl class="entity_url">
<dt>URL</dt>
<dd>
<a href="<%= @person.url%>" rel="me" id="pod_location" class="url"><%= @person.url%></a>
</dd>
</dl>
<dl class="entity_note">
<dt>Note</dt>
<dd class="note">Diaspora is awesome! vi is better than emacs!</dd>
</dl>
</div>
</div>
</div>

View File

@@ -1,8 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
xmlns:hm='http://host-meta.net/xrd/1.0'>
<hm:Host><%= terse_url(root_url) %></hm:Host>
<Link rel='lrdd'
<Link rel='lrdd'
template='<%= root_url %>webfinger?q={uri}'>
<Title>Resource Descriptor</Title>
</Link>

View File

@@ -1,6 +1,5 @@
= image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg"
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
%p
= f.label :username

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h1
=t('.add_a_new_friend_to')
%i= aspect.name
@@ -10,7 +9,7 @@
= form_for Request.new do |f|
= f.error_messages
=t('.enter_a_diaspora_username')
=t('.enter_a_diaspora_username')
%br
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle

View File

@@ -2,19 +2,22 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
#friend_pictures
= owner_image_link
- for friend in @friends
= person_image_link(friend)
-unless @aspect == :all
- if @logged_in && (@aspect == :public)
%h3 Facebook Friends
- @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
- @fb_friends[:data].each do |friend|
= image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
-unless (@aspect == :all) || (@aspect == :public)
= link_to (image_tag('add_friend_button.png', :height => "50px", :width => "50px")), "#add_request_pane", :id => 'add_request_button'
.yo{:style => 'display:none'}
#add_request_pane
= render "requests/new_request", :aspect => @aspect
= render "requests/new_request", :aspect => @aspect
-else
.clear
= link_to t('.add_friends'), aspects_manage_path
= link_to t('.add_friends'), aspects_manage_path

View File

@@ -2,16 +2,17 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
#aspect_nav
%ul
%li{:class => ("selected" if @aspect == :all)}
= link_to t('.all_aspects'), root_url
- for aspect in @aspects
%li{:class => ("selected" if current_aspect?(aspect))}
= link_for_aspect aspect
%ul{ :style => "position:absolute;right:0;bottom:0.01em;"}
%li{:class => ("selected" if @aspect == :all)}
= link_to t('.all_aspects'), root_url
%li{:class => ("selected" if @aspect == :public)}
= link_to "Public", aspects_public_path
%li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)}
= link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects')

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%li.message{:id => post.id, :class => ("mine" if current_user.owns?(post))}
= person_image_link(post.person)
= yield post_yield_tag(post)

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
#publisher
= owner_image_tag
@@ -11,12 +10,13 @@
%p
%label{:for => "status_message_message"} Message
= f.text_area :message, :rows => 2, :value => params[:prefill]
= connected_fb_as(@access_token) if @logged_in && @aspect == :public
= f.hidden_field( :public, :value => (params[:action] == 'public') )
%ul.aspect_selector{ :style => "display:none;"}
going to...
- for aspect in @aspects
%li
= check_box_tag("aspect_ids[]", aspect.id, @aspect == :all || current_aspect?(aspect) )
= check_box_tag("aspect_ids[]", aspect.id, @aspect == :public || @aspect == :all || current_aspect?(aspect) )
= aspect.name
= f.submit t('.share')

View File

@@ -2,8 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
:javascript
$(".reshare_button").toggle(function(e){
e.preventDefault();
@@ -19,7 +17,7 @@
%ul.reshare_box
- for aspect in current_user.aspects_with_post( post.id )
%li.currently_sharing= aspect.name
- for aspect in current_user.aspects

View File

@@ -8,6 +8,8 @@
%h1
- if @aspect == :all
= link_to t('.all_aspects'), root_path
- elsif @aspect == :public
= "Public"
- elsif @aspect == :manage
= link_to t('.manage_aspects'), root_path
- else

View File

@@ -2,5 +2,4 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
= @log.to_s

View File

@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
= form_for StatusMessage.new, :remote => true do |f|
= f.error_messages
%p

View File

@@ -2,24 +2,33 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%li.message{:id => post.id, :class => ("mine" if current_user.owns?(post))}
= person_image_link(post.person)
.content
%span.from
= link_to post.person.real_name, post.person
= link_to post.person.real_name, post.person
= post.message
.info
%span.time= link_to(how_long_ago(post), object_path(post))
\--
= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post
= render "comments/comments", :post => post
- if current_user.owns?(post)
.destroy_link
= link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render "shared/reshare", :post => post, :current_user => current_user
= render "shared/reshare", :post => post, :current_user => current_user
- if post.public?
.public_aspect_tag
public
- else
.aspect_tag
%ul
- for aspect in current_user.aspects_with_post( post.id )
%li= aspect.name

View File

@@ -2,11 +2,10 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h1.big_text status messages
= render "status_messages/new_status_message", :status_message => @status_message
%ul#stream
- for status_message in @status_messages
= render "status_message", :post => status_message
#pagination

View File

@@ -7,6 +7,7 @@
= @status_message.message
%h4= "#{t('.comments')} (#{@status_message.comments.count})"
= render "comments/comments", :post => @status_message
%p

View File

@@ -0,0 +1,59 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
%h2 Profile
= form_for @user do |f|
= f.error_messages
= f.fields_for :profile do |p|
%h3="#{t('.picture')}"
%div#image_picker
= p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
- unless @photos.nil? || @photos.empty?
- for photo in @photos
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
= check_box_tag 'checked_photo', true, true
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
%div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
=t('.you_dont_have_any_photos')
= link_to t('.albums'), albums_path(:aspect => 'all')
=t('.page_to_upload_some')
=will_paginate @photos
%br
%h3="#{t('.info')}"
%p
%b
="#{t('.diaspora_username')}:"
= @user.diaspora_handle
%p
= p.label :first_name
= p.text_field :first_name, :value => @profile.first_name
%p
= p.label :last_name
= p.text_field :last_name, :value => @profile.last_name
#submit_block
= link_to t('.cancel'), root_path
or
= f.submit t('.update_profile')
#content_bottom
.back
= link_to "⇧ #{t('.home')}", root_path

View File

@@ -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.
%h2 Services
%h3 Facebook
%p
- if @logged_in
= connected_fb_as(@access_token)
%p
- @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
- @fb_friends[:data].each do |friend|
= image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
= link_to "Disconnect from Facebook", services_destroy_path
- else
= link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url
#content_bottom
.back
= link_to "⇧ home", root_path

View File

@@ -2,61 +2,29 @@
-# licensed under the Affero General Public License version 3. See
-# the COPYRIGHT file.
:javascript
$("#settings_nav li > a").click( function() {
var target = "#"+$(this).attr('class');
if( !$(target).is(":visible") ) {
$(".settings_pane").fadeOut(200, function() {
$(target).delay(200).fadeIn(200);
});
}
});
- content_for :publish do
%h1="#{t('.editing_profile')}"
- content_for :left_pane do
\.
%ul#settings_nav
%li=link_to 'Profile', '#', :class => 'profile'
%li=link_to 'Services', '#', :class => 'services'
= form_for @user do |f|
= f.error_messages
#profile.settings_pane{:style=>"display:block;"}
= render 'users/profile'
= f.fields_for :profile do |p|
#services.settings_pane
= render 'users/services'
%h3="#{t('.picture')}"
%div#image_picker
= p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
- unless @photos.nil? || @photos.empty?
- for photo in @photos
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
= check_box_tag 'checked_photo', true, true
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
%div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
=t('.you_dont_have_any_photos')
= link_to t('.albums'), albums_path(:aspect => 'all')
=t('.page_to_upload_some')
=will_paginate @photos
%br
%h3="#{t('.info')}"
%p
%b
="#{t('.diaspora_username')}:"
= @user.diaspora_handle
%p
= p.label :first_name
= p.text_field :first_name, :value => @profile.first_name
%p
= p.label :last_name
= p.text_field :last_name, :value => @profile.last_name
#submit_block
= link_to t('.cancel'), root_path
or
= f.submit t('.update_profile')
#content_bottom
.back
= link_to "⇧ #{t('.home')}", root_path

View File

@@ -2,6 +2,5 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
default:
pod_url: "http://example.org/"
debug: false
@@ -13,7 +12,7 @@ default:
pubsub_server: 'https://pubsubhubbub.appspot.com/'
mongo_host: 'localhost'
mongo_port: 27017
development:
test:

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
require File.expand_path('../boot', __FILE__)
require 'action_controller/railtie'
@@ -13,7 +11,7 @@ require 'active_resource/railtie'
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
require 'lib/mongo_mapper/bson_id'
require File.expand_path('../../lib/mongo_mapper/bson_id', __FILE__)
module Diaspora
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
require 'rubygems'
# Set up gems listed in the Gemfile.

8
config/cucumber.yml Normal file
View File

@@ -0,0 +1,8 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
config = YAML.load_file(File.dirname(__FILE__) + '/deploy_config.yml')
all = config['cross_server']
@@ -108,7 +106,6 @@ namespace :deploy do
run 'gem install bundler'
end
task :migrate do
end
end
@@ -150,9 +147,9 @@ namespace :db do
purge
backer_seed
tom_seed
deploy::restart
end
end
after "deploy:symlink", "deploy:symlink_images", "deploy:symlink_bundle", 'deploy:symlink_config'

View File

@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
cross_server:
deploy_to: '/usr/local/app/diaspora'
user: 'root'

View File

@@ -2,13 +2,18 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# Load the rails application
require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true
# Load facebook connection application credentials
fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml")))
FB_API_KEY = fb_config['fb_api_key']
FB_SECRET = fb_config['fb_secret']
FB_APP_ID = fb_config['fb_app_id']
HOST = fb_config['host']
# Initialize the rails application
Diaspora::Application.initialize!

View File

@@ -2,8 +2,7 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
require 'lib/mongo_mapper/clear_dev_memory'
require File.expand_path('../../../lib/mongo_mapper/clear_dev_memory', __FILE__)
Diaspora::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb

View File

@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
Diaspora::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
@@ -16,7 +15,7 @@ Diaspora::Application.configure do
# Specifies the header that your server uses for sending files
#config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.active_support.deprecation = :notify
# For nginx:

Some files were not shown because too many files have changed in this diff Show More