Skip to content
Extraits de code Groupes Projets
Valider 08b9aa86 rédigé par ilya's avatar ilya
Parcourir les fichiers

Merge branch 'master' of github.com:diaspora/diaspora into fb

Conflicts:
	app/views/layouts/application.html.haml
	app/views/shared/_publisher.haml
	app/views/shared/_sub_header.haml
	app/views/users/edit.html.haml
	config/deploy_config.yml
	config/routes.rb
parents f38bcc9e 8f55852e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 117 ajouts et 380 suppressions
...@@ -13,4 +13,8 @@ gpg/diaspora-production/*.gpg ...@@ -13,4 +13,8 @@ gpg/diaspora-production/*.gpg
gpg/*/random_seed gpg/*/random_seed
public/uploads/* public/uploads/*
.rvmrc .rvmrc
.DS_Store
config/app_config.yml config/app_config.yml
bin/*
nbproject
config/initializers/secret_token.rb
...@@ -16,8 +16,8 @@ including the two. ...@@ -16,8 +16,8 @@ including the two.
You must obey the GNU Affero General Public License V3 or later in all respects 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 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 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 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 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. program, then also delete it here.
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
......
...@@ -3,13 +3,11 @@ source 'http://rubygems.org' ...@@ -3,13 +3,11 @@ 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
gem 'devise', :git => 'http://github.com/BadMinus/devise.git' gem 'devise', :git => 'http://github.com/BadMinus/devise.git'
#Mongo #Mongo
gem 'mongo_mapper', '0.8.4', :git => 'http://github.com/jnunemaker/mongomapper.git' gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'jnunemaker-validatable', '1.8.4', :git => 'http://github.com/jnunemaker/validatable.git'
gem 'bson_ext', '1.0.7' gem 'bson_ext', '1.0.7'
gem 'bson', '1.0.7' gem 'bson', '1.0.7'
...@@ -41,24 +39,23 @@ gem 'mini_magick' ...@@ -41,24 +39,23 @@ gem 'mini_magick'
group :test, :development do group :test, :development do
gem 'factory_girl_rails' gem 'factory_girl_rails'
gem 'ruby-debug' if RUBY_VERSION.include? "1.8"
end end
group :test do group :test do
gem 'rspec', '>= 2.0.0.beta.17' gem 'capybara', '~> 0.3.9'
gem 'rspec-rails', '2.0.0.beta.17' gem 'cucumber-rails', '0.3.2'
gem 'rspec', '>= 2.0.0.beta.17'
gem 'rspec-rails', '2.0.0.beta.17'
gem 'mocha' gem 'mocha'
gem 'webrat', '0.7.2.beta.1' gem 'redgreen' if RUBY_VERSION.include? "1.8"
gem 'redgreen'
gem 'autotest' gem 'autotest'
gem 'database_cleaner' gem 'database_cleaner'
gem 'saucelabs-adapter', '= 0.8.12'
gem 'selenium-rc'
gem 'webmock' gem 'webmock'
end end
group :development do group :development do
gem 'nifty-generators' gem 'nifty-generators'
gem 'ruby-debug'
end end
group :deployment do group :deployment do
......
...@@ -57,20 +57,14 @@ GIT ...@@ -57,20 +57,14 @@ GIT
GIT GIT
remote: http://github.com/jnunemaker/mongomapper.git remote: http://github.com/jnunemaker/mongomapper.git
revision: 931dab779011aa7acf60c1a4c7ad19e1ba838345 revision: b0eac421ef5b3bee782e15d391eca372a189d414
branch: rails3
specs: specs:
mongo_mapper (0.8.4) mongo_mapper (0.8.4)
activesupport (>= 2.3.4) activemodel (~> 3.0.0)
jnunemaker-validatable (~> 1.8.4) activesupport (~> 3.0.0)
plucky (~> 0.3.5) 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 GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
...@@ -115,8 +109,24 @@ GEM ...@@ -115,8 +109,24 @@ GEM
net-sftp (>= 2.0.0) net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14) net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.0.0) 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) columnize (0.3.1)
crack (0.1.8) 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) daemons (1.1.0)
database_cleaner (0.5.2) database_cleaner (0.5.2)
diff-lcs (1.1.2) diff-lcs (1.1.2)
...@@ -130,13 +140,19 @@ GEM ...@@ -130,13 +140,19 @@ GEM
factory_girl_rails (1.0) factory_girl_rails (1.0)
factory_girl (~> 1.3) factory_girl (~> 1.3)
rails (>= 3.0.0.beta4) 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) haml (3.0.18)
hashie (0.4.0) hashie (0.4.0)
highline (1.6.1) highline (1.6.1)
i18n (0.4.1) i18n (0.4.1)
json (1.4.6) json (1.4.6)
json_pure (1.4.6)
linecache (0.43) linecache (0.43)
lsof (0.3.0)
mail (2.2.6.1) mail (2.2.6.1)
activesupport (>= 2.3.6) activesupport (>= 2.3.6)
mime-types mime-types
...@@ -206,16 +222,13 @@ GEM ...@@ -206,16 +222,13 @@ GEM
ruby-debug-base (~> 0.10.3.0) ruby-debug-base (~> 0.10.3.0)
ruby-debug-base (0.10.3) ruby-debug-base (0.10.3)
linecache (>= 0.3) linecache (>= 0.3)
saucelabs-adapter (0.8.12) rubyzip (0.9.4)
lsof (>= 0.3.0) selenium-webdriver (0.0.28)
net-ssh (>= 2.0.12) ffi (>= 0.6.1)
net-ssh-gateway (>= 1.0.1) json_pure
rest-client (>= 1.2.0) rubyzip
selenium-client (>= 1.2.17)
selenium-client (1.2.18)
selenium-rc (2.2.4)
selenium-client (>= 1.2.18)
subexec (0.0.4) subexec (0.0.4)
term-ansicolor (1.0.5)
thin (1.2.7) thin (1.2.7)
daemons (>= 1.0.9) daemons (>= 1.0.9)
eventmachine (>= 0.12.6) eventmachine (>= 0.12.6)
...@@ -223,6 +236,7 @@ GEM ...@@ -223,6 +236,7 @@ GEM
thor (0.14.0) thor (0.14.0)
treetop (1.4.8) treetop (1.4.8)
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.23) tzinfo (0.3.23)
uuidtools (2.1.1) uuidtools (2.1.1)
warden (0.10.7) warden (0.10.7)
...@@ -245,20 +259,21 @@ DEPENDENCIES ...@@ -245,20 +259,21 @@ DEPENDENCIES
bson (= 1.0.7) bson (= 1.0.7)
bson_ext (= 1.0.7) bson_ext (= 1.0.7)
bundler (= 1.0.0) bundler (= 1.0.0)
capybara (~> 0.3.9)
carrierwave! carrierwave!
cucumber-rails (= 0.3.2)
database_cleaner database_cleaner
devise! devise!
em-http-request! em-http-request!
em-websocket em-websocket
factory_girl_rails factory_girl_rails
haml haml
jnunemaker-validatable (= 1.8.4)!
json json
magent! magent!
mini_fb mini_fb
mini_magick mini_magick
mocha mocha
mongo_mapper (= 0.8.4)! mongo_mapper!
nifty-generators nifty-generators
pubsubhubbub pubsubhubbub
rails (= 3.0.0) rails (= 3.0.0)
...@@ -268,10 +283,7 @@ DEPENDENCIES ...@@ -268,10 +283,7 @@ DEPENDENCIES
rspec (>= 2.0.0.beta.17) rspec (>= 2.0.0.beta.17)
rspec-rails (= 2.0.0.beta.17) rspec-rails (= 2.0.0.beta.17)
ruby-debug ruby-debug
saucelabs-adapter (= 0.8.12)
selenium-rc
sprinkle! sprinkle!
thin thin
webmock webmock
webrat (= 0.7.2.beta.1)
will_paginate (= 3.0.pre2) will_paginate (= 3.0.pre2)
...@@ -26,288 +26,12 @@ network. ...@@ -26,288 +26,12 @@ network.
**PLEASE, DO NOT RUN IN PRODUCTION. IT IS FUN TO GET RUNNING, BUT EXPECT THINGS **PLEASE, DO NOT RUN IN PRODUCTION. IT IS FUN TO GET RUNNING, BUT EXPECT THINGS
TO BE BROKEN** 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. We are continuing to build features and improve the code base.
When we think it is ready for general use, we will post more detailed When we think it is ready for general use, we will post more final
instructions. instructions.
## Notice
We currently run Diaspora with the [thin](http://code.macournoyer.com/thin/) as
our webserver, behind [nginx](http://wiki.nginx.org/Main). Diaspora uses the
asynchronous feature of [EventMachine](http://rubyeventmachine.com/) to send
messages between seeds, using the power of the
[Reactor](http://en.wikipedia.org/wiki/Reactor_pattern) pattern. If you use
mod_rails, mongrel, or another non-eventmachine based application server,
federation and/or websockets may not work.
If you don't like thin, you can always try
[Rainbows!](http://rainbows.rubyforge.org/) We will try and fully support more
webservers later, but that is what works for now.
These instructions are for machines running [Ubuntu](http://www.ubuntu.com/),
[Fedora](http://www.fedoraproject.org) or Mac OS X. We are developing Diaspora
for the latest and greatest browsers, so please update your Firefox, Chrome or
Safari to the latest and greatest.
## Preparing your system
In order to run Diaspora, you will need to download the following dependencies
(specific instructions follow):
- Build Tools - Packages needed to compile the components that follow.
- [Ruby](http://www.ruby-lang.org) - The Ruby programming language.
(We're using **1.8.7**. It comes preinstalled on Mac OS X.)
- [MongoDB](http://www.mongodb.org) - A snappy noSQL database.
- [OpenSSL](http://www.openssl.org/) - An encryption library.
(It comes preinstalled on Mac OS X and Ubuntu.)
- [ImageMagick](http://www.imagemagick.org/) - An Image processing library used
to resize uploaded photos.
- [Git](http://git-scm.com/) - The fast version control system.
After you have Ruby installed on your system, you will need to get RubyGems,
then install Bundler:
- [RubyGems](http://rubygems.org/) - Source for Ruby gems.
- [Bundler](http://gembundler.com/) - Gem management tool for Ruby projects.
**We suggest using a package management system to download these dependencies.
Trust us, it's going to make your life a lot easier. If you're using Mac OS X,
you can use [homebrew](http://mxcl.github.com/homebrew/); if you're using
Ubuntu, just use [Synaptic](http://www.nongnu.org/synaptic/) (it comes
pre-installed); if you're using Fedora simply use
[yum](http://yum.baseurl.org/). The instructions below assume you have these
installed.**
### Build Tools
To install build tools on **Ubuntu**, run the following (includes the gcc and
xml parsing dependencies):
sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2
To install build tools on **Fedora**, run the following:
sudo yum install libxslt libxslt-devel libxml2 libxml2-devel
To install build tools on **Mac OS X**, you need to download and install
[Xcode](http://developer.apple.com/technologies/tools/xcode.html).
### Ruby
To install Ruby 1.8.7 on **Ubuntu**, run the following command:
sudo apt-get install ruby-full
Please note that you need to have Universe enabled in your
/etc/apt/sources.list file to install ruby using apt-get.
At this time Fedora does not have Ruby 1.8.7. As a workaround it is possible to
use [rvm](http://rvm.beginrescueend.com/) with a locally compiled Ruby
installation. A semi automated method for doing this is available. It is
highly recommended that you review the script before running it so you
understand what will occur. The script can be executed by running the
following command:
./script/bootstrap-fedora-diaspora.sh
After reviewing and executing the above script you will need to follow the
"MongoDB" section and then you should skip all the way down to "Start Mongo".
If you're on **Mac OS X**, you already have Ruby on your system. Yay!
### MongoDB
To install MongoDB on **Ubuntu**, add the official MongoDB repository
[here](http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages).
For Lucid, add the following line to your /etc/apt/sources.list (for other
distros, see http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages):
deb http://downloads.mongodb.org/distros/ubuntu 10.4 10gen
Then run:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo apt-get update
sudo apt-get install mongodb-stable
You can also run the binary directly by doing the following:
If you're running a 32-bit system, run:
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz
If you're running a 64-bit system, run:
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.6.2.tgz
Then run:
# extract
tar xzf mongodb-linux-i686-1.4.0.tgz
# create the required data directory
sudo mkdir -p /data/db
sudo chmod -Rv 777 /data/
To install MongoDB on a x86_64 **Fedora** system, add the official MongoDB
repository from MongoDB
(http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages) into
/etc/yum.repos.d/10gen.repo:
[10gen]
name=10gen Repository
baseurl=http://downloads.mongodb.org/distros/fedora/13/os/x86_64/
gpgcheck=0
enabled=1
Then use yum to install the packages:
sudo yum install mongo-stable mongo-stable-server
If you're running a 32-bit system, run `wget
http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz`. If you're
running a 64-bit system, run `wget
http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.6.2.tgz`.
# extract
tar xzf mongodb-linux-i686-1.4.0.tgz
# create the required data directory
sudo mkdir -p /data/db
sudo chmod -Rv 777 /data/
To install MongoDB on **Mac OS X**, run the following:
brew install mongo
sudo mkdir -p /data/db
sudo chmod -Rv 777 /data/
### OpenSSL
If you're running either **Ubuntu**, **Fedora** or **Mac OS X** you already
have OpenSSL installed!
### ImageMagick
To install ImageMagick on **Ubuntu**, run the following:
sudo apt-get install imagemagick libmagick9-dev
To install ImageMagick on **Fedora**, run the following:
sudo yum install ImageMagick
To install ImageMagick on **Mac OS X**, run the following:
brew install imagemagick
### Git
To install Git on **Ubuntu**, run the following:
sudo apt-get install git-core
To install Git on **Fedora**, run the following:
sudo yum install git
To install Git on **Mac OS X**, run the following:
brew install git
### Rubygems
On **Ubuntu** 10.04, run the following:
sudo add-apt-repository ppa:maco.m/ruby
sudo apt-get update
sudo apt-get install rubygems
This PPA is maintained by an Ubuntu Developer. For Ubuntu 10.10, this version
of rubygems is in the repositories.
On **Fedora**, run the following:
sudo yum install rubygems
On **Mac OS X**, RubyGems comes preinstalled; however, you might need to update
it for use with the latest Bundler. To update RubyGems, run `sudo gem update
--system`.
### Bundler
After RubyGems is updated, simply run `sudo gem install bundler` to get
Bundler. If you're using Ubuntu repository .debs, bundler is found at
/var/lib/gems/1.8/bin/bundle
## Getting Diaspora
git clone http://github.com/diaspora/diaspora.git
If you have never used github before, their
[help desk](http://help.github.com/) has a pretty awesome guide on getting
setup.
## Running Diaspora
### Install required gems
To start the app server for the first time, you need to use Bundler to install
Diaspora's gem depencencies. Run `bundle install` from Diaspora's root
directory. Bundler will also warn you if there is a new dependency and you
need to bundle install again.
### Start Mongo
If you installed the Ubuntu package, MongoDB should already be running (if not,
run `service mongodb start`). If you installed the binary manually, run `sudo
mongod` from where mongo is installed to start mongo.
If you installed the Fedora package, MongoDB will need to be started via
`service mongodb start`. If you installed the binary manually, run `sudo
mongod` from where Mongo is installed to start Mongo.
If you installed the OsX package through "brew", MongoDB will need to be
started via `sudo launchctl load
/Library/LaunchDaemons/org.mongodb.mongod.plist`. (before you have to go to
/Library/LaunchDaemons and add a symlink to
/usr/local/Cellar/mongodb/1.6.2-x86_64/org.mongodb.mongod.plist)
Diaspora will not run unless Mongo is running. Mongo will not run by default,
and will need to be started every time you wish to use or run the test suite
for Diaspora.
### Run the server
`./script/server` will start both thin and the websocket server. If you want
to run a different app server, you will have to run them separately. See below
for instructions.
### Run the app server
Once mongo is running and bundler has finished, run `bundle exec thin start`
from the root Diaspora directory. This will start the app server in
development mode[.](http://bit.ly/9mwtUw)
### Run the websocket server
run `bundle exec ruby ./script/websocket_server` to start the websocket server
on port 8080. Change the port in config/app_config.yml.
### Logging in with a sample user
Run `rake db:seed:tom`, then login with user `tom` and password `evankorth`.
More details in db/seeds/tom.rb.
### Testing
Diaspora's test suite uses [rspec](http://rspec.info/), a behavior driven
testing framework. In order to run the tests, run `bundle exec rspec spec`.
## Resources ## Resources
We are maintaining a We are maintaining a
...@@ -318,6 +42,7 @@ file [bug reports](https://github.com/diaspora/diaspora/issues) right here on ...@@ -318,6 +42,7 @@ file [bug reports](https://github.com/diaspora/diaspora/issues) right here on
github. github.
Ongoing discussion: Ongoing discussion:
- [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev) - [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev)
- [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss) - [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss)
- [Diaspora Q&A site](http://diaspora.shapado.com/) - [Diaspora Q&A site](http://diaspora.shapado.com/)
...@@ -326,7 +51,7 @@ Ongoing discussion: ...@@ -326,7 +51,7 @@ Ongoing discussion:
More general info and updates about the project can be found on: More general info and updates about the project can be found on:
[Our blog](http://joindiaspora.com), [Our blog](http://joindiaspora.com),
[and on Twitter](http://twitter.com/joindiaspora). [and on Twitter](http://twitter.com/joindiaspora).
Also, be sure to join the official [mailing list](http://http://eepurl.com/Vebk). Also, be sure to join the official [mailing list](http://http://eepurl.com/Vebk).
If you wish to contact us privately about any exploits in Diaspora you may If you wish to contact us privately about any exploits in Diaspora you may
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
# Add your own tasks in files placed in lib/tasks ending in .rake, # 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. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__) require File.expand_path('../config/application', __FILE__)
require 'rake' require 'rake'
ENV['GNUPGHOME'] = File.expand_path("../../gpg/diaspora-#{Rails.env}/", __FILE__) ENV['GNUPGHOME'] = File.expand_path("../../gpg/diaspora-#{Rails.env}/", __FILE__)
Diaspora::Application.load_tasks Diaspora::Application.load_tasks
...@@ -20,7 +20,7 @@ class AlbumsController < ApplicationController ...@@ -20,7 +20,7 @@ class AlbumsController < ApplicationController
data = clean_hash(params[:album]) data = clean_hash(params[:album])
@album = current_user.post(:album, data) @album = current_user.post(:album, data)
flash[:notice] = "You've created an album called #{@album.name}." flash[:notice] = I18n.t 'albums.create.success', :name => @album.name
redirect_to :action => :show, :id => @album.id, :aspect => aspect redirect_to :action => :show, :id => @album.id, :aspect => aspect
end end
...@@ -31,7 +31,7 @@ class AlbumsController < ApplicationController ...@@ -31,7 +31,7 @@ class AlbumsController < ApplicationController
def destroy def destroy
@album = current_user.find_visible_post_by_id params[:id] @album = current_user.find_visible_post_by_id params[:id]
@album.destroy @album.destroy
flash[:notice] = "Album #{@album.name} deleted." flash[:notice] = I18n.t 'albums.destroy.success', :name => @album.name
respond_with :location => albums_url respond_with :location => albums_url
end end
...@@ -53,10 +53,10 @@ class AlbumsController < ApplicationController ...@@ -53,10 +53,10 @@ class AlbumsController < ApplicationController
data = clean_hash(params[:album]) data = clean_hash(params[:album])
if current_user.update_post( @album, data ) if current_user.update_post( @album, data )
flash[:notice] = "Album #{@album.name} successfully edited." flash[:notice] = I18n.t 'albums.update.success', :name => @album.name
respond_with @album respond_with @album
else else
flash[:error] = "Failed to edit album #{@album.name}." flash[:error] = I18n.t 'albums.update.failure', :name => @album.name
render :action => :edit render :action => :edit
end end
end end
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery :except => :receive protect_from_forgery :except => :receive
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class AspectsController < ApplicationController class AspectsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
...@@ -15,8 +14,12 @@ class AspectsController < ApplicationController ...@@ -15,8 +14,12 @@ class AspectsController < ApplicationController
end end
def create def create
@aspect = current_user.aspect params[:aspect] @aspect = current_user.aspect(params[:aspect])
flash[:notice] = I18n.t('aspects.create.success') 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 respond_with :location => aspects_manage_path
end end
...@@ -29,8 +32,8 @@ class AspectsController < ApplicationController ...@@ -29,8 +32,8 @@ class AspectsController < ApplicationController
begin begin
current_user.drop_aspect @aspect current_user.drop_aspect @aspect
flash[:notice] = "#{@aspect.name} was successfully removed." flash[:notice] = i18n.t 'aspects.destroy.success',:name => @aspect.name
rescue RuntimeError => e rescue RuntimeError => e
flash[:error] = e.message flash[:error] = e.message
end end
...@@ -64,7 +67,7 @@ class AspectsController < ApplicationController ...@@ -64,7 +67,7 @@ class AspectsController < ApplicationController
data = clean_hash(params[:aspect]) data = clean_hash(params[:aspect])
@aspect.update_attributes( data ) @aspect.update_attributes( data )
flash[:notice] = "Your aspect, #{@aspect.name}, has been successfully edited." flash[:notice] = i18n.t 'aspects.update.success',:name => @aspect.name
respond_with @aspect respond_with @aspect
end end
...@@ -72,25 +75,25 @@ class AspectsController < ApplicationController ...@@ -72,25 +75,25 @@ class AspectsController < ApplicationController
params[:moves].each{ |move| params[:moves].each{ |move|
move = move[1] move = move[1]
unless current_user.move_friend(move) unless current_user.move_friend(move)
flash[:error] = "Aspect editing failed for friend #{current_user.visible_person_by_id( move[:friend_id] ).real_name}." flash[:error] = i18n.t 'aspects.move_friends.failure', :real_name => Person.find_by_id( move[:friend_id] ).real_name
redirect_to aspects_manage_path redirect_to aspects_manage_path
return return
end end
} }
flash[:notice] = "Aspects edited successfully." flash[:notice] = i18n.t 'aspects.move_friends.success'
redirect_to aspects_manage_path redirect_to aspects_manage_path
end end
def move_friend def move_friend
unless current_user.move_friend( :friend_id => params[:friend_id], :from => params[:from], :to => params[:to][:to]) unless current_user.move_friend( :friend_id => params[:friend_id], :from => params[:from], :to => params[:to][:to])
flash[:error] = "didn't work #{params.inspect}" flash[:error] = I18n.t 'aspects.move_friend.error',:inspect => params.inspect
end end
if aspect = current_user.aspect_by_id(params[:to][:to]) if aspect = current_user.aspect_by_id(params[:to][:to])
flash[:notice] = "You are now showing your friend a different aspect of yourself." flash[:notice] = I18n.t 'aspects.move_friend.success'
render :nothing => true render :nothing => true
else else
flash[:error] = "Invalid aspect id!" flash[:notice] = I18n.t 'aspects.move_friend.failure'
render aspects_manage_path render aspects_manage_path
end end
end end
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class CommentsController < ApplicationController class CommentsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
...@@ -10,7 +9,7 @@ class CommentsController < ApplicationController ...@@ -10,7 +9,7 @@ class CommentsController < ApplicationController
respond_to :json, :only => :show respond_to :json, :only => :show
def create def create
target = Post.find_by_id params[:comment][:post_id] target = current_user.find_visible_post_by_id params[:comment][:post_id]
text = params[:comment][:text] text = params[:comment][:text]
@comment = current_user.comment text, :on => target @comment = current_user.comment text, :on => target
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class DevUtilitiesController < ApplicationController class DevUtilitiesController < ApplicationController
before_filter :authenticate_user!, :except => [:set_backer_number] before_filter :authenticate_user!, :except => [:set_backer_number]
include ApplicationHelper include ApplicationHelper
...@@ -16,7 +15,7 @@ class DevUtilitiesController < ApplicationController ...@@ -16,7 +15,7 @@ class DevUtilitiesController < ApplicationController
bkr_info.each do |backer| bkr_info.each do |backer|
backer_email = "#{backer['username']}@#{backer['username']}.joindiaspora.com" backer_email = "#{backer['username']}@#{backer['username']}.joindiaspora.com"
rel_hash = relationship_flow(backer_email) 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}" 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) current_user.send_friend_request_to(rel_hash[:friend], current_user.aspects.first)
end end
...@@ -30,11 +29,6 @@ class DevUtilitiesController < ApplicationController ...@@ -30,11 +29,6 @@ class DevUtilitiesController < ApplicationController
} }
end end
def backer_info
config = YAML.load_file(File.dirname(__FILE__) + '/../../config/deploy_config.yml')
config['servers']['backer']
end
def set_backer_number def set_backer_number
render :nothing => true render :nothing => true
seed_num_hash = {:seed_number => params[:number]} seed_num_hash = {:seed_number => params[:number]}
...@@ -44,7 +38,6 @@ class DevUtilitiesController < ApplicationController ...@@ -44,7 +38,6 @@ class DevUtilitiesController < ApplicationController
end end
def set_profile_photo def set_profile_photo
render :nothing => true render :nothing => true
album = Album.create(:person => current_user.person, :name => "Profile Photos") album = Album.create(:person => current_user.person, :name => "Profile Photos")
current_user.raw_visible_posts << album current_user.raw_visible_posts << album
...@@ -53,7 +46,7 @@ class DevUtilitiesController < ApplicationController ...@@ -53,7 +46,7 @@ class DevUtilitiesController < ApplicationController
backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase 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 = Photo.new(:person => current_user.person, :album => album)
photo.image.store! File.open(@fixture_name) photo.image.store! File.open(@fixture_name)
...@@ -63,7 +56,6 @@ class DevUtilitiesController < ApplicationController ...@@ -63,7 +56,6 @@ class DevUtilitiesController < ApplicationController
current_user.raw_visible_posts << photo current_user.raw_visible_posts << photo
current_user.save current_user.save
current_user.update_profile(:image_url => photo.url(:thumb_medium)) current_user.update_profile(:image_url => photo.url(:thumb_medium))
current_user.save current_user.save
end end
...@@ -73,4 +65,11 @@ class DevUtilitiesController < ApplicationController ...@@ -73,4 +65,11 @@ class DevUtilitiesController < ApplicationController
render "shared/log" render "shared/log"
end end
protected
def backer_info
config = YAML.load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "deploy_config.yml"))
config['servers']['backer']
end
end end
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class PeopleController < ApplicationController class PeopleController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class PhotosController < ApplicationController class PhotosController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
...@@ -19,9 +18,15 @@ class PhotosController < ApplicationController ...@@ -19,9 +18,15 @@ class PhotosController < ApplicationController
# get file content type # get file content type
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
# create temporal file # 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 # put data into this file from raw post request
file.print request.raw_post
# create several required methods for this temporal file # create several required methods for this temporal file
Tempfile.send(:define_method, "content_type") {return att_content_type} Tempfile.send(:define_method, "content_type") {return att_content_type}
...@@ -29,12 +34,10 @@ class PhotosController < ApplicationController ...@@ -29,12 +34,10 @@ class PhotosController < ApplicationController
############## ##############
params[:user_file] = file params[:user_file] = file
data = clean_hash(params) data = clean_hash(params)
@photo = current_user.post(:photo, data) @photo = current_user.post(:photo, data)
respond_to do |format| respond_to do |format|
...@@ -42,15 +45,15 @@ class PhotosController < ApplicationController ...@@ -42,15 +45,15 @@ class PhotosController < ApplicationController
end end
rescue TypeError rescue TypeError
message = "Photo upload failed. Are you sure an image was added?" message = I18n.t 'photos.create.type_error'
respond_with :location => album, :error => message respond_with :location => album, :error => message
rescue CarrierWave::IntegrityError rescue CarrierWave::IntegrityError
message = "Photo upload failed. Are you sure that was an image?" message = I18n.t 'photos.create.integrity_error'
respond_with :location => album, :error => message respond_with :location => album, :error => message
rescue RuntimeError => e rescue RuntimeError => e
message = "Photo upload failed. Are you sure that your seatbelt is fastened?" message = I18n.t 'photos.create.runtime_error'
respond_with :location => album, :error => message respond_with :location => album, :error => message
raise e raise e
end end
...@@ -66,7 +69,7 @@ class PhotosController < ApplicationController ...@@ -66,7 +69,7 @@ class PhotosController < ApplicationController
@photo = current_user.find_visible_post_by_id params[:id] @photo = current_user.find_visible_post_by_id params[:id]
@photo.destroy @photo.destroy
flash[:notice] = "Photo deleted." flash[:notice] = I18n.t 'photos.destroy.notice'
respond_with :location => @photo.album respond_with :location => @photo.album
end end
...@@ -89,15 +92,14 @@ class PhotosController < ApplicationController ...@@ -89,15 +92,14 @@ class PhotosController < ApplicationController
data = clean_hash(params) data = clean_hash(params)
if current_user.update_post( @photo, data[:photo] ) if current_user.update_post( @photo, data[:photo] )
flash[:notice] = "Photo successfully updated." flash[:notice] = I18n.t 'photos.update.notice'
respond_with @photo respond_with @photo
else else
flash[:error] = "Failed to edit photo." flash[:error] = I18n.t 'photos.update.error'
render :action => :edit render :action => :edit
end end
end end
private private
def clean_hash(params) def clean_hash(params)
if params[:photo] if params[:photo]
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class PublicsController < ApplicationController class PublicsController < ApplicationController
require 'lib/diaspora/parser' require File.expand_path('../../../lib/diaspora/parser', __FILE__)
include Diaspora::Parser include Diaspora::Parser
layout false layout false
...@@ -20,7 +19,7 @@ class PublicsController < ApplicationController ...@@ -20,7 +19,7 @@ class PublicsController < ApplicationController
end end
def webfinger def webfinger
@person = Person.by_webfinger(params[:q], :local => true) @person = Person.by_webfinger(params[:q], :local => true) if params[:q]
unless @person.nil? || @person.owner.nil? unless @person.nil? || @person.owner.nil?
render 'webfinger', :content_type => 'application/xrd+xml' render 'webfinger', :content_type => 'application/xrd+xml'
else else
......
...@@ -15,7 +15,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -15,7 +15,7 @@ class RegistrationsController < Devise::RegistrationsController
flash[:error] = e.message flash[:error] = e.message
end end
if user if user
flash[:notice] = "You've joined Diaspora!" flash[:notice] = I18n.t 'registrations.create.success'
sign_in_and_redirect(:user, user) sign_in_and_redirect(:user, user)
else else
redirect_to new_user_registration_path redirect_to new_user_registration_path
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class RequestsController < ApplicationController class RequestsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
include RequestsHelper include RequestsHelper
...@@ -13,15 +12,15 @@ class RequestsController < ApplicationController ...@@ -13,15 +12,15 @@ class RequestsController < ApplicationController
if params[:accept] if params[:accept]
if params[:aspect_id] if params[:aspect_id]
@friend = current_user.accept_and_respond( params[:id], params[:aspect_id]) @friend = current_user.accept_and_respond( params[:id], params[:aspect_id])
flash[:notice] = "You are now friends." flash[:notice] = I18n.t 'requests.destroy.success'
respond_with :location => current_user.aspect_by_id(params[:aspect_id]) respond_with :location => current_user.aspect_by_id(params[:aspect_id])
else else
flash[:error] = "Please select an aspect!" flash[:error] = I18n.t 'requests.destroy.error'
respond_with :location => requests_url respond_with :location => requests_url
end end
else else
current_user.ignore_friend_request params[:id] current_user.ignore_friend_request params[:id]
flash[:notice] = "Ignored friend request." flash[:notice] = I18n.t 'requests.destroy.ignore'
respond_with :location => requests_url respond_with :location => requests_url
end end
end end
...@@ -37,27 +36,28 @@ class RequestsController < ApplicationController ...@@ -37,27 +36,28 @@ class RequestsController < ApplicationController
rel_hash = relationship_flow(params[:request][:destination_url]) rel_hash = relationship_flow(params[:request][:destination_url])
rescue Exception => e rescue Exception => e
raise e unless e.message.include? "not found" raise e unless e.message.include? "not found"
flash[:error] = "No diaspora seed found with this email!" flash[:error] = I18n.t 'requests.create.error'
respond_with :location => aspect respond_with :location => aspect
return return
end end
# rel_hash = {:friend => params[:friend_handle]}
Rails.logger.debug("Sending request: #{rel_hash}") Rails.logger.debug("Sending request: #{rel_hash}")
begin begin
@request = current_user.send_friend_request_to(rel_hash[:friend], aspect) @request = current_user.send_friend_request_to(rel_hash[:friend], aspect)
rescue Exception => e rescue Exception => e
raise e unless e.message.include? "already" raise e unless e.message.include? "already"
flash[:notice] = "#{e.message} #{params[:request][:destination_url]}" flash[:notice] = I18n.t 'requests.create.already_friends', :destination_url => params[:request][:destination_url]
respond_with :location => aspect respond_with :location => aspect
return return
end end
if @request if @request
flash[:notice] = "A friend request was sent to #{@request.destination_url}." flash[:notice] = I18n.t 'requests.create.success',:destination_url => @request.destination_url
respond_with :location => aspect respond_with :location => aspect
else else
flash[:error] = "Something went horribly wrong." flash[:error] = I18n.t 'requests.create.horribly_wrong'
respond_with :location => aspect respond_with :location => aspect
end end
end end
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class SocketsController < ApplicationController class SocketsController < ApplicationController
include ApplicationHelper include ApplicationHelper
include SocketsHelper include SocketsHelper
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class StatusMessagesController < ApplicationController class StatusMessagesController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# licensed under the Affero General Public License version 3. See # licensed under the Affero General Public License version 3. See
# the COPYRIGHT file. # the COPYRIGHT file.
class UsersController < ApplicationController class UsersController < ApplicationController
before_filter :authenticate_user!, :except => [:new, :create] before_filter :authenticate_user!, :except => [:new, :create]
...@@ -11,7 +10,7 @@ class UsersController < ApplicationController ...@@ -11,7 +10,7 @@ class UsersController < ApplicationController
def edit def edit
@user = current_user @user = current_user
@person = @user.person @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' @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", @fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
...@@ -30,10 +29,15 @@ class UsersController < ApplicationController ...@@ -30,10 +29,15 @@ class UsersController < ApplicationController
private private
def prep_image_url(params) def prep_image_url(params)
url = APP_CONFIG[:pod_url].chop if APP_CONFIG[:pod_url][-1,1] == '/'
if params[:profile][:image_url].empty? if params[:profile][:image_url].empty?
params[:profile].delete(:image_url) params[:profile].delete(:image_url)
else 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
end end
......
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