Commit fd8028db authored by Raphael's avatar Raphael

Revert "Revert "Merge remote branch 'upstream/master'""

This reverts commit 1481056a.
parent 1481056a
......@@ -13,7 +13,7 @@ public/stylesheets/ui.css
# Uploded files and local files
public/uploads/*
public/source.tar
public/source.tar*
tmp/**/*
db/*.sqlite3
......
source 'http://rubygems.org'
gem 'rails', '>= 3.0.0'
gem 'bundler', '>= 1.0.0'
#Security
......@@ -41,6 +42,7 @@ gem 'aws'
group :test, :development do
gem 'factory_girl_rails'
gem 'ruby-debug19' if RUBY_VERSION.include? "1.9"
gem 'ruby-debug' if RUBY_VERSION.include? "1.8"
end
......
......@@ -15,9 +15,9 @@ GIT
GIT
remote: git://github.com/dcu/magent.git
revision: 59b8563961b830f491cd6f6592cced67791ce0ef
revision: 90ee5db241abd2e2b7d7de5c80f0d7c5b4b8db2d
specs:
magent (0.5.0)
magent (0.5.1)
em-websocket
mongo
uuidtools
......@@ -99,7 +99,7 @@ GEM
addressable (2.2.2)
arel (1.0.1)
activesupport (~> 3.0.0)
aws (2.3.21)
aws (2.3.22)
http_connection
uuidtools
xml-simple
......@@ -120,7 +120,7 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3)
childprocess (0.0.7)
childprocess (0.1.3)
ffi (~> 0.6.3)
columnize (0.3.1)
crack (0.1.8)
......@@ -153,13 +153,13 @@ GEM
rails (>= 3.0.0.beta4)
ffi (0.6.3)
rake (>= 0.8.7)
gherkin (2.2.8)
gherkin (2.2.9)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
haml (3.0.21)
haml (3.0.22)
hashie (0.4.0)
highline (1.6.1)
http_connection (1.3.1)
http_connection (1.4.0)
i18n (0.4.1)
json (1.4.6)
json_pure (1.4.6)
......@@ -213,18 +213,18 @@ GEM
rake (0.8.7)
rest-client (1.6.1)
mime-types (>= 1.16)
rspec (2.0.0)
rspec-core (= 2.0.0)
rspec-expectations (= 2.0.0)
rspec-mocks (= 2.0.0)
rspec-core (2.0.0)
rspec-expectations (2.0.0)
rspec (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rspec-mocks (~> 2.0.1)
rspec-core (2.0.1)
rspec-expectations (2.0.1)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.0)
rspec-core (= 2.0.0)
rspec-expectations (= 2.0.0)
rspec-rails (2.0.0)
rspec (= 2.0.0)
rspec-mocks (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rspec-rails (2.0.1)
rspec (~> 2.0.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
......
......@@ -20,10 +20,11 @@ class AspectsController < ApplicationController
@aspect = current_user.aspect(params[:aspect])
if @aspect.valid?
flash[:notice] = I18n.t('aspects.create.success')
respond_with @aspect
else
flash[:error] = I18n.t('aspects.create.failure')
redirect_to aspects_manage_path
end
respond_with @aspect
end
def new
......
......@@ -5,16 +5,17 @@
class RegistrationsController < Devise::RegistrationsController
def create
begin
user = User.instantiate!(params[:user])
@user = User.instantiate!(params[:user])
rescue MongoMapper::DocumentNotValid => e
flash[:error] = e.message
redirect_to new_user_registration_path
return
end
if user.save
if @user.save
flash[:notice] = I18n.t 'registrations.create.success'
sign_in_and_redirect(:user, user)
sign_in_and_redirect(:user, @user)
else
flash[:error] = user.errors.full_messages.join(', ')
flash[:error] = @user.errors.full_messages.join(', ')
redirect_to new_user_registration_path
end
end
......
......@@ -5,10 +5,11 @@
class UsersController < ApplicationController
require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
require File.join(Rails.root, 'lib/diaspora/exporter')
require File.join(Rails.root, 'lib/diaspora/importer')
require File.join(Rails.root, 'lib/collect_user_photos')
before_filter :authenticate_user!, :except => [:new, :create, :public]
before_filter :authenticate_user!, :except => [:new, :create, :public, :import]
respond_to :html
......@@ -78,6 +79,31 @@ class UsersController < ApplicationController
send_data( File.open(tar_path).read, :filename => "#{current_user.id}.tar" )
end
def invite
User.invite!(:email => params[:email])
end
def import
xml = params[:upload][:file].read
params[:user][:diaspora_handle] = 'asodij@asodij.asd'
begin
importer = Diaspora::Importer.new(Diaspora::Parsers::XML)
importer.execute(xml, params[:user])
flash[:notice] = "hang on a sec, try logging in!"
rescue Exception => e
flash[:error] = "Derp, something went wrong: #{e.message}"
end
redirect_to new_user_registration_path
#redirect_to user_session_path
end
private
def prep_image_url(params)
url = APP_CONFIG[:pod_url].dup
......
......@@ -22,6 +22,13 @@ class Person
key :owner_id, ObjectId
one :profile, :class_name => 'Profile'
validate :profile_is_valid
def profile_is_valid
if profile.present? && !profile.valid?
profile.errors.full_messages.each { |m| errors.add(:base, m) }
end
end
many :albums, :class_name => 'Album', :foreign_key => :person_id
belongs_to :owner, :class_name => 'User'
......@@ -162,4 +169,5 @@ class Person
def remove_all_traces
Post.all(:person_id => id).each { |p| p.delete }
end
end
......@@ -14,6 +14,7 @@ class Post
xml_accessor :_id
xml_accessor :person, :as => Person
xml_reader :public
xml_reader :created_at
key :public , Boolean, :default => false
......
......@@ -18,6 +18,9 @@ class Profile
key :image_url, String
validates_presence_of :first_name, :last_name
after_validation :strip_names
before_save :strip_names
def person_id
self._parent_document.id
......@@ -27,4 +30,10 @@ class Profile
self._parent_document
end
protected
def strip_names
self.first_name.strip! if self.first_name
self.last_name.strip! if self.last_name
end
end
......@@ -48,6 +48,12 @@ class User
validates_with InvitedUserValidator
one :person, :class_name => 'Person', :foreign_key => :owner_id
validate :person_is_valid
def person_is_valid
if person.present? && !person.valid?
person.errors.full_messages.each {|m| errors.add(:base, m)}
end
end
many :inviters, :in => :inviter_ids, :class_name => 'User'
many :friends, :in => :friend_ids, :class_name => 'Person'
......@@ -56,7 +62,7 @@ class User
many :raw_visible_posts, :in => :visible_post_ids, :class_name => 'Post'
many :aspects, :class_name => 'Aspect', :dependent => :destroy
after_create :seed_aspects
#after_create :seed_aspects
before_destroy :unfriend_everyone, :remove_person, :remove_all_aspects
......@@ -379,7 +385,11 @@ class User
opts[:serialized_private_key] = generate_key
opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key
User.create(opts)
u = User.new(opts)
u.seed_aspects
u.save!
u
end
def seed_aspects
......
......@@ -2,12 +2,14 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h1=t('.add_a_new_album')
.span-12.last
.modal_title_bar
%h4= t('.add_a_new_album')
= form_for Album.new do |f|
= f.error_messages
%p
= f.label :name
= f.text_field :name
= f.hidden_field :to, :value => aspect
= f.submit t('.create'), :class => 'button'
= form_for Album.new do |f|
= f.error_messages
%p
= f.label :name
= f.text_field :name
= f.hidden_field :to, :value => aspect
= f.submit t('.create'), :class => 'button'
......@@ -2,10 +2,14 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h1=t('.add_a_new_aspect')
= form_for Aspect.new do |aspect|
= aspect.error_messages
%p
= aspect.label :name
= aspect.text_field :name
= aspect.submit t('.create'), :class => 'button'
.span-12.last
.modal_title_bar
%h4= t('.add_a_new_aspect')
= form_for Aspect.new do |aspect|
= aspect.error_messages
%p
= aspect.label :name
= aspect.text_field :name
= aspect.submit t('.create'), :class => 'button'
%p
Welcome #{@resource.email}!
%p You can confirm your account through the link below:
%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
:css
body{
width:600px;
font-family:'Arial','Helvetica',sans-serif;
font-size:14px;
color:#333;
}
#container{
margin-bottom:25px
min-height:400px;
padding-left:15px;
}
header{
background-color:#333;
padding: 15px;
margin-bottom: 25px;
}
p{
padding:5px;
}
p.small{
font-size:smaller;
color:#999;
font-style:italic;
}
a{
color:#107FC9;
font-weight:bold;
}
a:hover{
color: #22AAE0;
}
a:active{
color: #005D9C;
}
.large_text{
font-size:21px;
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
}
%body
%header
= image_tag '/images/diaspora_white.png'
#container
%p
Welcome #{@resource.email}!
%p You can confirm your account through the link below:
%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token), :class => "large_text"
%p
Hello #{@resource.email}!
%p
#{(@resource.inviters.count == 1)? ( @resource.inviters.first.real_name + " has") : (@resource.inviters.map{|inv| inv.real_name}.join(",") + " have")} invited you to #{root_url}, you can accept it through the link below.
- @resource.inviters.each do |inv|
- if @resource.invite_messages[inv.id.to_s]
= "#{inv.real_name}:"
= @resource.invite_messages[inv.id.to_s]
%p
%p= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token)
%p
If you don't want to accept the invitation, please ignore this email.
%br/
Your account won't be created until you access the link above and sign up.
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
:css
body{
width:600px;
font-family:'Arial','Helvetica',sans-serif;
font-size:14px;
color:#333;
}
#container{
margin-bottom:25px
min-height:400px;
padding-left:15px;
}
header{
background-color:#333;
padding: 15px;
margin-bottom: 25px;
}
p{
padding:5px;
}
p.small{
font-size:smaller;
color:#999;
font-style:italic;
}
a{
color:#107FC9;
font-weight:bold;
}
a:hover{
color: #22AAE0;
}
a:active{
color: #005D9C;
}
.large_text{
font-size:21px;
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
}
%body
%header
= image_tag '/images/diaspora_white.png'
#container
%p
Hello #{@resource.email}!
%p
#{(@resource.inviters.count == 1)? ( @resource.inviters.first.real_name + " has") : (@resource.inviters.map{|inv| inv.real_name + " (#{inv.diaspora_handle})"}.join(",") + " have")} invited you to join Diaspora at #{root_url}, you can accept it through the link below.
- @resource.inviters.each do |inv|
- if @resource.invite_messages[inv.id.to_s]
= "#{inv.real_name}:"
= @resource.invite_messages[inv.id.to_s]
%p
%p= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token), :class => "large_text"
%p.small
If you don't want to accept the invitation, please ignore this email.
%br/
Your account won't be created until you access the link above and sign up.
%p
Hello #{@resource.email}!
%p Someone has requested a link to change your password, and you can do this through the link below.
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
%p If you didn't request this, please ignore this email.
%p Your password won't change until you access the link above and create a new one.
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
:css
body{
width:600px;
font-family:'Arial','Helvetica',sans-serif;
font-size:14px;
color:#333;
}
#container{
margin-bottom:25px
min-height:400px;
padding-left:15px;
}
header{
background-color:#333;
padding: 15px;
margin-bottom: 25px;
}
p{
padding:5px;
}
p.small{
font-size:smaller;
color:#999;
font-style:italic;
}
a{
color:#107FC9;
font-weight:bold;
}
a:hover{
color: #22AAE0;
}
a:active{
color: #005D9C;
}
.large_text{
font-size:21px;
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
}
%body
%header
= image_tag '/images/diaspora_white.png'
#container
%p
Hello #{@resource.email}!
%p Someone has requested a link to change your password, and you can do this through the link below.
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token), :class => "large_text"
%p Your password won't change until you access the link above and create a new one.
%p.small If you didn't request this, please ignore this email.
%p
Hello #{@resource.email}!
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
%p Click the link below to unlock your account:
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
:css
body{
width:600px;
font-family:'Arial','Helvetica',sans-serif;
font-size:14px;
color:#333;
}
#container{
margin-bottom:25px
min-height:400px;
padding-left:15px;
}
header{
background-color:#333;
padding: 15px;
margin-bottom: 25px;
}
p{
padding:5px;
}
p.small{
font-size:smaller;
color:#999;
font-style:italic;
}
a{
color:#107FC9;
font-weight:bold;
}
a:hover{
color: #22AAE0;
}
a:active{
color: #005D9C;
}
.large_text{
font-size:21px;
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
}
%body
%header
= image_tag '/images/diaspora_white.png'
#container
%p
Hello #{@resource.email}!
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
%p Click the link below to unlock your account:
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token), :class => "large_text"
%h2 Send invitation
= form_for User.new, :url => invitation_path(User) do |invite|
%p
= invite.label :email
= invite.text_field :email
To
- unless @aspect.is_a? Aspect
= invite.select(:aspects, @aspects_dropdown_array)
- else
= invite.select(:aspects, @aspects_dropdown_array, :selected => @aspect.id)
Message:
= invite.text_area :invite_messages
.span-12.last
.modal_title_bar
%h4 Invite someone to join Diaspora!
%p= invite.submit "Send an invitation"
%i if they accept, they will be added to the aspect you invited them
= form_for User.new, :url => invitation_path(User) do |invite|
%p
= invite.label :email
= invite.text_field :email
To
- unless @aspect.is_a? Aspect
= invite.select(:aspects, @aspects_dropdown_array)
- else
= invite.select(:aspects, @aspects_dropdown_array, :selected => @aspect.id)
Message:
= invite.text_area :invite_messages, :value => ""
%p= invite.submit "Send an invitation"
......@@ -12,6 +12,8 @@
= person_image_link(@person)
%ul
-unless @posts.first.nil?
%li
%b.small= @person.diaspora_handle
%li
%i= t(".last_seen",:how_long_ago => how_long_ago(@posts.first))
- if @person != current_user.person && current_user.friends.include?(@person)
......
......@@ -24,3 +24,27 @@
= pr.text_field :last_name
= f.submit t('.sign_up')
= render :partial => "devise/shared/links"
%br
%br
%h2 or, upload yourself
= form_tag '/users/import', :multipart => true do
%p
= label_tag 'user[email]'
= text_field_tag 'user[email]'
%p
= label_tag 'user[password]'
= password_field_tag 'user[password]'
%p
= label_tag 'user[password_confirmation]'
= password_field_tag 'user[password_confirmation]'
%label Select File
= file_field 'upload', 'file'
= submit_tag "Upload"
......@@ -2,20 +2,22 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h1
=t('.add_a_new_friend_to')
%i= aspect.name
.span-12.last
.modal_title_bar
%h4
=t('.add_a_new_friend_to')
%i= aspect.name
= form_for Request.new do |fr_request|
= fr_request.error_messages
= form_for Request.new do |fr_request|
= fr_request.error_messages
=t('.enter_a_diaspora_username')
%br
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
=t('.enter_a_diaspora_username')
%br
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
%p
= fr_request.label :destination_url, t(".friends_username")
= fr_request.text_field :destination_url
= fr_request.hidden_field :aspect_id, :value => aspect.id
= fr_request.submit
%p
= fr_request.label :destination_url, t(".friends_username")
= fr_request.text_field :destination_url
= fr_request.hidden_field :aspect_id, :value => aspect.id
= fr_request.submit
- unless @aspect == :all
%h4 Invites
= link_to "Invite a friend", "#invite_user_pane", :class => "invite_user_button", :title => "Invite a friend"
= "(#{invites} left)"
%br
.yo{ :style => "display:none;"}
#invite_user_pane
= render "invitations/new"
%h4 Invites
= link_to "Invite a friend", "#invite_user_pane", :class => "invite_user_button", :title => "Invite a friend"
= "(#{invites} left)"
%br
.yo{ :style => "display:none;"}
#invite_user_pane
= render "invitations/new"
%h3 You are about to post a public message!
%p
Public messages will be available for others outside of Diaspora to see.
%br
%br
- if @logged_in
= connected_fb_as(@access_token)
- else
= link_to "Connect to Facebook", @fb_access_url
%br
%br
= link_to "OK", '#', :class => "button", :onClick => '$.fancybox.close();'
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.span-12.last
.modal_title_bar
%h4 You are about to post a public message!
%p
Public messages will be available for others outside of Diaspora to see.
%br
%br