Skip to content
Extraits de code Groupes Projets
Valider fd8028db rédigé par Raphael's avatar Raphael
Parcourir les fichiers

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

This reverts commit 1481056a.
parent 1481056a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 382 ajouts et 99 suppressions
...@@ -13,7 +13,7 @@ public/stylesheets/ui.css ...@@ -13,7 +13,7 @@ public/stylesheets/ui.css
# Uploded files and local files # Uploded files and local files
public/uploads/* public/uploads/*
public/source.tar public/source.tar*
tmp/**/* tmp/**/*
db/*.sqlite3 db/*.sqlite3
......
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails', '>= 3.0.0' gem 'rails', '>= 3.0.0'
gem 'bundler', '>= 1.0.0' gem 'bundler', '>= 1.0.0'
#Security #Security
...@@ -41,6 +42,7 @@ gem 'aws' ...@@ -41,6 +42,7 @@ gem 'aws'
group :test, :development do group :test, :development do
gem 'factory_girl_rails' gem 'factory_girl_rails'
gem 'ruby-debug19' if RUBY_VERSION.include? "1.9"
gem 'ruby-debug' if RUBY_VERSION.include? "1.8" gem 'ruby-debug' if RUBY_VERSION.include? "1.8"
end end
......
...@@ -15,9 +15,9 @@ GIT ...@@ -15,9 +15,9 @@ GIT
GIT GIT
remote: git://github.com/dcu/magent.git remote: git://github.com/dcu/magent.git
revision: 59b8563961b830f491cd6f6592cced67791ce0ef revision: 90ee5db241abd2e2b7d7de5c80f0d7c5b4b8db2d
specs: specs:
magent (0.5.0) magent (0.5.1)
em-websocket em-websocket
mongo mongo
uuidtools uuidtools
...@@ -99,7 +99,7 @@ GEM ...@@ -99,7 +99,7 @@ GEM
addressable (2.2.2) addressable (2.2.2)
arel (1.0.1) arel (1.0.1)
activesupport (~> 3.0.0) activesupport (~> 3.0.0)
aws (2.3.21) aws (2.3.22)
http_connection http_connection
uuidtools uuidtools
xml-simple xml-simple
...@@ -120,7 +120,7 @@ GEM ...@@ -120,7 +120,7 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3) selenium-webdriver (>= 0.0.3)
childprocess (0.0.7) childprocess (0.1.3)
ffi (~> 0.6.3) ffi (~> 0.6.3)
columnize (0.3.1) columnize (0.3.1)
crack (0.1.8) crack (0.1.8)
...@@ -153,13 +153,13 @@ GEM ...@@ -153,13 +153,13 @@ GEM
rails (>= 3.0.0.beta4) rails (>= 3.0.0.beta4)
ffi (0.6.3) ffi (0.6.3)
rake (>= 0.8.7) rake (>= 0.8.7)
gherkin (2.2.8) gherkin (2.2.9)
json (~> 1.4.6) json (~> 1.4.6)
term-ansicolor (~> 1.0.5) term-ansicolor (~> 1.0.5)
haml (3.0.21) haml (3.0.22)
hashie (0.4.0) hashie (0.4.0)
highline (1.6.1) highline (1.6.1)
http_connection (1.3.1) http_connection (1.4.0)
i18n (0.4.1) i18n (0.4.1)
json (1.4.6) json (1.4.6)
json_pure (1.4.6) json_pure (1.4.6)
...@@ -213,18 +213,18 @@ GEM ...@@ -213,18 +213,18 @@ GEM
rake (0.8.7) rake (0.8.7)
rest-client (1.6.1) rest-client (1.6.1)
mime-types (>= 1.16) mime-types (>= 1.16)
rspec (2.0.0) rspec (2.0.1)
rspec-core (= 2.0.0) rspec-core (~> 2.0.1)
rspec-expectations (= 2.0.0) rspec-expectations (~> 2.0.1)
rspec-mocks (= 2.0.0) rspec-mocks (~> 2.0.1)
rspec-core (2.0.0) rspec-core (2.0.1)
rspec-expectations (2.0.0) rspec-expectations (2.0.1)
diff-lcs (>= 1.1.2) diff-lcs (>= 1.1.2)
rspec-mocks (2.0.0) rspec-mocks (2.0.1)
rspec-core (= 2.0.0) rspec-core (~> 2.0.1)
rspec-expectations (= 2.0.0) rspec-expectations (~> 2.0.1)
rspec-rails (2.0.0) rspec-rails (2.0.1)
rspec (= 2.0.0) rspec (~> 2.0.0)
ruby-debug (0.10.3) ruby-debug (0.10.3)
columnize (>= 0.1) columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0) ruby-debug-base (~> 0.10.3.0)
......
...@@ -20,10 +20,11 @@ class AspectsController < ApplicationController ...@@ -20,10 +20,11 @@ class AspectsController < ApplicationController
@aspect = current_user.aspect(params[:aspect]) @aspect = current_user.aspect(params[:aspect])
if @aspect.valid? if @aspect.valid?
flash[:notice] = I18n.t('aspects.create.success') flash[:notice] = I18n.t('aspects.create.success')
respond_with @aspect
else else
flash[:error] = I18n.t('aspects.create.failure') flash[:error] = I18n.t('aspects.create.failure')
redirect_to aspects_manage_path
end end
respond_with @aspect
end end
def new def new
......
...@@ -5,16 +5,17 @@ ...@@ -5,16 +5,17 @@
class RegistrationsController < Devise::RegistrationsController class RegistrationsController < Devise::RegistrationsController
def create def create
begin begin
user = User.instantiate!(params[:user]) @user = User.instantiate!(params[:user])
rescue MongoMapper::DocumentNotValid => e rescue MongoMapper::DocumentNotValid => e
flash[:error] = e.message flash[:error] = e.message
redirect_to new_user_registration_path redirect_to new_user_registration_path
return
end end
if user.save if @user.save
flash[:notice] = I18n.t 'registrations.create.success' flash[:notice] = I18n.t 'registrations.create.success'
sign_in_and_redirect(:user, user) sign_in_and_redirect(:user, @user)
else else
flash[:error] = user.errors.full_messages.join(', ') flash[:error] = @user.errors.full_messages.join(', ')
redirect_to new_user_registration_path redirect_to new_user_registration_path
end end
end end
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
class UsersController < ApplicationController class UsersController < ApplicationController
require File.join(Rails.root, 'lib/diaspora/ostatus_builder') require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
require File.join(Rails.root, 'lib/diaspora/exporter') 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') 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 respond_to :html
...@@ -78,6 +79,31 @@ class UsersController < ApplicationController ...@@ -78,6 +79,31 @@ class UsersController < ApplicationController
send_data( File.open(tar_path).read, :filename => "#{current_user.id}.tar" ) send_data( File.open(tar_path).read, :filename => "#{current_user.id}.tar" )
end 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 private
def prep_image_url(params) def prep_image_url(params)
url = APP_CONFIG[:pod_url].dup url = APP_CONFIG[:pod_url].dup
......
...@@ -22,6 +22,13 @@ class Person ...@@ -22,6 +22,13 @@ class Person
key :owner_id, ObjectId key :owner_id, ObjectId
one :profile, :class_name => 'Profile' 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 many :albums, :class_name => 'Album', :foreign_key => :person_id
belongs_to :owner, :class_name => 'User' belongs_to :owner, :class_name => 'User'
...@@ -162,4 +169,5 @@ class Person ...@@ -162,4 +169,5 @@ class Person
def remove_all_traces def remove_all_traces
Post.all(:person_id => id).each { |p| p.delete } Post.all(:person_id => id).each { |p| p.delete }
end end
end end
...@@ -14,6 +14,7 @@ class Post ...@@ -14,6 +14,7 @@ class Post
xml_accessor :_id xml_accessor :_id
xml_accessor :person, :as => Person xml_accessor :person, :as => Person
xml_reader :public xml_reader :public
xml_reader :created_at
key :public , Boolean, :default => false key :public , Boolean, :default => false
......
...@@ -18,6 +18,9 @@ class Profile ...@@ -18,6 +18,9 @@ class Profile
key :image_url, String key :image_url, String
validates_presence_of :first_name, :last_name validates_presence_of :first_name, :last_name
after_validation :strip_names
before_save :strip_names
def person_id def person_id
self._parent_document.id self._parent_document.id
...@@ -27,4 +30,10 @@ class Profile ...@@ -27,4 +30,10 @@ class Profile
self._parent_document self._parent_document
end end
protected
def strip_names
self.first_name.strip! if self.first_name
self.last_name.strip! if self.last_name
end
end end
...@@ -48,6 +48,12 @@ class User ...@@ -48,6 +48,12 @@ class User
validates_with InvitedUserValidator validates_with InvitedUserValidator
one :person, :class_name => 'Person', :foreign_key => :owner_id 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 :inviters, :in => :inviter_ids, :class_name => 'User'
many :friends, :in => :friend_ids, :class_name => 'Person' many :friends, :in => :friend_ids, :class_name => 'Person'
...@@ -56,7 +62,7 @@ class User ...@@ -56,7 +62,7 @@ class User
many :raw_visible_posts, :in => :visible_post_ids, :class_name => 'Post' many :raw_visible_posts, :in => :visible_post_ids, :class_name => 'Post'
many :aspects, :class_name => 'Aspect', :dependent => :destroy many :aspects, :class_name => 'Aspect', :dependent => :destroy
after_create :seed_aspects #after_create :seed_aspects
before_destroy :unfriend_everyone, :remove_person, :remove_all_aspects before_destroy :unfriend_everyone, :remove_person, :remove_all_aspects
...@@ -379,7 +385,11 @@ class User ...@@ -379,7 +385,11 @@ class User
opts[:serialized_private_key] = generate_key opts[:serialized_private_key] = generate_key
opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_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 end
def seed_aspects def seed_aspects
......
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# 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| = form_for Album.new do |f|
= f.error_messages = f.error_messages
%p %p
= f.label :name = f.label :name
= f.text_field :name = f.text_field :name
= f.hidden_field :to, :value => aspect = f.hidden_field :to, :value => aspect
= f.submit t('.create'), :class => 'button' = f.submit t('.create'), :class => 'button'
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
%h1=t('.add_a_new_aspect') .span-12.last
= form_for Aspect.new do |aspect| .modal_title_bar
= aspect.error_messages %h4= t('.add_a_new_aspect')
%p
= aspect.label :name = form_for Aspect.new do |aspect|
= aspect.text_field :name = aspect.error_messages
= aspect.submit t('.create'), :class => 'button' %p
= aspect.label :name
= aspect.text_field :name
= aspect.submit t('.create'), :class => 'button'
%p !!!
Welcome #{@resource.email}! %html
%p You can confirm your account through the link below: %head
%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %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}! %html
%p %head
#{(@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. %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
- @resource.inviters.each do |inv| :css
- if @resource.invite_messages[inv.id.to_s] body{
= "#{inv.real_name}:" width:600px;
= @resource.invite_messages[inv.id.to_s] font-family:'Arial','Helvetica',sans-serif;
%p font-size:14px;
color:#333;
}
%p= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token) #container{
%p margin-bottom:25px
If you don't want to accept the invitation, please ignore this email. min-height:400px;
%br/ padding-left:15px;
Your account won't be created until you access the link above and sign up. }
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}! %html
%p Someone has requested a link to change your password, and you can do this through the link below. %head
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%p If you didn't request this, please ignore this email. :css
%p Your password won't change until you access the link above and create a new one. 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}! %html
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts. %head
%p Click the link below to unlock your account: %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) :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 .span-12.last
= form_for User.new, :url => invitation_path(User) do |invite| .modal_title_bar
%p %h4 Invite someone to join Diaspora!
= 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
%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 @@ ...@@ -12,6 +12,8 @@
= person_image_link(@person) = person_image_link(@person)
%ul %ul
-unless @posts.first.nil? -unless @posts.first.nil?
%li
%b.small= @person.diaspora_handle
%li %li
%i= t(".last_seen",:how_long_ago => how_long_ago(@posts.first)) %i= t(".last_seen",:how_long_ago => how_long_ago(@posts.first))
- if @person != current_user.person && current_user.friends.include?(@person) - if @person != current_user.person && current_user.friends.include?(@person)
......
...@@ -24,3 +24,27 @@ ...@@ -24,3 +24,27 @@
= pr.text_field :last_name = pr.text_field :last_name
= f.submit t('.sign_up') = f.submit t('.sign_up')
= render :partial => "devise/shared/links" = 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 @@ ...@@ -2,20 +2,22 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
%h1 .span-12.last
=t('.add_a_new_friend_to') .modal_title_bar
%i= aspect.name %h4
=t('.add_a_new_friend_to')
%i= aspect.name
= form_for Request.new do |fr_request| = form_for Request.new do |fr_request|
= fr_request.error_messages = fr_request.error_messages
=t('.enter_a_diaspora_username') =t('.enter_a_diaspora_username')
%br %br
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle %i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
%p %p
= fr_request.label :destination_url, t(".friends_username") = fr_request.label :destination_url, t(".friends_username")
= fr_request.text_field :destination_url = fr_request.text_field :destination_url
= fr_request.hidden_field :aspect_id, :value => aspect.id = fr_request.hidden_field :aspect_id, :value => aspect.id
= fr_request.submit = fr_request.submit
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter