Merge branch 'release/0.0.1.0'

This commit is contained in:
Jonne Haß 2012-10-07 15:05:06 +02:00
commit 91a39dfefd
270 changed files with 4578 additions and 2931 deletions

8
.gitignore vendored
View file

@ -4,13 +4,9 @@ app/assets/images/custom/*
# Configuration files
config/app_config.yml
config/app.yml
config/application.yml
config/diaspora.yml
config/heroku.yml
config/script_server*.yml
config/fb_config.yml
config/oauth_keys.yml
config/script_server.yml
config/initializers/secret_token.rb
config/redis.conf
config/deploy_config.yml

2
.rspec
View file

@ -3,4 +3,4 @@
--color
--tag ~performance
--order random
--drb
--drb

9
.rvmrc
View file

@ -1,8 +1,6 @@
#!/bin/bash
rubygems_version="1.8.24"
ruby_version="1.9.3-p194"
gemset="diaspora"
source ./script/env/ruby_env
if [ -e '.rvmrc.local' ]; then
source .rvmrc.local;
@ -18,7 +16,4 @@ else
fi
fi
if [ "$(gem --version)" != "$rubygems_version" ]; then
rvm rubygems "$rubygems_version"
fi
source ./script/env/ensure_right_rubygems

View file

@ -1,26 +1,26 @@
branches:
only:
- 'master'
- 'develop'
language: ruby
rvm:
- 1.9.3
env:
- DB=postgres BUILD_TYPE=other
- DB=mysql BUILD_TYPE=other
- DB=postgres BUILD_TYPE=cucumber
- DB=mysql BUILD_TYPE=cucumber
before_install:
- "./script/ci/before_install.sh"
bundler_args: "--without development production heroku"
before_script: "./script/ci/before.sh"
script: "bundle exec rake travis"
before_install: "./script/ci/before_install.sh"
script: "./script/ci/build.sh"
notifications:
irc:
channels:
- 'irc.freenode.org:6667#diaspora-dev'
- "irc.freenode.org:6667#diaspora-dev"

69
Changelog.md Normal file
View file

@ -0,0 +1,69 @@
# 0.0.1.0
## New configuration system!
Copy over config/diaspora.yml.example to config/diaspora.yml and migrate your settings! An updated Heroku guide including basic hints on howto migrate is [here](https://github.com/diaspora/diaspora/wiki/Installing-on-heroku).
The new configuration system allows all possible settings to be overriden by environment variables. This makes it possible to deploy heroku without checking any credentials into git. Read the top of `config/diaspora.yml.example` for an explanation on how to convert the setting names to environment variables.
### Environment variable changes:
#### deprectated
* REDISTOGO_URL in favour of REDIS_URL or ENVIRONMENT_REDIS
#### removed
* application_yml - Obsolete, all settings are settable via environment variables now
#### renamed
* SINGLE_PROCESS_MODE -> ENVIRONMENT_SINGLE_PROCESS_MODE
* SINGLE_PROCESS -> ENVIRONMENT_SINGLE_PROCESS_MODE
* NO_SSL -> ENVIRONMENT_REQUIRE_SSL
* ASSET_HOST -> ENVIRONMENT_ASSETS_HOST
## Gem changes
### Updated gems
* omniauth-tumblr 1.0 -> 1.1
* rails_admin git -> 0.1.1
* activerecord-import 0.2.10 -> 0.2.11
* fog 1.4.0 -> 1.6.0
* asset_sync 0.4.2 -> 0.5.0
* jquery-rails 2.0.2 -> 2.1.3
### Removed gems
The following gems and their related files were removed as they aren't widely enough used to justify maintenance for them by the core developers. If you use them please maintain them in your fork.
* airbrake
* newrelic_rpm
* rpm_contrib
* heroku_san
The following gems were removed because their are neither used in daily development or are just CLI tools that aren't required to be loaded from the code:
* heroku
* oink
* yard
## Publisher
Refactoring of the JavaScript code; it is now completely rewritten to make use of Backbone.js.
This paves the way for future improvements such as post preview or edit toolbar/help.
## Removal of 'beta' code
The feature-flag on users and all the code in connection with experimental UX changes got removed/reverted. Those are the parts that became Makr.io.
The single-post view will also be revamped/reverted, but that didn't make it into this release.
## JS lib updates
## Cleanup in maintenance scripts and automated build environment

28
Gemfile
View file

@ -1,7 +1,6 @@
source 'http://rubygems.org'
gem 'bundler', '> 1.1.0'
ruby '1.9.3' if ENV['HEROKU']
gem 'rails', '3.2.8'
@ -22,7 +21,7 @@ gem 'remotipart', '1.0.2'
gem 'omniauth', '1.1.1'
gem 'omniauth-facebook', '1.3.0'
gem 'omniauth-tumblr', '1.0'
gem 'omniauth-tumblr', '1.1'
gem 'omniauth-twitter', '0.0.11'
gem 'twitter', '2.0.2'
@ -31,12 +30,9 @@ gem 'twitter', '2.0.2'
gem 'markerb', :git => 'https://github.com/plataformatec/markerb.git'
gem 'messagebus_ruby_api', '1.0.3'
gem 'airbrake', '3.1.0'
gem 'newrelic_rpm', '3.3.5'
gem "rpm_contrib", '2.1.11'
group :production do # we don't install these on travis to speed up test runs
gem 'rails_admin', :git => 'git://github.com/halida/rails_admin.git'
gem 'rails_admin', '0.1.1'
gem 'fastercsv', '1.5.5', :require => false
gem 'rack-ssl', '1.3.2', :require => 'rack/ssl'
gem 'rack-rewrite', '1.2.1', :require => false
@ -44,19 +40,18 @@ group :production do # we don't install these on travis to speed up test runs
# analytics
gem 'rack-google-analytics', '0.11.0', :require => 'rack/google-analytics'
gem 'rack-piwik', '0.1.3', :require => 'rack/piwik', :require => false
end
# configuration
group :heroku do
gem 'pg', '0.14.1'
gem 'unicorn', '4.3.1', :require => false
end
gem 'settingslogic', :git => 'https://github.com/binarylogic/settingslogic.git'
# database
gem "activerecord-import", "0.2.10"
gem "activerecord-import", "0.2.11"
gem 'foreigner', '1.2.1'
gem 'mysql2', '0.3.11' if ENV['DB'].nil? || ENV['DB'] == 'all' || ENV['DB'] == 'mysql'
gem 'pg', '0.14.1' if ENV['DB'] == 'all' || ENV['DB'] == 'postgres'
@ -65,7 +60,7 @@ gem 'sqlite3' if ENV['DB'] == 'all' || ENV['DB'] == 'sqlite'
# file uploading
gem 'carrierwave', '0.6.2'
gem 'fog', '1.4.0'
gem 'fog', '1.6.0'
gem 'mini_magick', '3.4'
# JSON and API
@ -76,7 +71,7 @@ gem 'acts_as_api', '0.4.1 '
# localization
gem 'i18n-inflector-rails', '~> 1.0'
gem 'rails-i18n'
gem 'rails-i18n', :git => "https://github.com/svenfuchs/rails-i18n.git"
# parsing
@ -125,11 +120,10 @@ group :assets do
gem 'handlebars_assets', '0.6.5'
gem 'uglifier', '1.3.0'
# asset_sync is required as needed by application.rb
gem "asset_sync", '0.4.2', :require => nil
gem "asset_sync", '0.5.0', :require => false
end
gem 'jquery-rails', '2.0.2'
gem 'jquery-rails', '2.1.3'
# web
@ -170,13 +164,7 @@ group :test, :development do
end
group :development do
gem 'heroku', '2.28.12'
gem 'heroku_san', '3.0.4'
gem 'capistrano', '2.12.0', :require => false
gem 'capistrano_colors', '0.5.5', :require => false
gem 'capistrano-ext', '1.2.1', :require => false
gem 'yard', '0.8.2.1', :require => false
# for tracing AR object instantiation and memory usage per request
gem 'oink', '0.9.3'
end

View file

@ -1,21 +1,3 @@
GIT
remote: git://github.com/halida/rails_admin.git
revision: 590dceb10812a9207e42dbccecd5d1031715ae80
specs:
rails_admin (0.0.3)
bbenezech-nested_form (~> 0.0.6)
bootstrap-sass (~> 2.0, >= 2.0.3)
builder (~> 3.0)
coffee-rails (~> 3.1)
haml (~> 3.1)
jquery-rails (>= 1.0.17)
jquery-ui-rails (~> 0.2.2)
kaminari (~> 0.12)
rack-pjax (~> 0.5)
rails (~> 3.1)
remotipart (~> 1.0)
sass-rails (~> 3.1)
GIT
remote: https://github.com/Empact/roxml.git
revision: 7ea9a9ffd2338aaef5b04cb792060ae8c98f346a
@ -25,12 +7,6 @@ GIT
activesupport (>= 2.3.0)
nokogiri (>= 1.3.3)
GIT
remote: https://github.com/binarylogic/settingslogic.git
revision: 4884d455bf18d92723cb8190cfd2dbf87f3aafd5
specs:
settingslogic (2.0.8)
GIT
remote: https://github.com/plataformatec/markerb.git
revision: 93b1e8bea9b8fa89ef930f78ba562f596c022198
@ -38,6 +14,13 @@ GIT
markerb (1.0.0)
redcarpet (>= 2.0)
GIT
remote: https://github.com/svenfuchs/rails-i18n.git
revision: 855edc0e265a6d36fe5f62a886b2f0de455dd92a
specs:
rails-i18n (0.6.6)
i18n (~> 0.5)
GEM
remote: http://rubygems.org/
specs:
@ -62,7 +45,7 @@ GEM
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-import (0.2.10)
activerecord-import (0.2.11)
activerecord (~> 3.0)
activerecord (~> 3.0)
activeresource (3.2.8)
@ -78,14 +61,10 @@ GEM
activesupport (>= 3.0.0)
rack (>= 1.1.0)
addressable (2.3.2)
airbrake (3.1.0)
activesupport
builder
arel (3.0.2)
asset_sync (0.4.2)
asset_sync (0.5.0)
activemodel
fog
bbenezech-nested_form (0.0.6)
bcrypt-ruby (3.0.1)
bootstrap-sass (2.1.0.0)
builder (3.0.3)
@ -146,7 +125,7 @@ GEM
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
excon (0.14.3)
excon (0.16.2)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.1.0)
@ -163,9 +142,9 @@ GEM
fixture_builder (0.3.4)
activerecord (>= 2)
activesupport (>= 2)
fog (1.4.0)
fog (1.6.0)
builder
excon (~> 0.14.0)
excon (~> 0.14)
formatador (~> 0.2.0)
mime-types
multi_json (~> 1.0)
@ -204,23 +183,8 @@ GEM
sprockets (>= 2.0.3)
tilt
hashie (1.2.0)
heroku (2.28.12)
heroku-api (~> 0.2.8)
launchy (>= 0.3.2)
netrc (~> 0.7.5)
rest-client (~> 1.6.1)
rubyzip
heroku-api (0.2.8)
excon (~> 0.14.3)
heroku_san (3.0.4)
activesupport
heroku (>= 2)
heroku-api (>= 0.1.2)
rake
highline (1.6.12)
hike (1.2.1)
hodel_3000_compliant_logger (0.1.0)
hpricot (0.8.6)
http_accept_language (1.0.2)
httpauth (0.1)
i18n (0.6.1)
@ -237,20 +201,18 @@ GEM
selenium-webdriver (>= 0.1.3)
jasmine-core (1.2.0)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
jquery-rails (2.1.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
jquery-ui-rails (0.2.2)
jquery-ui-rails (2.0.1)
jquery-rails
railties (>= 3.1.0)
jruby-pageant (1.1.1)
json (1.7.5)
kaminari (0.13.0)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
kgio (2.7.4)
launchy (2.1.2)
addressable (~> 2.3)
libwebsocket (0.1.5)
listen (0.4.2)
rb-fchange (~> 0.0.5)
@ -270,24 +232,21 @@ GEM
multi_json (1.3.6)
multipart-post (1.1.5)
mysql2 (0.3.11)
nested_form (0.2.3)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.5.2)
net-ssh (2.6.0)
jruby-pageant (>= 1.1.1)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
netrc (0.7.7)
newrelic_rpm (3.3.5)
nokogiri (1.5.5)
oauth (0.4.6)
oauth2 (0.6.1)
faraday (~> 0.7)
httpauth (~> 0.1)
multi_json (~> 1.3)
oink (0.9.3)
activerecord
hodel_3000_compliant_logger
omniauth (1.1.1)
hashie (~> 1.2)
rack
@ -299,13 +258,12 @@ GEM
omniauth-oauth2 (1.0.2)
oauth2 (~> 0.6.0)
omniauth (~> 1.0)
omniauth-tumblr (1.0)
omniauth-tumblr (1.1)
omniauth-oauth (~> 1.0)
omniauth-twitter (0.0.11)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.4.0)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
@ -316,8 +274,8 @@ GEM
rack-mobile-detect (0.4.0)
rack
rack-piwik (0.1.3)
rack-pjax (0.5.9)
hpricot (~> 0.8.6)
rack-pjax (0.6.0)
nokogiri (~> 1.5)
rack (~> 1.3)
rack-protection (1.2.0)
rack
@ -334,8 +292,19 @@ GEM
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.8)
rails-i18n (0.6.6)
i18n (~> 0.5)
rails_admin (0.1.1)
bootstrap-sass (~> 2.0)
builder (~> 3.0)
coffee-rails (~> 3.1)
haml (~> 3.1)
jquery-rails (~> 2.0)
jquery-ui-rails (~> 2.0)
kaminari (~> 0.12)
nested_form (~> 0.2.3)
rack-pjax (~> 0.5)
rails (~> 3.1)
remotipart (~> 1.0)
sass-rails (~> 3.1)
rails_autolink (1.0.9)
rails (~> 3.1)
railties (3.2.8)
@ -366,11 +335,6 @@ GEM
vegas (~> 0.1.2)
resque-timeout (1.0.0)
resque (~> 1.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rpm_contrib (2.1.11)
newrelic_rpm (>= 3.1.1)
newrelic_rpm (>= 3.1.1)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@ -445,18 +409,16 @@ GEM
will_paginate (3.0.3)
xpath (0.1.4)
nokogiri (~> 1.3)
yard (0.8.2.1)
PLATFORMS
ruby
DEPENDENCIES
activerecord-import (= 0.2.10)
activerecord-import (= 0.2.11)
acts-as-taggable-on (= 2.3.3)
acts_as_api (= 0.4.1)
addressable (= 2.3.2)
airbrake (= 3.1.0)
asset_sync (= 0.4.2)
asset_sync (= 0.5.0)
bootstrap-sass (= 2.1.0.0)
bundler (> 1.1.0)
capistrano (= 2.12.0)
@ -474,7 +436,7 @@ DEPENDENCIES
faraday_middleware (= 0.8.8)
fastercsv (= 1.5.5)
fixture_builder (= 0.3.4)
fog (= 1.4.0)
fog (= 1.6.0)
foreigner (= 1.2.1)
foreman (= 0.59)
fuubar (= 1.0.0)
@ -484,47 +446,40 @@ DEPENDENCIES
guard-spork (= 0.8.0)
haml (= 3.1.7)
handlebars_assets (= 0.6.5)
heroku (= 2.28.12)
heroku_san (= 3.0.4)
http_accept_language (= 1.0.2)
i18n-inflector-rails (~> 1.0)
jasmine (= 1.2.1)
jquery-rails (= 2.0.2)
jquery-rails (= 2.1.3)
json (= 1.7.5)
markerb!
messagebus_ruby_api (= 1.0.3)
mini_magick (= 3.4)
mobile-fu (= 1.1.0)
mysql2 (= 0.3.11)
newrelic_rpm (= 3.3.5)
nokogiri (= 1.5.5)
oink (= 0.9.3)
omniauth (= 1.1.1)
omniauth-facebook (= 1.3.0)
omniauth-tumblr (= 1.0)
omniauth-tumblr (= 1.1)
omniauth-twitter (= 0.0.11)
pg (= 0.14.1)
rack-cors (= 0.2.7)
rack-google-analytics (= 0.11.0)
rack-piwik (= 0.1.3)
rack-rewrite (= 1.2.1)
rack-ssl (= 1.3.2)
rails (= 3.2.8)
rails-i18n
rails_admin!
rails-i18n!
rails_admin (= 0.1.1)
rails_autolink (= 1.0.9)
redcarpet (= 2.1.1)
remotipart (= 1.0.2)
resque (= 1.22.0)
resque-timeout (= 1.0.0)
roxml!
rpm_contrib (= 2.1.11)
rspec-instafail (= 0.2.4)
rspec-rails (= 2.11.0)
ruby-oembed (= 0.8.7)
sass-rails (= 3.2.5)
selenium-webdriver (= 2.25.0)
settingslogic!
spork (= 1.0.0rc3)
thin (= 1.4.1)
timecop (= 0.5.1)
@ -534,4 +489,3 @@ DEPENDENCIES
unicorn (= 4.3.1)
webmock (= 1.8.10)
will_paginate (= 3.0.3)
yard (= 0.8.2.1)

View file

@ -1,6 +1 @@
web: bundle exec unicorn -c config/unicorn.rb -p $PORT
redis: redis-server
catchall_worker: env QUEUE=* bundle exec rake resque:work
slow_worker: env QUEUES=socket_webfinger,photos,http_service,dispatch,receive_local,mail,receive,receive_salmon,http,delete_account bundle exec rake resque:work
priority_worker: env QUEUES=socket_webfinger,photos,http_service,dispatch,mail,delete_account bundle exec rake resque:work
super_slow_worker: env QUEUE=http,receive_salmon bundle exec rake resque:work

View file

@ -2,14 +2,11 @@ Diaspora*
Diaspora is a privacy-aware, personally-controlled, do-it-all open source social network. Check out our [project site](http://diasporaproject.org).
[![Build Status](https://secure.travis-ci.org/diaspora/diaspora.png?branch=master)](http://travis-ci.org/diaspora/diaspora)
[![Dependency Status](https://gemnasium.com/diaspora/diaspora.png?travis)](https://gemnasium.com/diaspora/diaspora)
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/diaspora/diaspora)
* **master:** [![Build Status master](https://secure.travis-ci.org/diaspora/diaspora.png?branch=master)](http://travis-ci.org/diaspora/diaspora)
* **develop:** [![Build Status develop](https://secure.travis-ci.org/diaspora/diaspora.png?branch=develop)](http://travis-ci.org/diaspora/diaspora)
* [![Dependency Status](https://gemnasium.com/diaspora/diaspora.png?travis)](https://gemnasium.com/diaspora/diaspora)
* [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/diaspora/diaspora)
************************
Diaspora is currently going through a huge refactoring push, the code is changing fast!
If you want to do something big, reach out on IRC or the mailing list first, so you can contribute effectively <3333
************************
With Diaspora you can:

View file

@ -0,0 +1,62 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
(function(){
// mixin-object, used in conjunction with the publisher to provide the
// functionality for selecting aspects
app.views.PublisherAspectsSelector = {
// event handler for aspect selection
toggleAspect: function(evt) {
var el = $(evt.target);
var btn = el.parent('.dropdown').find('.button');
// visually toggle the aspect selection
if( el.is('.radio') ) {
AspectsDropdown.toggleRadio(el);
} else {
AspectsDropdown.toggleCheckbox(el);
}
// update the selection summary
AspectsDropdown.updateNumber(
el.closest(".dropdown_list"),
null,
el.parent().find('li.selected').length,
''
);
this._updateSelectedAspectIds();
},
// take care of the form fields that will indicate the selected aspects
_updateSelectedAspectIds: function() {
var self = this;
// remove previous selection
this.$('input[name="aspect_ids[]"]').remove();
// create fields for current selection
this.$('.dropdown .dropdown_list li.selected').each(function() {
var el = $(this);
var aspectId = el.data('aspect_id');
self._addHiddenAspectInput(aspectId);
// close the dropdown when a radio item was selected
if( el.is('.radio') ) {
el.closest('.dropdown').removeClass('active');
}
});
},
_addHiddenAspectInput: function(id) {
var uid = _.uniqueId('aspect_ids_');
this.$('.content_creation form').append(
'<input id="'+uid+'" name="aspect_ids[]" type="hidden" value="'+id+'">'
);
}
};
})();

View file

@ -0,0 +1,65 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
(function(){
// mixin-object, used in conjunction with the publisher to provide the
// functionality for displaying 'getting-started' information
app.views.PublisherGettingStarted = {
// initiate all the popover message boxes
triggerGettingStarted: function() {
this._addPopover(this.el_input, {
trigger: 'manual',
offset: 30,
id: 'first_message_explain',
placement: 'right',
html: true
}, 600);
this._addPopover(this.$('.dropdown'), {
trigger: 'manual',
offset: 10,
id: 'message_visibility_explain',
placement: 'bottom',
html: true
}, 1000);
this._addPopover($('#gs-shim'), {
trigger: 'manual',
offset: -5,
id: 'stream_explain',
placement: 'left',
html: true
}, 1400);
// hide some popovers when a post is created
this.$('.button.creation').click(function() {
this.$('.dropdown').popover('hide');
this.el_input.popover('hide');
});
},
_addPopover: function(el, opts, timeout) {
el.popover(opts);
el.click(function() {
el.popover('hide');
});
// show the popover after the given timeout
setTimeout(function() {
el.popover('show');
// disable 'getting started' when the last popover is closed
var popup = el.data('popover').$tip[0];
var close = $(popup).find('.close');
close.click(function() {
if( $('.popover').length==1 ) {
$.get('/getting_started_completed');
}
el.popover('hide');
});
}, timeout);
}
};
})();

View file

@ -0,0 +1,51 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
(function(){
// mixin-object, used in conjunction with the publisher to provide the
// functionality for selecting services for cross-posting
app.views.PublisherServices = {
// visually toggle the icon and kick-off all other actions for cross-posting
toggleService: function(evt) {
var el = $(evt.target);
var provider = el.attr('id');
el.toggleClass("dim");
this._createCounter();
this._toggleServiceField(provider);
},
// keep track of character count
_createCounter: function() {
// remove obsolete counter
this.$('.counter').remove();
// create new counter
var min = 40000;
var a = this.$('.service_icon:not(.dim)');
if(a.length > 0){
$.each(a, function(index, value){
var num = parseInt($(value).attr('maxchar'));
if (min > num) { min = num; }
});
this.el_input.charCount({allowed: min, warning: min/10 });
}
},
// add or remove the input containing the selected service
_toggleServiceField: function(provider) {
var hidden_field = this.$('input[name="services[]"][value="'+provider+'"]');
if(hidden_field.length > 0){
hidden_field.remove();
} else {
var uid = _.uniqueId('services_');
this.$(".content_creation form").append(
'<input id="'+uid+'" name="services[]" type="hidden" value="'+provider+'">');
}
}
};
})();

View file

@ -1,19 +1,57 @@
//this file is the scary no-no-zone bad-touch of our backbone code.
//after re-writing/eliminating the existing Publisher let's re-write
//this with PANACHE! <333 Dennis
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
//= require ./publisher/services
//= require ./publisher/aspects_selector
//= require ./publisher/getting_started
app.views.Publisher = Backbone.View.extend(_.extend(
app.views.PublisherServices,
app.views.PublisherAspectsSelector,
app.views.PublisherGettingStarted, {
app.views.Publisher = Backbone.View.extend({
el : "#publisher",
events : {
"focus textarea" : "open",
"click #hide_publisher" : "clear",
"submit form" : "createStatusMessage"
"submit form" : "createStatusMessage",
"click .service_icon": "toggleService",
"textchange #status_message_fake_text": "handleTextchange",
"click .dropdown .dropdown_list li": "toggleAspect"
},
initialize : function(){
this.collection = this.collection //takes a Posts collection
// init shortcut references to the various elements
this.el_input = this.$('#status_message_fake_text');
this.el_hiddenInput = this.$('#status_message_text');
this.el_wrapper = this.$('#publisher_textarea_wrapper');
this.el_submit = this.$('input[type=submit]');
this.el_photozone = this.$('#photodropzone');
// init mentions plugin
Mentions.initialize(this.el_input);
// init autoresize plugin
this.el_input.autoResize({ 'extraSpace' : 10, 'maxHeight' : Infinity });
// sync textarea content
if( this.el_hiddenInput.val() == "" ) {
this.el_hiddenInput.val( this.el_input.val() );
}
// hide close button, in case publisher is standalone
// (e.g. bookmarklet, mentions popup)
if( this.options.standalone ) {
this.$('#hide_publisher').hide();
}
// this has to be here, otherwise for some reason the callback for the
// textchange event won't be called in Backbone...
this.el_input.bind('textchange', $.noop);
return this;
},
@ -49,36 +87,72 @@ app.views.Publisher = Backbone.View.extend({
},
clear : function() {
this.$('textarea').val("");
this.$('#publisher_textarea_wrapper').removeClass("with_attachments");
// clear text(s)
this.el_input.val('');
this.el_hiddenInput.val('');
// remove mentions
this.el_input.mentionsInput('reset');
// remove photos
this.$("#photodropzone").find('li').remove();
this.el_photozone.find('li').remove();
this.$("input[name='photos[]']").remove();
this.el_wrapper.removeClass("with_attachments");
// close publishing area (CSS)
this.close();
Publisher.clear()
// disable submitting
this.checkSubmitAvailability();
return this;
},
open : function() {
$(this.el).removeClass('closed');
this.$("#publisher_textarea_wrapper").addClass('active');
// visually 'open' the publisher
this.$el.removeClass('closed');
this.el_wrapper.addClass('active');
// fetch contacts for mentioning
Mentions.fetchContacts();
return this;
},
close : function() {
$(this.el).addClass("closed");
this.$("#publisher_textarea_wrapper").removeClass("active");
this.$("textarea").css('height', '');
this.el_wrapper.removeClass("active");
this.el_input.css('height', '');
return this;
},
checkSubmitAvailability: function() {
if( this._submittable() ) {
this.el_submit.removeAttr('disabled');
} else {
this.el_submit.attr('disabled','disabled');
}
},
// determine submit availability
_submittable: function() {
var onlyWhitespaces = ($.trim(this.el_input.val()) === ''),
isPhotoAttached = (this.el_photozone.children().length > 0);
return (!onlyWhitespaces || isPhotoAttached);
},
handleTextchange: function() {
var self = this;
this.checkSubmitAvailability();
this.el_input.mentionsInput("val", function(value){
self.el_hiddenInput.val(value);
});
}
});
}));
// jQuery helper for serializing a <form> into JSON
$.fn.serializeObject = function()

View file

@ -61,7 +61,7 @@ app.views.StreamPost = app.views.Post.extend({
blockUser: function(evt){
if(evt) { evt.preventDefault(); }
if(!confirm("Ignore this user?")) { return }
if(!confirm(Diaspora.I18n.t('ignore_user'))) { return }
var personId = this.model.get("author").id;
var block = new app.models.Block();
@ -107,4 +107,4 @@ app.views.StreamPost = app.views.Post.extend({
return this;
}
})
})

View file

@ -1,4 +1,4 @@
// Copyright (c) 2010-2011, Diaspora Inc. This file is
// Copyright (c) 2010-2012, Diaspora Inc. This file is
// licensed under the Affero General Public License version 3 or later. See
// the COPYRIGHT file.

View file

@ -2,7 +2,7 @@
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
//= require publisher
//= require jquery.textchange
//= require aspect-edit-pane
//= require fileuploader-custom

View file

@ -1,221 +0,0 @@
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
//TODO: make this a widget
var Publisher = {
bookmarklet : false,
form: function(){
return Publisher.cachedForm = Publisher.cachedForm || $('#publisher');
},
input: function(){
return Publisher.cachedInput = Publisher.cachedInput || Publisher.form().find('#status_message_fake_text');
},
wrapper: function(){
return Publisher.cachedWrapper = Publisher.cachedWrapper || Publisher.form().find('#publisher_textarea_wrapper');
},
hiddenInput: function(){
return Publisher.cachedHiddenInput= Publisher.cachedHiddenInput || Publisher.form().find('#status_message_text');
},
submit: function(){
return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find("input[type='submit']");
},
determineSubmitAvailability: function(){
var onlyWhitespaces = ($.trim(Publisher.input().val()) === ''),
isSubmitDisabled = Publisher.submit().attr('disabled'),
isPhotoAttached = ($("#photodropzone").children().length > 0);
if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
Publisher.submit().attr('disabled', 'disabled');
} else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) {
Publisher.submit().removeAttr('disabled');
}
},
clear: function(){
$("#photodropzone").find('li').remove();
Publisher.input().mentionsInput("reset");
Publisher.wrapper().removeClass("with_attachments");
Publisher.hiddenInput().val('');
Publisher.determineSubmitAvailability()
},
bindServiceIcons: function(){
$(".service_icon").bind("click", function(evt){
$(this).toggleClass("dim");
Publisher.toggleServiceField($(this));
});
},
toggleServiceField: function(service){
Publisher.createCounter(service);
var provider = service.attr('id');
var hidden_field = $('#publisher [name="services[]"][value="'+provider+'"]');
if(hidden_field.length > 0){
hidden_field.remove();
} else {
$("#publisher .content_creation form").append(
'<input id="services_" name="services[]" type="hidden" value="'+provider+'">');
}
},
isPublicPost: function(){
return $('#publisher [name="aspect_ids[]"]').first().val() == "public";
},
isToAllAspects: function(){
return $('#publisher [name="aspect_ids[]"]').first().val() == "all_aspects";
},
selectedAspectIds: function() {
var aspects = $('#publisher [name="aspect_ids[]"]');
var aspectIds = [];
aspects.each(function() { aspectIds.push( parseInt($(this).attr('value'))); });
return aspectIds;
},
removeRadioSelection: function(hiddenFields){
$.each(hiddenFields, function(index, value){
var el = $(value);
if(el.val() == "all_aspects" || el.val() == "public") {
el.remove();
}
});
},
toggleAspectIds: function(li) {
var aspectId = li.attr('data-aspect_id'),
hiddenFields = $('#publisher [name="aspect_ids[]"]'),
appendId = function(){
$("#publisher .content_creation form").append(
'<input id="aspect_ids_" name="aspect_ids[]" type="hidden" value="'+aspectId+'">');
};
if(li.hasClass('radio')){
$.each(hiddenFields, function(index, value){
$(value).remove();
});
appendId();
// close dropdown after selecting a binary option
li.closest('.dropdown').removeClass('active');
} else {
var hiddenField = $('#publisher [name="aspect_ids[]"][value="'+aspectId+'"]');
// remove all radio selections
Publisher.removeRadioSelection(hiddenFields);
if(hiddenField.length > 0){
hiddenField.remove();
} else {
appendId();
}
}
},
createCounter: function(service){
var counter = $("#publisher .counter");
counter.remove();
var min = 40000;
var a = $('.service_icon:not(.dim)');
if(a.length > 0){
$.each(a, function(index, value){
var num = parseInt($(value).attr('maxchar'));
if (min > num) { min = num; }
});
$('#status_message_fake_text').charCount({allowed: min, warning: min/10 });
}
},
bindAspectToggles: function() {
$('#publisher .dropdown .dropdown_list li').bind("click", function(evt){
var li = $(this),
button = li.parent('.dropdown').find('.button');
if(li.hasClass('radio')){
AspectsDropdown.toggleRadio(li);
} else {
AspectsDropdown.toggleCheckbox(li);
}
AspectsDropdown.updateNumber(li.closest(".dropdown_list"), null, li.parent().find('li.selected').length, '');
Publisher.toggleAspectIds(li);
});
},
textChange : function(){
Publisher.determineSubmitAvailability();
Publisher.input().mentionsInput("val", function(value) {
Publisher.hiddenInput().val(value);
});
},
triggerGettingStarted: function(){
Publisher.setUpPopovers("#publisher .dropdown", {trigger: 'manual', offset: 10, id: "message_visibility_explain", placement:'bottom', html:true}, 1000);
Publisher.setUpPopovers("#publisher #status_message_fake_text", {trigger: 'manual', placement: 'right', offset: 30, id: "first_message_explain", html:true}, 600);
Publisher.setUpPopovers("#gs-shim", {trigger: 'manual', placement: 'left', id:"stream_explain", offset: -5, html:true}, 1400);
$("#publisher .button.creation").bind("click", function(){
$("#publisher .dropdown").popover("hide");
$("#publisher #status_message_fake_text").popover("hide");
});
},
setUpPopovers: function(selector, options, timeout){
var selection = $(selector);
selection.popover(options);
selection.bind("click", function(){$(this).popover("hide")});
setTimeout(function(){
selection.popover("show");
var popup = selection.data('popover').$tip[0],
closeIcon = $(popup).find(".close");
closeIcon.bind("click",function(){
if($(".popover").length == 1){
$.get("/getting_started_completed");
};
selection.popover("hide");
});
}, timeout);
},
initialize: function() {
Publisher.cachedForm = Publisher.cachedSubmit =
Publisher.cachedInput = Publisher.cachedHiddenInput = false;
Publisher.bindServiceIcons();
Publisher.bindAspectToggles();
Mentions.initialize(Publisher.input());
Publisher.input().bind("focus", function(){
Mentions.fetchContacts();
})
if(Publisher.hiddenInput().val() === "") {
Publisher.hiddenInput().val(Publisher.input().val());
}
Publisher.input().autoResize({ 'extraSpace' : 10, 'maxHeight' : Infinity });
Publisher.input().bind('textchange', Publisher.textChange);
}
};
$(document).ready(function() {
Publisher.initialize();
Diaspora.page.subscribe("stream/reloaded", Publisher.initialize);
});

View file

@ -319,6 +319,42 @@ $bring-dark-accent-forward-color: #DDD;
}
}
.profile-image-container {
border-radius: 140px;
border : 3px solid #fff;
box-shadow : 0 0 2px rgba(0,0,0,0.5), 0 0 10px rgba(0,0,0,0.6), inset 0 0 15px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(255,255,255,0.3);
background-size: cover;
height : 140px;
width : 140px;
background : {
position : center;
image : image-url('user/default.png');
}
display : inline-block;
margin-bottom : 5px;
&.small {
height : 40px;
width : 40px;
border : 2px solid #fff;
}
&.smaller {
height : 34px;
width : 34px;
border : 2px solid #ccc;
}
&.micro {
height : 24px;
width : 24px;
border : 2px solid #fff;
}
}
/* responsive */
@media (max-width: 767px) {
body {

View file

@ -87,6 +87,7 @@
textarea{
height: 18px;
width: 318px;
padding: 4px;
}
form {
@ -97,6 +98,9 @@
position: absolute;
right: 10px;
bottom: 10px;
font-size: 11px;
line-height: 16px;
padding: 5px 9px;
}
}
}
@ -336,4 +340,4 @@
margin-top : 9px;
margin-right : -5px;
margin-left : 4px;
}
}

View file

@ -119,7 +119,7 @@ input.button
> li
:font-size 11px !important
:padding 3px 2px
:padding 6px 2px
:left 24px
:position relative
:color #222
@ -195,8 +195,8 @@ input.button
:top 1px solid #444
:bottom 1px solid #444
:padding
:top 2px
:bottom 2px
:top 5px
:bottom 5px
&.divider
:padding

View file

@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
before_filter :ensure_http_referer_is_set
before_filter :set_locale
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
before_filter :set_diaspora_header
before_filter :set_grammatical_gender
before_filter :mobile_switch
@ -61,9 +61,13 @@ class ApplicationController < ActionController::Base
params[:page] = params[:page] ? params[:page].to_i : 1
end
def set_git_header
headers['X-Git-Update'] = AppConfig[:git_update] if AppConfig[:git_update].present?
headers['X-Git-Revision'] = AppConfig[:git_revision] if AppConfig[:git_revision].present?
def set_diaspora_header
headers['X-Diaspora-Version'] = AppConfig.version_string
if AppConfig.git_available?
headers['X-Git-Update'] = AppConfig.git_update if AppConfig.git_update.present?
headers['X-Git-Revision'] = AppConfig.git_revision if AppConfig.git_revision.present?
end
end
def set_locale
@ -86,7 +90,7 @@ class ApplicationController < ActionController::Base
def set_grammatical_gender
if (user_signed_in? && I18n.inflector.inflected_locale?)
gender = current_user.profile.gender.to_s.tr('!()[]"\'`*=|/\#.,-:', '').downcase
gender = current_user.gender.to_s.tr('!()[]"\'`*=|/\#.,-:', '').downcase
unless gender.empty?
i_langs = I18n.inflector.inflected_locales(:gender)
i_langs.delete I18n.locale

View file

@ -5,10 +5,10 @@ class ConversationsController < ApplicationController
def index
@conversations = Conversation.joins(:conversation_visibilities).where(
:conversation_visibilities => {:person_id => current_user.person.id}).paginate(
:conversation_visibilities => {:person_id => current_user.person_id}).paginate(
:page => params[:page], :per_page => 15, :order => 'updated_at DESC')
@visibilities = ConversationVisibility.where(:person_id => current_user.person.id).paginate(
@visibilities = ConversationVisibility.where(:person_id => current_user.person_id).paginate(
:page => params[:page], :per_page => 15, :order => 'updated_at DESC')
@unread_counts = {}
@ -18,7 +18,7 @@ class ConversationsController < ApplicationController
@conversations.each { |c| @authors[c.id] = c.last_author }
@conversation = Conversation.joins(:conversation_visibilities).where(
:conversation_visibilities => {:person_id => current_user.person.id, :conversation_id => params[:conversation_id]}).first
:conversation_visibilities => {:person_id => current_user.person_id, :conversation_id => params[:conversation_id]}).first
respond_with do |format|
format.html
@ -31,7 +31,7 @@ class ConversationsController < ApplicationController
contact.person_id
end
params[:conversation][:participant_ids] = person_ids | [current_user.person.id]
params[:conversation][:participant_ids] = person_ids | [current_user.person_id]
params[:conversation][:author] = current_user.person
message_text = params[:conversation].delete(:text)
params[:conversation][:messages_attributes] = [ {:author => current_user.person, :text => message_text }]
@ -52,7 +52,7 @@ class ConversationsController < ApplicationController
def show
if @conversation = Conversation.joins(:conversation_visibilities).where(:id => params[:id],
:conversation_visibilities => {:person_id => current_user.person.id}).first
:conversation_visibilities => {:person_id => current_user.person_id}).first
if @visibility = ConversationVisibility.where(:conversation_id => params[:id], :person_id => current_user.person.id).first
@visibility.unread = 0
@visibility.save

View file

@ -55,7 +55,7 @@ class InvitationsController < ApplicationController
end
def check_if_invites_open
unless AppConfig[:open_invitations]
unless AppConfig.settings.invitations.open?
flash[:error] = I18n.t 'invitations.create.no_more'
redirect_to :back

View file

@ -11,7 +11,7 @@ class MessagesController < ApplicationController
def create
cnv = Conversation.joins(:conversation_visibilities).where(:id => params[:conversation_id],
:conversation_visibilities => {:person_id => current_user.person.id}).first
:conversation_visibilities => {:person_id => current_user.person_id}).first
if cnv
message = Message.new(:conversation_id => cnv.id, :text => params[:message][:text], :author => current_user.person)

View file

@ -83,7 +83,7 @@ class PeopleController < ApplicationController
def show
@person = Person.find_from_guid_or_username(params)
raise(ActiveRecord::RecordNotFound) if remote_profile_with_no_user_session?
authenticate_user! if remote_profile_with_no_user_session?
return redirect_to :back, :notice => t("people.show.closed_account") if @person.closed_account?
@post_type = :all

View file

@ -58,7 +58,7 @@ class PhotosController < ApplicationController
end
def make_profile_photo
author_id = current_user.person.id
author_id = current_user.person_id
@photo = Photo.where(:id => params[:photo_id], :author_id => author_id).first
if @photo

View file

@ -42,7 +42,7 @@ class ProfilesController < ApplicationController
@profile_attrs[:nsfw] ||= false
if params[:photo_id]
@profile_attrs[:photo] = Photo.where(:author_id => current_user.person.id, :id => params[:photo_id]).first
@profile_attrs[:photo] = Photo.where(:author_id => current_user.person_id, :id => params[:photo_id]).first
end
if current_user.update_profile(@profile_attrs)

View file

@ -9,12 +9,6 @@ class PublicsController < ApplicationController
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
include Diaspora::Parser
# We use newrelic_ignore to prevent artifical RPM bloat; however,
# I am commenting this line out for the time being to debug some apparent
# issues on Heroku.
#
# newrelic_ignore if EnvironmentConfiguration.using_new_relic?
skip_before_filter :set_header_data
skip_before_filter :set_grammatical_gender
before_filter :check_for_xml, :only => [:receive, :receive_public]

View file

@ -31,7 +31,7 @@ class RegistrationsController < Devise::RegistrationsController
private
def check_valid_invite!
return true unless AppConfig[:registrations_closed] #this sucks
return true if AppConfig.settings.enable_registrations? #this sucks
return true if invite && invite.can_be_used?
flash[:error] = t('registrations.invalid_invite')
redirect_to new_user_session_path
@ -39,7 +39,7 @@ class RegistrationsController < Devise::RegistrationsController
def check_registrations_open_or_vaild_invite!
return true if invite.present?
if AppConfig[:registrations_closed]
unless AppConfig.settings.enable_registrations?
flash[:error] = t('registrations.closed')
redirect_to new_user_session_path
end

View file

@ -6,7 +6,7 @@ class ResharesController < ApplicationController
@reshare = current_user.build_post(:reshare, :root_guid => params[:root_guid])
if @reshare.save
current_user.add_to_streams(@reshare, current_user.aspects)
current_user.dispatch_post(@reshare, :url => post_url(@reshare), :additional_subscribers => @reshare.root.author)
current_user.dispatch_post(@reshare, :url => post_url(@reshare), :additional_subscribers => @reshare.root_author)
end
render :json => ExtremePostPresenter.new(@reshare, current_user), :status => 201

View file

@ -33,9 +33,9 @@ class ServicesController < ApplicationController
current_user.services << service
if service.persisted?
fetch_photo = current_user.person.profile[:image_url].blank?
fetch_photo = current_user.profile[:image_url].blank?
current_user.update_profile(current_user.person.profile.from_omniauth_hash(user))
current_user.update_profile(current_user.profile.from_omniauth_hash(user))
Resque.enqueue(Jobs::FetchProfilePhoto, current_user.id, service.id, user["image"]) if fetch_photo
flash[:notice] = I18n.t 'services.create.success'
@ -44,7 +44,7 @@ class ServicesController < ApplicationController
if existing_service = Service.where(:type => service.type.to_s, :uid => service.uid).first
flash[:error] << I18n.t('services.create.already_authorized',
:diaspora_id => existing_service.user.person.profile.diaspora_handle,
:diaspora_id => existing_service.user.profile.diaspora_handle,
:service_name => provider.camelize )
end
end
@ -65,4 +65,4 @@ class ServicesController < ApplicationController
redirect_to services_url
end
end
end

View file

@ -101,7 +101,7 @@ class UsersController < ApplicationController
if @user = User.find_by_username(params[:username])
respond_to do |format|
format.atom do
@posts = StatusMessage.where(:author_id => @user.person.id, :public => true).order('created_at DESC').limit(25)
@posts = StatusMessage.where(:author_id => @user.person_id, :public => true).order('created_at DESC').limit(25)
end
format.any { redirect_to person_path(@user.person) }
@ -140,7 +140,7 @@ class UsersController < ApplicationController
username = params[:username].split('@')[0]
user = User.find_by_username(username)
if user.present?
redirect_to user.profile.image_url
redirect_to user.image_url
else
render :nothing => true, :status => 404
end

View file

@ -9,7 +9,7 @@ module AnalyticsHelper
<<-JS.html_safe
(function(d,c){var a,b,g,e;a=d.createElement('script');a.type='text/javascript';a.async=!0;a.src=('https:'===d.location.protocol?'https:':'http:')+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';b=d.getElementsByTagName('script')[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var b=c;'undefined'!==typeof f?b=c[f]=[]:f='mixpanel';g='disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config'.split(' ');
for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
mixpanel.init("#{AppConfig[:mixpanel_uid]}");
mixpanel.init("#{AppConfig.privacy.mixpanel_uid}");
JS
end
end
@ -35,7 +35,7 @@ module AnalyticsHelper
include_analytics "chartbeat" do
javascript_tag do
<<-JS.html_safe
var _sf_async_config = { uid: #{AppConfig[:chartbeat_uid]}, domain: "#{AppConfig[:pod_uri].host}" };
var _sf_async_config = { uid: #{AppConfig.privacy.chartbeat_uid}, domain: "#{AppConfig.pod_uri.host}" };
(function() {
function loadChartbeat() {
window._sf_endpt = (new Date()).getTime();
@ -64,6 +64,6 @@ module AnalyticsHelper
end
def configured?(service)
AppConfig["#{service}_uid".to_sym].present?
AppConfig.privacy.send("#{service}_uid").present?
end
end
end

View file

@ -4,7 +4,7 @@
module ApplicationHelper
def pod_name
AppConfig[:pod_name].present? ? AppConfig[:pod_name] : "DIASPORA*"
AppConfig.settings.pod_name.present? ? AppConfig.settings.pod_name : "DIASPORA*"
end
def how_long_ago(obj)
@ -21,7 +21,7 @@ module ApplicationHelper
end
def raw_bookmarklet( height = 250, width = 620)
"javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
"javascript:(function(){f='#{AppConfig.pod_uri.to_s}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
def magic_bookmarklet_link
@ -37,7 +37,7 @@ module ApplicationHelper
end
def all_services_connected?
current_user.services.size == AppConfig[:configured_services].size
current_user.services.size == AppConfig.configured_services.size
end
def popover_with_close_html(without_close_html)
@ -56,7 +56,7 @@ module ApplicationHelper
# vendored jquery_ujs
def jquery_include_tag
buf = []
if AppConfig[:jquery_cdn]
if AppConfig.privacy.jquery_cdn?
version = Jquery::Rails::JQUERY_VERSION
buf << [ javascript_include_tag("//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js") ]
buf << [ javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag("jquery")}'));") ]

View file

@ -6,9 +6,9 @@ module ContactsHelper
:action => 'destroy',
:id => 42,
:aspect_id => @aspect.id,
:person_id => contact.person.id
:person_id => contact.person_id
},
:title => t('.remove_person_from_aspect', :person_name => contact.person.first_name, :aspect_name => @aspect.name),
:title => t('.remove_person_from_aspect', :person_name => contact.person_first_name, :aspect_name => @aspect.name),
:method => 'delete')
else
@ -17,4 +17,4 @@ module ContactsHelper
:current_user => current_user }
end
end
end
end

View file

@ -4,7 +4,7 @@ module InvitationCodesHelper
content_tag(:div, :class => 'media well') do
person_image_link(invite.user.person, :class => 'img') +
content_tag(:div, :class => 'bd') do
I18n.translate('invitation_codes.excited', :name => invite.user.name)
I18n.translate('invitation_codes.excited', :name => invite.user_name)
end
end
end

View file

@ -20,7 +20,7 @@ module LayoutHelper
end
def set_asset_host
path = ENV['ASSET_HOST'].to_s + '/assets/'
path = AppConfig.environment.assets.host.to_s + '/assets/'
content_tag(:script) do
<<-JS.html_safe
if(window.app) app.baseImageUrl("#{path}")

View file

@ -8,11 +8,11 @@ module MobileHelper
if (post.public? || reshare?(post)) && (user_signed_in? && post.author != current_user.person)
root = reshare?(post) ? post.root : post
if root.author != current_user.person.id
reshare = Reshare.where(:author_id => current_user.person.id,
if root.author != current_user.person_id
reshare = Reshare.where(:author_id => current_user.person_id,
:root_guid => root.guid).first
klass = reshare.present? ? "active" : "inactive"
link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author.name), :class => "image_link reshare_action #{klass}"
link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author_name), :class => "image_link reshare_action #{klass}"
end
end
end

View file

@ -13,7 +13,7 @@ module NotificationsHelper
end
elsif note.instance_of?(Notifications::CommentOnPost) || note.instance_of?(Notifications::AlsoCommented) || note.instance_of?(Notifications::Reshared) || note.instance_of?(Notifications::Liked)
if post = note.linked_object
translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), post_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author_name), :post_link => link_to(t('notifications.post'), post_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
else
t(note.deleted_translation_key, :actors => actors, :count => actors_count).html_safe
end

View file

@ -30,7 +30,7 @@ module OpenGraphHelper
end
def og_namespace(object)
namespace = AppConfig[:open_graph_namespace].present? ? AppConfig[:open_graph_namespace] : 'joindiaspora'
namespace = AppConfig.services.facebook.open_graph_namespace.present? ? AppConfig.services.facebook.open_graph_namespace : 'joindiaspora'
"#{namespace}:frame"
end
@ -54,4 +54,4 @@ module OpenGraphHelper
"#{root_url.chop}#{image_path('asterisk.png')}"
end
end
end
end

View file

@ -73,7 +73,7 @@ module PeopleHelper
# Rails.application.routes.url_helpers is needed since this is indirectly called from a model
def local_or_remote_person_path(person, opts={})
opts.merge!(:protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
opts.merge!(:protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
absolute = opts.delete(:absolute)
if person.local?

View file

@ -5,14 +5,14 @@
module PostsHelper
def post_page_title(post, opts={})
if post.is_a?(Photo)
I18n.t "posts.show.photos_by", :count => 1, :author => post.status_message.author.name
I18n.t "posts.show.photos_by", :count => 1, :author => post.status_message_author_name
elsif post.is_a?(Reshare)
I18n.t "posts.show.reshare_by", :author => post.author.name
I18n.t "posts.show.reshare_by", :author => post.author_name
else
if post.text.present?
truncate(post.text(:plain_text => true), :length => opts.fetch(:length, 20))
elsif post.respond_to?(:photos) && post.photos.present?
I18n.t "posts.show.photos_by", :count => post.photos.size, :author => post.author.name
I18n.t "posts.show.photos_by", :count => post.photos.size, :author => post.author_name
end
end
end
@ -20,7 +20,7 @@ module PostsHelper
def post_iframe_url(post_id, opts={})
opts[:width] ||= 516
opts[:height] ||= 315
host = AppConfig[:pod_uri].site
host = AppConfig.pod_uri.site
"<iframe src='#{Rails.application.routes.url_helpers.post_url(post_id, :host => host)}' width='#{opts[:width]}px' height='#{opts[:height]}px' frameBorder='0'></iframe>".html_safe
end
end

View file

@ -9,7 +9,7 @@ module SessionsHelper
end
def display_registration_link?
!AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
!AppConfig.settings.enable_registrations? && devise_mapping.registerable? && controller_name != 'registrations'
end
def display_password_reset_link?

View file

@ -1,5 +1,5 @@
class DiasporaDeviseMailer < Devise::Mailer
default :from => AppConfig[:smtp_sender_address]
default :from => AppConfig.mail.sender_address
def self.mailer_name
"devise/mailer"

View file

@ -3,13 +3,14 @@ module NotificationMailers
include ActionView::Helpers::TextHelper
attr_accessor :comment
delegate :post, to: :comment, prefix: true
def set_headers(comment_id)
@comment = Comment.find_by_id(comment_id)
if mail?
@headers[:from] = "\"#{@comment.author.name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:subject] = truncate(@comment.parent.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = truncate(@comment.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:subject] = "Re: #{@headers[:subject]}"
end
end

View file

@ -3,6 +3,10 @@ module NotificationMailers
class Base
attr_accessor :recipient, :sender
delegate :unconfirmed_email, :confirm_email_token,
:first_name, to: :recipient, prefix: true
delegate :first_name, :name, :sender, to: :sender, prefix: true
def initialize(recipient_id, sender_id=nil, *args)
@headers = {}
@ -29,12 +33,12 @@ module NotificationMailers
private
def default_headers
headers = {
:from => AppConfig[:smtp_sender_address],
:host => "#{AppConfig[:pod_uri]}",
:from => AppConfig.mail.sender_address.get,
:host => "#{AppConfig.pod_uri.host}",
:to => name_and_address(@recipient.name, @recipient.email)
}
headers[:from] = "\"#{@sender.name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>" if @sender.present?
headers[:from] = "\"#{@sender.name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>" if @sender.present?
headers
end

View file

@ -7,8 +7,8 @@ module NotificationMailers
def set_headers(comment_id)
@comment = Comment.find(comment_id)
@headers[:from] = "\"#{@comment.author.name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:subject] = truncate(@comment.parent.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = truncate(@comment.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:subject] = "Re: #{@headers[:subject]}"
end
end

View file

@ -1,7 +1,7 @@
module NotificationMailers
class ConfirmEmail < NotificationMailers::Base
def set_headers
@headers[:to] = name_and_address(@recipient.profile.first_name, @recipient.unconfirmed_email)
@headers[:to] = name_and_address(@recipient.first_name, @recipient.unconfirmed_email)
@headers[:subject] = I18n.t('notifier.confirm_email.subject', :unconfirmed_email => @recipient.unconfirmed_email)
end
end

View file

@ -1,6 +1,7 @@
module NotificationMailers
class Liked < NotificationMailers::Base
attr_accessor :like
delegate :target, to: :like, prefix: true
def set_headers(like_id)
@like = Like.find(like_id)
@ -8,4 +9,4 @@ module NotificationMailers
@headers[:subject] = I18n.t('notifier.liked.liked', :name => @sender.name)
end
end
end
end

View file

@ -1,6 +1,7 @@
module NotificationMailers
class Mentioned < NotificationMailers::Base
attr_accessor :post
delegate :author_name, to: :post, prefix: true
def set_headers(target_id)
@post = Mention.find_by_id(target_id).post
@ -8,4 +9,4 @@ module NotificationMailers
@headers[:subject] = I18n.t('notifier.mentioned.subject', :name => @sender.name)
end
end
end
end

View file

@ -7,7 +7,7 @@ module NotificationMailers
@conversation = @message.conversation
@participants = @conversation.participants
@headers[:from] = "\"#{@message.author.name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:from] = "\"#{@message.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = @conversation.subject.strip
@headers[:subject] = "Re: #{@headers[:subject]}" if @conversation.messages.size > 1
end

View file

@ -1,6 +1,8 @@
module NotificationMailers
class Reshared < NotificationMailers::Base
attr_accessor :reshare
delegate :root, to: :reshare, prefix: true
def set_headers(reshare_id)
@reshare = Reshare.find(reshare_id)
@ -8,4 +10,4 @@ module NotificationMailers
@headers[:subject] = I18n.t('notifier.reshared.reshared', :name => @sender.name)
end
end
end
end

View file

@ -24,8 +24,8 @@ class Notifier < ActionMailer::Base
end
default_opts = {:to => @receiver.email,
:from => AppConfig[:smtp_sender_address],
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host}
:from => AppConfig.mail.sender_address,
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig.pod_uri.host}
default_opts.merge!(opts)
@ -42,9 +42,9 @@ class Notifier < ActionMailer::Base
@locale = locale
@invitation_code = invitation_code
mail_opts = {:to => email, :from => AppConfig[:smtp_sender_address],
:subject => I18n.t('notifier.invited_you', :name => @inviter.person.name),
:host => AppConfig[:pod_uri].host}
mail_opts = {:to => email, :from => AppConfig.mail.sender_address,
:subject => I18n.t('notifier.invited_you', :name => @inviter.name),
:host => AppConfig.pod_uri.host}
I18n.with_locale(locale) do
mail(mail_opts) do |format|

View file

@ -1,193 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'uri'
require Rails.root.join('lib', 'environment_configuration')
class AppConfig < Settingslogic
def self.source_file_name
if ENV['application_yml'].present?
puts "using remote application.yml"
return ENV['application_yml']
end
config_file = Rails.root.join("config", "application.yml")
if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnvironmentConfiguration.heroku?)
config_file = Rails.root.join("config", "application.yml.example")
end
config_file
end
source source_file_name
namespace Rails.env
def self.load!
unless EnvironmentConfiguration.heroku?
if no_config_file? && !have_old_config_file?
$stderr.puts <<-HELP
******** You haven't set up your Diaspora settings file. **********
Please do the following:
1. Copy config/application.yml.example to config/application.yml.
2. Have a look at the settings in that file. It has sensible defaults for development, which (we hope)
work without modification. However, it's always good to know what's available to change later.
3. Restart Diaspora!
******** Thanks for being an alpha tester! **********
HELP
Process.exit(1)
end
if ((no_config_file? && have_old_config_file?) || config_file_is_old_style?)
$stderr.puts <<-HELP
******** The Diaspora configuration file format has changed. **********
Please do the following:
1. Copy config/application.yml.example to config/application.yml.
2. Make any changes in config/application.yml that you previously made in config/app.yml or config/app_config.yml.
3. Delete config/app.yml and config/app_config.yml. Don't worry if they don't exist, though.
4. Restart Diaspora!
******** Thanks for being an alpha tester! **********
HELP
Process.exit(1)
end
end
begin
super
rescue TypeError
puts "Couldn't find section ''#{self.namespace}' in config/application.yml."
puts "Double check it's there and that you haven't set RAILS_ENV to something weired (check it for typos)"
Process.exit(1)
end
if !EnvironmentConfiguration.heroku? && no_cert_file_in_prod?
$stderr.puts <<-HELP
******** Diaspora does not know where your SSL-CA-Certificates file is. **********
Please add the root certificate bundle (this is operating system specific) to application.yml. Defaults:
CentOS: '/etc/pki/tls/certs/ca-bundle.crt'
Debian: '/etc/ssl/certs/ca-certificates.crt'
Example:
ca_file: '/etc/ssl/certs/ca-certificates.crt'
******** Thanks for being secure! **********
HELP
Process.exit(1)
end
end
def self.setup!
normalize_pod_url
normalize_admins
normalize_pod_services
deprecate_hoptoad_api_key
end
def self.configured_services
self['configured_services'] || []
end
def self.config_file_is_old_style?
!(File.read(@source) =~ /^defaults: &defaults/)
end
def self.no_config_file?
!File.exists?(@source)
end
def self.no_cert_file_in_prod?
(Rails.env == "production") && (self[:ca_file].blank? || !File.exists?(self[:ca_file]))
end
def self.have_old_config_file?
File.exists?(Rails.root.join("config", "app.yml")) || (File.exists?(Rails.root.join("config", "app_config.yml")))
end
def self.new_relic_app_name
self[:new_relic_app_name] || self[:pod_uri].host
end
def self.normalize_pod_url
unless self[:pod_url] =~ /^(https?:\/\/)/ # starts with http:// or https://
self[:pod_url] = "http://#{self[:pod_url]}"
end
unless self[:pod_url] =~ /\/$/ # ends with slash
self[:pod_url] = "#{self[:pod_url]}/"
end
end
def self.bare_pod_uri
self[:pod_uri].authority.gsub('www.', '')
end
def self.normalize_admins
self[:admins] ||= []
self[:admins].collect! { |username| username.downcase }
end
def self.normalize_pod_services
self['configured_services'] = []
if defined?(SERVICES)
SERVICES.keys.each do |service|
unless SERVICES[service].keys.any?{|service_key| SERVICES[service][service_key].blank?}
self['configured_services'] << service
end
end
end
end
def deprecate_hoptoad_api_key
if self[:hoptoad_api_key].present?
$stderr.puts "WARNING: Please change hoptoad_api_key to airbrake_api_key in your application.yml"
self[:airbrake_api_key] = self[:hoptoad_api_key]
end
end
load!
def self.[] (key)
return self.pod_uri if key == :pod_uri
super
end
def self.[]= (key, value)
super
if key.to_sym == :pod_url
@@pod_uri = nil
normalize_pod_url
end
end
cattr_accessor :pod_uri
def self.pod_uri
if @@pod_uri.nil?
begin
@@pod_uri = Addressable::URI.parse(self[:pod_url])
rescue
puts "WARNING: pod url " + self[:pod_url] + " is not a legal URI"
end
end
return @@pod_uri
end
def self.single_process_mode?
(ENV['SINGLE_PROCESS'] == "true" || ENV['SINGLE_PROCESS_MODE'] == "true" || self[:single_process_mode]) ? true : false
end
def self.get_redis_instance
if ENV["REDISTOGO_URL"].present?
puts "WARNING: using the REDISTOGO_URL environment variable is deprecated, please use REDIS_URL now."
ENV['REDIS_URL'] = ENV["REDISTOGO_URL"]
end
redis_options = {}
if ENV['REDIS_URL'].present?
redis_options = { :url => ENV['REDIS_URL'] }
elsif ENV['RAILS_ENV']== 'integration2'
redis_options = { :host => 'localhost', :port => 6380 }
elsif self[:redis_url].present?
puts "WARNING: You're redis_url doesn't start with redis://" unless self[:redis_url].start_with?("redis://")
redis_options = { :url => self[:redis_url] }
end
Redis.new(redis_options.merge(:thread_safe => true))
end
end

View file

@ -2,6 +2,8 @@ class Block < ActiveRecord::Base
belongs_to :person
belongs_to :user
delegate :name, to: :person, prefix: true
validates :user_id, :presence => true
validates :person_id, :presence => true, :uniqueness => { :scope => :user_id }
@ -12,4 +14,4 @@ class Block < ActiveRecord::Base
errors[:person_id] << "stop blocking yourself!"
end
end
end
end

View file

@ -22,6 +22,10 @@ class Comment < ActiveRecord::Base
belongs_to :commentable, :touch => true, :polymorphic => true
alias_attribute :post, :commentable
belongs_to :author, :class_name => 'Person'
delegate :name, to: :author, prefix: true
delegate :comment_email_subject, to: :parent
delegate :author_name, to: :parent, prefix: true
validates :text, :presence => true, :length => {:maximum => 65535}
validates :parent, :presence => true #should be in relayable (pending on fixing Message)

View file

@ -7,6 +7,9 @@ class Contact < ActiveRecord::Base
belongs_to :person
validates :person, :presence => true
delegate :name, :diaspora_handle, :guid, :first_name,
to: :person, prefix: true
has_many :aspect_memberships
has_many :aspects, :through => :aspect_memberships
@ -72,7 +75,7 @@ class Contact < ActiveRecord::Base
incoming_aspects = Aspect.where(
:user_id => self.person.owner_id,
:contacts_visible => true).joins(:contacts).where(
:contacts => {:person_id => self.user.person.id}).select('aspects.id')
:contacts => {:person_id => self.user.person_id}).select('aspects.id')
incoming_aspect_ids = incoming_aspects.map{|a| a.id}
similar_contacts = Person.joins(:contacts => :aspect_memberships).where(
:aspect_memberships => {:aspect_id => incoming_aspect_ids}).where(people[:id].not_eq(self.user.person.id)).select('DISTINCT people.*')

View file

@ -5,6 +5,8 @@ class InvitationCode < ActiveRecord::Base
before_create :generate_token, :set_default_invite_count
delegate :name, to: :user, prefix: true
def to_param
token
end
@ -28,14 +30,14 @@ class InvitationCode < ActiveRecord::Base
end
def self.default_inviter_or(user)
if AppConfig[:admin_account].present?
inviter = User.find_by_username(AppConfig[:admin_account])
if AppConfig.admins.account.present?
inviter = User.find_by_username(AppConfig.admins.account.get)
end
inviter ||= user
inviter
end
def set_default_invite_count
self.count = AppConfig[:invite_count] || 25
self.count = AppConfig['settings.invitations.count'] || 25
end
end

View file

@ -9,7 +9,7 @@ module Jobs
def self.perform(sender_public_url)
require Rails.root.join('lib', 'pubsubhubbub')
atom_url = sender_public_url + '.atom'
Pubsubhubbub.new(AppConfig[:pubsub_server]).publish(atom_url)
Pubsubhubbub.new(AppConfig.environment.pubsub_server.get).publish(atom_url)
end
end
end

View file

@ -11,6 +11,8 @@ class Message < ActiveRecord::Base
belongs_to :author, :class_name => 'Person'
belongs_to :conversation, :touch => true
delegate :name, to: :author, prefix: true
validates :text, :presence => true
validate :participant_of_parent_conversation

View file

@ -32,7 +32,9 @@ class Person < ActiveRecord::Base
xml_attr :exported_key
has_one :profile, :dependent => :destroy
delegate :last_name, :image_url, :to => :profile
delegate :last_name, :image_url, :tag_string, :bio, :location,
:gender, :birthday, :formatted_birthday, :tags, :searchable,
to: :profile
accepts_nested_attributes_for :profile
before_validation :downcase_diaspora_handle

View file

@ -41,6 +41,7 @@ class Photo < ActiveRecord::Base
belongs_to :status_message, :foreign_key => :status_message_guid, :primary_key => :guid
validates_associated :status_message
delegate :author_name, to: :status_message, prefix: true
attr_accessible :text, :pending
validate :ownership_of_status_message
@ -98,9 +99,7 @@ class Photo < ActiveRecord::Base
def update_remote_path
unless self.unprocessed_image.url.match(/^https?:\/\//)
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
remote_path = "#{pod_url}#{self.unprocessed_image.url}"
remote_path = "#{AppConfig.pod_uri.to_s.chomp("/")}#{self.unprocessed_image.url}"
else
remote_path = self.unprocessed_image.url
end

View file

@ -185,8 +185,6 @@ class Profile < ActiveRecord::Base
end
def absolutify_local_url url
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
"#{pod_url}#{url}"
"#{AppConfig.pod_uri.to_s.chomp("/")}#{url}"
end
end

View file

@ -9,6 +9,7 @@ class Reshare < Post
attr_accessible :root_guid, :public
validates_presence_of :root, :on => :create
validates_uniqueness_of :root_guid, :scope => :author_id
delegate :author, to: :root, prefix: true
xml_attr :root_diaspora_id
xml_attr :root_guid
@ -58,7 +59,7 @@ class Reshare < Post
end
def comment_email_subject
I18n.t('reshares.comment_email_subject', :resharer => author.name, :author => root.author.name)
I18n.t('reshares.comment_email_subject', :resharer => author.name, :author => root.author_name)
end
def notification_type(user, person)

View file

@ -13,20 +13,4 @@ class Role < ActiveRecord::Base
def self.add_spotlight(person)
find_or_create_by_person_id_and_name(person.id, 'spotlight')
end
def self.load_admins
admins = AppConfig[:admins] || []
admins.each do |username|
u = User.find_by_username(username)
find_or_create_by_person_id_and_name(u.person.id, 'admin')
end
end
def self.load_spotlight
spotlighters = AppConfig[:community_spotlight] || []
spotlighters.each do |diaspora_handle|
person = Person.find_by_diaspora_handle(diaspora_handle)
find_or_create_by_person_id_and_name(person.id, 'spotlight')
end
end
end

View file

@ -14,7 +14,7 @@ class Service < ActiveRecord::Base
def public_message(post, length, url = "")
Rails.logger.info("Posting out to #{self.class}")
url = Rails.application.routes.url_helpers.short_post_url(post, :protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
url = Rails.application.routes.url_helpers.short_post_url(post, :protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
space_for_url = 21 + 1
truncated = truncate(post.text(:plain_text => true), :length => (length - space_for_url))
truncated = "#{truncated} #{url}"

View file

@ -23,7 +23,7 @@ class Services::Facebook < Service
end
def create_open_graph_params(post)
{:post => "#{AppConfig[:pod_url]}#{short_post_path(post)}", :access_token => self.access_token}
{:post => "#{AppConfig.pod_uri.to_s}#{short_post_path(post)}", :access_token => self.access_token}
end
def create_post_params(post)
@ -38,4 +38,4 @@ class Services::Facebook < Service
def profile_photo_url
"https://graph.facebook.com/#{self.uid}/picture?type=large&access_token=#{URI.escape(self.access_token)}"
end
end
end

View file

@ -9,11 +9,11 @@ class Services::Tumblr < Service
end
def consumer_key
SERVICES['tumblr']['consumer_key']
AppConfig.services.tumblr.key
end
def consumer_secret
SERVICES['tumblr']['consumer_secret']
AppConfig.services.tumblr.secret
end
def post(post, url='')

View file

@ -35,8 +35,8 @@ class Services::Twitter < Service
private
def configure_twitter
twitter_key = SERVICES['twitter']['consumer_key']
twitter_consumer_secret = SERVICES['twitter']['consumer_secret']
twitter_key = AppConfig.services.twitter.key
twitter_consumer_secret = AppConfig.services.twitter.secret
if twitter_key.blank? || twitter_consumer_secret.blank?
Rails.logger.info "you have a blank twitter key or secret.... you should look into that"

View file

@ -146,6 +146,10 @@ class StatusMessage < Post
formatted_message(:plain_text => true)
end
def first_photo_url(*args)
photos.first.url(*args)
end
def text_and_photos_blank?
self.text.blank? && self.photos.blank?
end

View file

@ -11,6 +11,11 @@ class User < ActiveRecord::Base
include Querying
include SocialActions
scope :logged_in_since, lambda { |time| where('last_sign_in_at > ?', time) }
scope :monthly_actives, lambda { |time = Time.now| logged_in_since(time - 1.month) }
scope :daily_actives, lambda { |time = Time.now| logged_in_since(time - 1.day) }
scope :yearly_actives, lambda { |time = Time.now| logged_in_since(time - 1.year) }
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:timeoutable, :token_authenticatable, :lockable,
@ -33,7 +38,10 @@ class User < ActiveRecord::Base
serialize :hidden_shareables, Hash
has_one :person, :foreign_key => :owner_id
delegate :guid, :public_key, :posts, :photos, :owns?, :diaspora_handle, :name, :public_url, :profile, :first_name, :last_name, :participations, :to => :person
delegate :guid, :public_key, :posts, :photos, :owns?, :image_url,
:diaspora_handle, :name, :public_url, :profile, :url,
:first_name, :last_name, :gender, :participations, to: :person
delegate :id, :guid, to: :person, prefix: true
has_many :invitations_from_me, :class_name => 'Invitation', :foreign_key => :sender_id
has_many :invitations_to_me, :class_name => 'Invitation', :foreign_key => :recipient_id
@ -82,22 +90,6 @@ class User < ActiveRecord::Base
User.joins(:contacts).where(:contacts => {:person_id => person.id})
end
def self.monthly_actives(start_day = Time.now)
logged_in_since(start_day - 1.month)
end
def self.yearly_actives(start_day = Time.now)
logged_in_since(start_day - 1.year)
end
def self.daily_actives(start_day = Time.now)
logged_in_since(start_day - 1.day)
end
def self.logged_in_since(time)
where('last_sign_in_at > ?', time)
end
def unread_notifications
notifications.where(:unread => true)
end
@ -372,7 +364,7 @@ class User < ActiveRecord::Base
params[:image_url_small] = photo.url(:thumb_small)
end
if self.person.profile.update_attributes(params)
if self.profile.update_attributes(params)
Postzord::Dispatcher.build(self, profile).post
true
else
@ -403,7 +395,7 @@ class User < ActiveRecord::Base
end
def set_person(person)
person.url = AppConfig[:pod_url]
person.url = AppConfig.pod_uri.to_s
person.diaspora_handle = "#{self.username}#{User.diaspora_id_host}"
self.person = person
end
@ -418,7 +410,7 @@ class User < ActiveRecord::Base
self.aspects.create(:name => I18n.t('aspects.seed.work'))
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances'))
unless AppConfig[:no_follow_diasporahq]
unless AppConfig.settings.follow_diasporahq
default_account = Webfinger.new('diasporahq@joindiaspora.com').fetch
self.share_with(default_account, aq) if default_account
end

View file

@ -15,7 +15,7 @@ class OEmbedPresenter
def as_json(opts={})
{
:provider_name => "Diaspora",
:provider_url => AppConfig[:pod_url],
:provider_url => AppConfig.pod_uri.to_s,
:type => 'rich',
:version => '1.0',
:title => post_title,
@ -36,14 +36,14 @@ class OEmbedPresenter
end
def post_author
@post.author.name
@post.author_name
end
def post_author_url
Rails.application.routes.url_helpers.person_url(@post.author, :host => AppConfig[:pod_uri].host)
Rails.application.routes.url_helpers.person_url(@post.author, :host => AppConfig.pod_uri.host)
end
def iframe_html
post_iframe_url(@post.id, :height => @opts[:maxheight], :width => @opts[:maxwidth])
end
end
end

View file

@ -12,9 +12,9 @@ class PersonPresenter
if is_own_profile || person_is_following_current_user
attrs.merge!({
:location => @person.profile.location,
:birthday => @person.profile.formatted_birthday,
:bio => @person.profile.bio
:location => @person.location,
:birthday => @person.formatted_birthday,
:bio => @person.bio
})
end
@ -30,4 +30,4 @@ class PersonPresenter
def person_is_following_current_user
@person.shares_with(@current_user)
end
end
end

View file

@ -55,7 +55,7 @@ class PostPresenter
end
def title
@post.text.present? ? @post.text(:plain_text => true) : I18n.translate('posts.presenter.title', :name => @post.author.name)
@post.text.present? ? @post.text(:plain_text => true) : I18n.translate('posts.presenter.title', :name => @post.author_name)
end
def template_name #kill me, lol, I should be client side

View file

@ -6,6 +6,6 @@
%li= link_to t('.weekly_user_stats'), weekly_user_stats_path
%li= link_to t('.pod_stats'), pod_stats_path
%li= link_to t('.correlations'), correlations_path
- if AppConfig[:mount_resque_web]
- if AppConfig.admins.inline_resque_web?
%li= link_to t('.resque_overview'), resque_web_path

View file

@ -4,7 +4,7 @@
= person.name
.tags
- person.profile.tags.each do |tag|
- person.tags.each do |tag|
= link_to "##{tag}", tag_path(:name => tag.name)
.add_user_to_aspect

View file

@ -29,7 +29,7 @@
- if @contacts.size > 0
- for contact in @contacts
.stream_element{:id => contact.person.id}
.stream_element{:id => contact.person_id}
.float-right
= contact_aspect_dropdown(contact)
@ -41,7 +41,7 @@
.bd
= person_link(contact.person)
.info
= contact.person.diaspora_handle
= contact.person_diaspora_handle
= will_paginate @contacts
- else

View file

@ -18,9 +18,9 @@
%li{:data=>{:contact_id=>contact.id}}
= person_image_tag contact.person
%h4.name
= link_to contact.person.name, contact.person
= link_to contact.person_name, contact.person
.description
= contact.person.diaspora_handle
= contact.person_diaspora_handle
.right
= aspect_membership_dropdown(contact, contact.person, 'right')

View file

@ -16,9 +16,9 @@
.span-18.last{:style => "position:relative;"}
- if AppConfig[:spotlight_suggest_email].present?
- if AppConfig.settings.community_spotlight.suggest_email.present?
.right
= link_to "Suggest a member", "mailto:#{AppConfig[:spotlight_suggest_email]}", :class => "button"
= link_to "Suggest a member", "mailto:#{AppConfig.settings.community_spotlight.suggest_email}", :class => "button"
%h3
= t('contacts.spotlight.community_spotlight')

View file

@ -1,7 +1,7 @@
- if controller_name != 'sessions'
= link_to t('.sign_in'), new_session_path(resource_name)
%br/
- if !AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
- if AppConfig.settings.enable_registrations? && devise_mapping.registerable? && controller_name != 'registrations'
= link_to t('.sign_up'), new_registration_path(resource_name)
%br/
- else

View file

@ -6,7 +6,6 @@
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
%head
%meta{:charset => 'utf-8'}
%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
%meta{:name => "description", :content => "Diaspora*"}

View file

@ -6,7 +6,6 @@
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
%head
%meta{:charset => 'utf-8'}
%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
= csrf_meta_tag

View file

@ -28,7 +28,7 @@
<table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:14px;color:#333;">
<tr>
<td style="text-align:center;padding:30px;">
<img src="<%=AppConfig[:pod_url]%>assets/branding/logo_caps.png" alt="DIASPORA*" width="95px" height="14px"/>
<img src="<%=AppConfig.pod_uri.to_s %>assets/branding/logo_caps.png" alt="DIASPORA*" width="95px" height="14px"/>
</td>
</tr>
</table>

View file

@ -6,7 +6,6 @@
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
%head
%meta{:charset => 'utf-8'}
%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
%meta{:name => "description", :content => "Diaspora*"}

View file

@ -1,5 +1,5 @@
.notification_element{:data=>{:guid => n.id},:class => (n.unread ? "unread" : "read")}
%img{:src => n.actors.first.profile.image_url(:thumb_medium)}
%img{:src => n.actors.first.image_url(:thumb_medium)}
= notification_message_for(n)
%br/
%abbr.timeago{:title=>n.created_at.iso8601}

View file

@ -1,5 +1,5 @@
<%= comment_message(@notification.comment, :process_newlines => true) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment.post.author.first_name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment_post.author_first_name) %>][1]
[1]: <%= post_url(@notification.comment.post) %>
[1]: <%= post_url(@notification.comment_post) %>

View file

@ -1,5 +1,5 @@
<%= comment_message(@notification.comment, :process_newlines => true) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment.post.author.name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment.parent_author_name) %>][1]
[1]: <%= post_url(@notification.comment.post) %>

View file

@ -1,5 +1,5 @@
<%= t('notifier.hello', :name => @notification.recipient.profile.first_name) %>
<%= t('notifier.hello', :name => @notification.recipient_first_name) %>
<%= t('notifier.confirm_email.click_link', :unconfirmed_email => @notification.recipient.unconfirmed_email) %>
<%= t('notifier.confirm_email.click_link', :unconfirmed_email => @notification.recipient_unconfirmed_email) %>
<<%= confirm_email_url(:token => @notification.recipient.confirm_email_token) %>>
<<%= confirm_email_url(:token => @notification.recipient_confirm_email_token) %>>

View file

@ -1,7 +1,7 @@
<%= "#{t('.liked', :name => "#{@notification.sender.name}")}:" %>
<%= "#{t('.liked', :name => "#{@notification.sender_name}")}:" %>
<%= post_message(@notification.like.target, :process_newlines => true) %>
<%= post_message(@notification.like_target, :process_newlines => true) %>
[<%= t('.view_post') %>][1]
[1]: <%= post_url(@notification.like.target) %>
[1]: <%= post_url(@notification.like_target) %>

View file

@ -1,5 +1,5 @@
<%= post_message(@notification.post, :process_newlines => true, :length => 600) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.post.author.name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.post_author_name) %>][1]
[1]: <%= post_url(@notification.post) %>

View file

@ -1,6 +1,6 @@
<%= "#{t('.reshared', :name => "#{@notification.sender.name}")}:" %>
<%= "#{t('.reshared', :name => "#{@notification.sender_name}")}:" %>
<%= post_message(@notification.reshare.root, :process_newlines => true) %>
<%= post_message(@notification.reshare_root, :process_newlines => true) %>
[<%= t('.view_post') %>][1]

View file

@ -1,5 +1,5 @@
<%= @notification.sender.name %> <%= t('.sharing') %>
<%= @notification.sender_name %> <%= t('.sharing') %>
[<%= t('.view_profile', :name => @notification.sender.first_name) %>][1]
[<%= t('.view_profile', :name => @notification.sender_first_name) %>][1]
[1]: <%= local_or_remote_person_path(@notification.sender, :absolute => true) %>

View file

@ -17,30 +17,30 @@
%br
-if contact.sharing? || person == current_user.person
%ul#profile_information
- unless person.profile.bio.blank?
- unless person.bio.blank?
%li
%h4
=t('.bio')
%div{ :class => direction_for(person.profile.bio) }
%div{ :class => direction_for(person.bio) }
= markdownify(person.profile.bio, :oembed => true, :newlines => true)
- unless person.profile.location.blank?
%li
%h4
=t('.location')
%div{ :class => direction_for(person.profile.location) }
= markdownify(person.profile.location, :oembed => true, :newlines => true)
%div{ :class => direction_for(person.location) }
= markdownify(person.location, :oembed => true, :newlines => true)
%li
- unless person.profile.gender.blank?
- unless person.gender.blank?
%h4
=t('.gender')
= person.profile.gender
= person.gender
%li
- unless person.profile.birthday.blank?
- unless person.birthday.blank?
%h4
=t('.born')
= birthday_format(person.profile.birthday)
= birthday_format(person.birthday)
%br
%br

View file

@ -18,7 +18,7 @@
= last_post_link person
.description
- if !person.profile.tag_string.blank? && user_signed_in?
- if !person.tag_string.blank? && user_signed_in?
= Diaspora::Taggable.format_tags(person.profile.tag_string)
- if user_signed_in? && person == current_user.person
%span.hover_edit

View file

@ -29,7 +29,7 @@
$('#file-upload').addClass("loading");
$('#publisher').find("input[type='submit']").attr('disabled','disabled');
Publisher.wrapper().addClass("with_attachments");
app.publisher.el_wrapper.addClass("with_attachments");
$('#photodropzone').append(
"<li class='publisher_photo loading' style='position:relative;'>" +
"#{escape_javascript(image_tag('ajax-loader2.gif'))}" +
@ -43,7 +43,7 @@
url = responseJSON.data.photo.unprocessed_image.url,
currentPlaceholder = $('li.loading').first();
Publisher.wrapper().addClass("with_attachments");
app.publisher.el_wrapper.addClass("with_attachments");
$('#new_status_message').append("<input type='hidden' value='" + id + "' name='photos[]' />");
// replace image placeholders
@ -70,7 +70,7 @@
photo.fadeOut(400, function(){
photo.remove();
if ( $('.publisher_photo').length == 0){
Publisher.wrapper().removeClass("with_attachments");
app.publisher.el_wrapper.removeClass("with_attachments");
}
});
}

View file

@ -10,5 +10,5 @@
%p.photo_description
= post.text
= link_to t('.view_all', :name => post.author.name), person_photos_path(post.author), :class => "small_text"
= link_to t('.view_all', :name => post.author_name), person_photos_path(post.author), :class => "small_text"

View file

@ -9,7 +9,7 @@
= person_image_link(post.author)
.from
%h2
= post.author.name
= post.author_name
#show_photo{:data=>{:guid=>post.id}}
= image_tag post.url(:scaled_full)

View file

@ -17,7 +17,7 @@
%dl.entity_family_name
%dt Family name
%dd
%span.family_name= @person.profile.last_name
%span.family_name= @person.last_name
%dl.entity_fn
%dt Full name
@ -32,19 +32,19 @@
%dl.entity_photo
%dt Photo
%dd
%img.photo.avatar{:src=>@person.profile.image_url, :width=>'300px', :height=>'300px'}
%img.photo.avatar{:src=>@person.image_url, :width=>'300px', :height=>'300px'}
%dl.entity_photo_medium
%dt Photo
%dd
%img.photo.avatar{:src=>@person.profile.image_url(:thumb_medium), :width=>'100px', :height=>'100px'}
%img.photo.avatar{:src=>@person.image_url(:thumb_medium), :width=>'100px', :height=>'100px'}
%dl.entity_photo_small
%dt Photo
%dd
%img.photo.avatar{:src=>@person.profile.image_url(:thumb_small), :width=>'50px', :height=>'50px'}
%img.photo.avatar{:src=>@person.image_url(:thumb_small), :width=>'50px', :height=>'50px'}
%dl.entity_searchable
%dt Searchable
%dd
%span.searchable= @person.profile.searchable
%span.searchable= @person.searchable

View file

@ -5,6 +5,6 @@
<Link rel='lrdd'
type='application/xrd+xml'
template='<%= AppConfig[:pod_url] %>webfinger?q={uri}' />
template='<%= AppConfig.pod_uri.to_s %>webfinger?q={uri}' />
</XRD>

View file

@ -1,10 +1,10 @@
<% content_for :page_title do %>
<%= "#{AppConfig[:pod_name]} / #{t('devise.sessions.new.sign_in')}" %>
<%= "#{AppConfig.settings.pod_name} / #{t('devise.sessions.new.sign_in')}" %>
<% end %>
<div id="login">
<h1 id="huge-text">
<%= AppConfig[:pod_name] %>
<%= AppConfig.settings.pod_name %>
</h1>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "form-horizontal block-form"}, :autocomplete => 'off') do |f| %>

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