diff --git a/app/models/user.rb b/app/models/user.rb index c7184d3ec..0ec6c0764 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,7 +16,7 @@ class User < ActiveRecord::Base :timeoutable, :token_authenticatable before_validation :strip_and_downcase_username - before_validation :set_current_language, :post => :create + before_validation :set_current_language, :on => :create validates_presence_of :username validates_uniqueness_of :username diff --git a/app/views/shared/_add_remove_services.haml b/app/views/shared/_add_remove_services.haml index 741cbf1dc..c2d2aba66 100644 --- a/app/views/shared/_add_remove_services.haml +++ b/app/views/shared/_add_remove_services.haml @@ -12,10 +12,10 @@ = link_to t('services.index.disconnect'), service_path(service), :confirm => t('services.index.really_disconnect', :service => service.provider), :method => :delete - unless @services.any?{|x| x.provider == 'twitter'} - %h4= link_to t('services.index.connect_to_twitter'), "/auth/twitter" if SERVICES['twitter']['consumer_key']!= "" + %h4= link_to t('services.index.connect_to_twitter'), "/auth/twitter" if SERVICES['twitter'] && SERVICES['twitter']['consumer_key']!= "" - unless @services.any?{|x| x.provider == 'facebook'} - %h4= link_to t('services.index.connect_to_facebook'), "/auth/facebook" if SERVICES['facebook']['app_id'] !="" + %h4= link_to t('services.index.connect_to_facebook'), "/auth/facebook" if SERVICES['facebook'] && SERVICES['facebook']['app_id'] !="" - unless @services.any?{|x| x.provider == 'tumblr'} - %h4= link_to t('services.index.connect_to_tumblr'), "/auth/tumblr" if SERVICES['tumblr']['consumer_key'] !="" + %h4= link_to t('services.index.connect_to_tumblr'), "/auth/tumblr" if SERVICES['tumblr'] && SERVICES['tumblr']['consumer_key'] !="" diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 1cde0788c..9a9579235 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,10 +1,15 @@ -# Copyright (c) 2010, Diaspora Inc. This file is +# Copyright (c) 2011, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. Rails.application.config.middleware.use OmniAuth::Builder do - provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret'] - provider :tumblr, SERVICES['tumblr']['consumer_key'], SERVICES['tumblr']['consumer_secret'] - provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], :scope => "publish_stream,email,offline_access" -end - + if SERVICES['twitter'] && SERVICES['twitter']['consumer_key'] && SERVICES['twitter']['consumer_secret'] + provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret'] + end + if SERVICES['tumblr'] && SERVICES['tumblr']['consumer_key'] && SERVICES['tumblr']['consumer_secret'] + provider :tumblr, SERVICES['tumblr']['consumer_key'], SERVICES['tumblr']['consumer_secret'] + end + if SERVICES['facebook'] && SERVICES['facebook']['app_id'] && SERVICES['facebook']['app_secret'] + provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], :scope => "publish_stream,email,offline_access" + end +end diff --git a/config/routes.rb b/config/routes.rb index 76be54cba..5e21f0b2d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -# Copyright (c) 2010, Diaspora Inc. This file is +# Copyright (c) 2011, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. @@ -87,12 +87,15 @@ Diaspora::Application.routes.draw do resources :aspect_memberships, :only => [:destroy, :create, :update] resources :post_visibilities, :only => [:update] - get 'people/tag_index' => 'people#tag_index' + resources :people, :except => [:edit, :update] do resources :status_messages resources :photos get :contacts - post 'by_handle' => :retrieve_remote, :on => :collection, :as => 'person_by_handle' + collection do + post 'by_handle' => :retrieve_remote, :as => 'person_by_handle' + get :tag_index + end end