diff --git a/.travis.yml b/.travis.yml index 6fc098476..0d48e2242 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ before_script: - "rake db:create" - "rake db:schema:load" - "rspec spec --tag fixture" - script: "bundle exec rake travis" env: "TRAVIS=true" +notifications: + disable: true diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 1286e85c1..2f4317195 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -38,7 +38,7 @@ class AspectsController < ApplicationController :type => ['StatusMessage','ActivityStreams::Photo'], :order => session[:sort_order] + ' DESC', :max_time => params[:max_time].to_i - ).includes(:comments, :mentions, :likes) + ).includes(:likes, {:comments => {:author => :profile}}, {:mentions => {:person => :profile}}) @posts = PostsFake.new(posts) if params[:only_posts] diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index f50f0bbf8..555f26246 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,9 +1,4 @@ class TokensController < ApplicationController - def create - current_user.reset_authentication_token! - current_user.authentication_token - redirect_to token_path, :notice => "Authentication token reset." - end def show end end diff --git a/app/models/app_config.rb b/app/models/app_config.rb index f874d340d..573b63567 100644 --- a/app/models/app_config.rb +++ b/app/models/app_config.rb @@ -60,6 +60,7 @@ HELP normalize_pod_url normalize_admins + normalize_pod_services end def self.config_file_is_old_style? @@ -92,6 +93,18 @@ HELP self[:admins].collect! { |username| username.downcase } end + def self.normalize_pod_services + if defined?(SERVICES) + connected_services = [] + SERVICES.keys.each do |service| + unless SERVICES[service].keys.any?{|service_key| SERVICES[service][service_key].blank?} + connected_services << service + end + end + self['configured_services'] = connected_services + end + end + load! def self.[] (key) diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 85ded3816..0df73cd20 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -54,6 +54,18 @@ = t('.cubbies.explanation') = link_to t('.cubbies.learn_more'), token_path + .section + .title + = image_tag('/images/icons/monotone_wrench_settings.png') + %h5 + = t('.services.heading') + .content + = t('.services.content') + - AppConfig.configured_services.each do |service| + - unless current_user.services.any?{|x| x.provider == service} + %br= link_to service.titleize, "/auth/#{service}" + + - if @invites > 0 .section .title diff --git a/app/views/shared/_add_remove_services.haml b/app/views/shared/_add_remove_services.haml index 10e98a1d8..68fef5351 100644 --- a/app/views/shared/_add_remove_services.haml +++ b/app/views/shared/_add_remove_services.haml @@ -12,13 +12,8 @@ %b= service.nickname = link_to t('services.index.disconnect'), service_path(service), :confirm => t('services.index.really_disconnect', :service => service.provider), :method => :delete - else - You haven't connected any services yet. + = t('.no_services') -- unless @services.any?{|x| x.provider == 'twitter'} - %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'] && 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'] && SERVICES['tumblr']['consumer_key'] !="" +- AppConfig.configured_services.each do |service| + - unless @services.any?{|x| x.provider == service} + %h4= link_to t("services.index.connect_to_#{service}"), "/auth/#{service}" diff --git a/app/views/tokens/show.html.haml b/app/views/tokens/show.html.haml index c3070fae6..7add09dca 100644 --- a/app/views/tokens/show.html.haml +++ b/app/views/tokens/show.html.haml @@ -13,55 +13,33 @@ %hr -.span-24{:style => "text-align:center;"} - = image_tag '/images/cubbies_screenshot.png', :width => 600, :height => 452 +.cubbies_infographic.span-24{:style => "text-align:left;position:relative;"} + = image_tag '/images/cubbies_screenshot2.png', :height => 452, :class => "cubbies_screenshot" + = image_tag '/images/cubbies_collage.png', :class => "cubbies_collage" -.span-18.prepend-3.append-3.last{:style => "text-align:center;"} +.span-24.last{:style => "text-align:right;"} %p.subtle != t('.screenshot_explanation', :link1 => link_to(t('.typical_userpage'), "http://cubbi.es/daniel"), :link2 => link_to(t('.daniels_account'), "https://joindiaspora.com/people/29")) + %br %hr -/%p.subtle -/ Cubbi.es allows you to collect images from all across the internet and keep them in one place (your cubby) in a simple and intuative way. Hooking up your Diaspora account with Cubbi.es means the images you collect will automatically be shared on Diaspora.* - %br .span-24.last %h2 = t('.making_the_connection') %br - %br -.span-20.append-2.prepend-2.last - .span-8 - = image_tag '/images/cubbies_settings.png', :width => 238, :height => 248, :class => "cubbies-settings-image" +.span-24.last + .span-10 + = image_tag '/images/connect_services.png', :class => "cubbies-settings-image" %div.subtle != t('.via', :link => link_to('http://cubbi.es/users/edit', 'http://cubbi.es/users/edit')) + .span-12.last %h3 - = t('.connecting_is_simple') + != t('.connecting_is_simple', :diaspora_id => current_user.diaspora_handle, :href_link => 'http://cubbi.es/users/edit') %p.subtle - = t('.were_working_hard') - - %br - - .span-11.cubbies-credentials - .span-4 - %h5 - = t('.your_diaspora_handle') - .span-6 - %h2 - = current_user.diaspora_handle - .span-4 - %h5 - = t('.your_diaspora_token') - - .span-6 - - if current_user.authentication_token - %h2 - = current_user.authentication_token - - else - = form_tag(token_path) do - = submit_tag t('.generate_a_token') + = t('.log_in_with_diaspora_is_comming') diff --git a/config/initializers/_load_services.rb b/config/initializers/_before_load_services.rb similarity index 100% rename from config/initializers/_load_services.rb rename to config/initializers/_before_load_services.rb diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index b8b5076e9..57586a2df 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -143,7 +143,7 @@ en: seed: family: "Family" work: "Work" - index: + index: your_aspects: "Your Aspects" handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you." no_contacts: "No contacts" @@ -157,7 +157,9 @@ en: heading: "Diaspora ID" content_1: "Your Diaspora ID is:" content_2: "Give it to anyone and they'll be able to find you on Diaspora." - + services: + heading: "Connect Services" + content: "You can connect the following services to Diaspora:" aspect_memberships: destroy: success: "Successfully removed person from aspect" @@ -589,6 +591,7 @@ en: connect_to_facebook: "Connect to Facebook" connect_to_tumblr: "Connect to Tumblr" edit_services: "Edit services" + no_services: 'You have not connected any services yet.' create: success: "Authentication successful." destroy: @@ -701,11 +704,8 @@ en: typical_userpage: "A typical cubbi.es userpage" daniels_account: "Daniel's Diaspora account" making_the_connection: "Making the Connection" - connecting_is_simple: "Connecting your Diaspora account is as simple as filling out two fields on your Cubbi.es account page." - were_working_hard: "We're working hard on delivering easy connectivity between Diaspora pods and applications. In the meantime, connecting you Diaspora account with Cubbi.es means copying and pasting two fields." - your_diaspora_handle: "Your Diaspora ID:" - your_diaspora_token: "Your Diaspora Token:" - generate_a_token: "Generate a token" + connecting_is_simple: "Connecting your Diaspora account is simple! Just enter your Diaspora ID (%{diaspora_id}) from your cubbies settings page and hit connect." + log_in_with_diaspora_is_comming: "Pretty soon, you'll be able to connect to a new application without creating an account separate from your one on Diaspora." via: "(via %{link})" authorizations: diff --git a/config/routes.rb b/config/routes.rb index f6726bbfb..d3895c5b9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -69,7 +69,7 @@ Diaspora::Application.routes.draw do #Temporary token_authenticable route - resource :token, :only => [:show, :create] + resource :token, :only => :show get 'login' => redirect('/users/sign_in') diff --git a/features/connects_users.feature b/features/connects_users.feature index 89d421562..0ae7c99bf 100644 --- a/features/connects_users.feature +++ b/features/connects_users.feature @@ -97,7 +97,7 @@ Feature: sending and receiving requests When I sign in as "alice@alice.alice" And I am on "bob@bob.bob"'s page - Then I should not see /^In \d aspects?$/ + Then I should see "Add to aspect" Then I should not see "Mention" Then I should not see "Message" diff --git a/features/notifications.feature b/features/notifications.feature index 0d8743961..ad63a9754 100644 --- a/features/notifications.feature +++ b/features/notifications.feature @@ -23,7 +23,7 @@ Background: Then I should see "started sharing with you" Scenario: notification popup - #When I sign in as "alice@alice.alice" - #And I click the notification badge - #And I wait for the ajax to finish - #Then the notification dropdown should be visible + When I sign in as "alice@alice.alice" + And I click the notification badge + And I wait for the ajax to finish + Then the notification dropdown should be visible diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 9856a7d26..c61534ed3 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -151,14 +151,6 @@ When /^I search for "([^\"]*)"$/ do |search_term| JS end -Then /^I should( not)? see the contact dialog$/ do |not_see| - if not_see - wait_until { !page.find("#facebox").visible? } - else - wait_until { page.find("#facebox .share_with") && page.find("#facebox .share_with").visible? } - end -end - Then /^I should( not)? see an add contact button$/ do |not_see| expected_length = not_see ? 0 : 1 evaluate_script("$('.add_contact a').length == #{expected_length};") @@ -182,7 +174,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)" end Then /^I should see (\d+) posts$/ do |n_posts| - evaluate_script("$('#main_stream .stream_element').length").should == n_posts.to_i + all("#main_stream .stream_element").length.should == n_posts.to_i end And /^I scroll down$/ do @@ -196,9 +188,9 @@ When /^I wait for (\d+) seconds$/ do |seconds| end When /^I click the notification badge$/ do - evaluate_script("$('#notification_badge a').click();"); + find(:css, "#notification_badge a").click end Then /^the notification dropdown should be visible$/ do - evaluate_script("$('#notification_dropdown').css('display') === 'block'") + find(:css, "#notification_dropdown").should be_visible end diff --git a/features/step_definitions/oauth_steps.rb b/features/step_definitions/oauth_steps.rb index 5bfaf2152..1238e2dcd 100644 --- a/features/step_definitions/oauth_steps.rb +++ b/features/step_definitions/oauth_steps.rb @@ -100,7 +100,7 @@ class Chubbies def self.get_pid @pid ||= lambda { - processes = `ps -ax -o pid,command | grep "rackup -p #{PORT}"`.split("\n") + processes = `ps ax -o pid,command | grep "rackup -p #{PORT}"`.split("\n") processes = processes.select{|p| !p.include?("grep") } processes.first.split(" ").first }.call diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index ac39424c7..2ab36b55a 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -1,7 +1,3 @@ -When /^I click share across aspects$/ do - find("#expand_publisher").click -end - When /^I post a photo with a token$/ do json = JSON.parse < arg1).first user2 = User.where(:email => arg2).first diff --git a/features/support/env.rb b/features/support/env.rb index 8687f2234..226bfb4ef 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -44,6 +44,8 @@ require File.join(File.dirname(__FILE__), "integration_sessions_controller") require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_redis") require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods") +require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","no_id_on_object") +require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","i18n_raise_errors") require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","user_methods") include HelperMethods Before do diff --git a/features/support/integration_sessions_controller.rb b/features/support/integration_sessions_controller.rb index ba47346f7..acd050240 100644 --- a/features/support/integration_sessions_controller.rb +++ b/features/support/integration_sessions_controller.rb @@ -1,7 +1,7 @@ -class IntegrationSessionsController < ApplicationController +class IntegrationSessionsController < ActionController::Base def new @user_id = params[:user_id] - render 'features/support/integration_sessions_form' + render 'features/support/integration_sessions_form', :layout => false end def create sign_in_and_redirect User.find(params[:user_id]) diff --git a/lib/log_overrider.rb b/lib/log_overrider.rb index 0c0e5991e..b699e1972 100644 --- a/lib/log_overrider.rb +++ b/lib/log_overrider.rb @@ -106,7 +106,8 @@ module ActiveRecord end log_string = "event=sql name='#{payload[:name]}' ms=#{event.duration} query='#{sql}'" - log_string << "caller_hash=#{caller.hash} binds='#{binds}' caller_with_diaspora='#{caller.grep(/diaspora\/(app|lib)/).join(';')}'" + cleaned_trace = Rails.backtrace_cleaner.clean(caller) + log_string << "backtrace_hash=#{cleaned_trace.hash} binds='#{binds}' application_backtrace='#{cleaned_trace.inspect}'" info log_string end diff --git a/lib/pubsubhubbub.rb b/lib/pubsubhubbub.rb index b24b7f798..6de442a8e 100644 --- a/lib/pubsubhubbub.rb +++ b/lib/pubsubhubbub.rb @@ -12,7 +12,11 @@ class Pubsubhubbub end def publish(feed) - response = RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish') - response + begin + response = RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish') + return response + rescue RestClient::BadRequest=> e + Rails.logger.warn "Public URL for your users are incorrect. this is ok if you are in development and localhost is your pod_url#{e.inspect}" + end end end diff --git a/public/images/connect_services.png b/public/images/connect_services.png new file mode 100644 index 000000000..4f0cb84a8 Binary files /dev/null and b/public/images/connect_services.png differ diff --git a/public/images/cubbies_collage.png b/public/images/cubbies_collage.png new file mode 100644 index 000000000..67d36caeb Binary files /dev/null and b/public/images/cubbies_collage.png differ diff --git a/public/images/cubbies_screenshot2.png b/public/images/cubbies_screenshot2.png new file mode 100644 index 000000000..d8347fc6c Binary files /dev/null and b/public/images/cubbies_screenshot2.png differ diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index aec2a7f69..0182bf439 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -2710,11 +2710,6 @@ h1.tag :bottom 12px :vertical-align top -.cubbies-credentials - :background - :color #eee - :padding 15px - .cubbies-settings-image @include box-shadow(3px, 3px, 15px, #333) :margin @@ -3047,3 +3042,19 @@ ul.left_nav :left 0px :padding :bottom 10px + +.cubbies_collage + :position absolute + :right 50px + :top -50px + :z-index -1 + +.cubbies_screenshot + :position absolute + :right -20px + :z-index 1 + +.cubbies_infographic + :height 450px + :margin + :top 30px diff --git a/spec/controllers/tokens_controller_spec.rb b/spec/controllers/tokens_controller_spec.rb index 3a18bdb19..c727f70a3 100644 --- a/spec/controllers/tokens_controller_spec.rb +++ b/spec/controllers/tokens_controller_spec.rb @@ -1,18 +1,9 @@ describe TokensController do - describe '#create' do - it 'generates a new token for the current user' do - sign_in bob - lambda { - get :create - }.should change{ bob.reload.authentication_token } - end - end - describe '#edit' do - it 'displays a token' do + describe '#show' do + it 'succeeds' do sign_in eve - get :create get :show - response.body.should include(eve.reload.authentication_token) + response.should be_success end end end