From 4c96e12a317c513a2cf9fd18c9149aea58fee164 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 26 Nov 2010 09:56:30 -0800 Subject: [PATCH 1/8] removing the form for user creation thru signup --- app/views/invitations/edit.html.haml | 28 +++++++++++++++------------- config/locales/diaspora/en.yml | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml index 1eac967f6..1f9c01d40 100644 --- a/app/views/invitations/edit.html.haml +++ b/app/views/invitations/edit.html.haml @@ -1,14 +1,16 @@ -= form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put }) do |f| - %p - = f.label :username - = f.text_field :username - %p - = f.label :password - = f.password_field :password - %p - = f.label :password_confirmation - = f.password_field :password_confirmation +%h1= t('.invitations_closed') - = f.hidden_field :invitation_token - = f.submit t('.sign_up') -= render :partial => "devise/shared/links" +-#= form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put }) do |f| + -#%p + -#= f.label :username + -#= f.text_field :username + -#%p + -#= f.label :password + -#= f.password_field :password + -#%p + -#= f.label :password_confirmation + -#= f.password_field :password_confirmation + + -#= f.hidden_field :invitation_token + -#= f.submit t('.sign_up') +-#= render :partial => "devise/shared/links" diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 6702dc9b5..102f1bc42 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -284,6 +284,7 @@ en: not_found: "Invitation token not found" edit: sign_up: "sign_up" + invitations_closed: "Invitations for this Diaspora Pod are closed right now. Don't worry, your invite will still work, please try again in about a week." status_messages: new_status_message: tell_me_something_good: "tell me something good" From d6f95445c5b9b2f931f921809e9e05073b4d6101 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Fri, 26 Nov 2010 18:55:36 +0100 Subject: [PATCH 2/8] made em-webfinger errors translatable --- config/locales/diaspora/en.yml | 3 +++ lib/em-webfinger.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 102f1bc42..d780d8f62 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -391,3 +391,6 @@ en: stream_helper: show_comments: "show comments" hide_comments: "hide comments" + webfinger: + fetch_failed: "failed to fetch webfinger profile for %{profile_url}" + hcard_fetch_failed: "there was a problem fetching the hcard for #{@account}" diff --git a/lib/em-webfinger.rb b/lib/em-webfinger.rb index c63f9575b..155871e89 100644 --- a/lib/em-webfinger.rb +++ b/lib/em-webfinger.rb @@ -64,7 +64,7 @@ class EMWebfinger def get_webfinger_profile(profile_url) http = EventMachine::HttpRequest.new(profile_url).get OPTS http.callback{ make_person_from_webfinger(http.response) } - http.errback{ process_callbacks "failed to fetch webfinger profile for #{profile_url}"} + http.errback{ process_callbacks I18n.t('webfinger.fetch_failed', :profile_url => profile_url) } end def make_person_from_webfinger(webfinger_profile) @@ -86,7 +86,7 @@ class EMWebfinger process_callbacks "No person could be constructed from this hcard." end } - http.errback{process_callbacks "there was a problem fetching the hcard for #{@account}"} + http.errback{process_callbacks I18n.t('webfinger.hcard_fetch_failed', :account => @account) } end end From bf66be9ea4c880a29c5fc1bc88929a5ad4d6cbfe Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 26 Nov 2010 13:29:49 -0500 Subject: [PATCH 3/8] fixed template error on statusmessage controller --- app/controllers/status_messages_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 9a442c037..e7b96cbd6 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -29,7 +29,7 @@ class StatusMessagesController < ApplicationController respond_to do |format| format.js{ render :json => { :post_id => @status_message.id, - :html => render_to_string(:partial => 'shared/stream_element', :locals => {:post => @status_message, :current_user => current_user})}, + :html => render_to_string(:partial => 'shared/stream_element', :locals => {:post => @status_message, :aspects => current_user.aspects, :current_user => current_user})}, :status => 201 } format.html{ respond_with @status_message } end From 36415b0c7360971bb352994a0cd4fbdf717eb39e Mon Sep 17 00:00:00 2001 From: Hexagon Date: Fri, 26 Nov 2010 20:00:22 +0100 Subject: [PATCH 4/8] Its now possible to use smtp-servers with no authentication --- config/app_config.yml.example | 4 ++-- config/initializers/mailer_config.rb | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/config/app_config.yml.example b/config/app_config.yml.example index 29cbccd95..e224d47e9 100644 --- a/config/app_config.yml.example +++ b/config/app_config.yml.example @@ -56,9 +56,9 @@ default: # Sender address in diaspora's outgoing mail. smtp_sender_address: 'no-reply@example.com' - # Authentication required to send mail. One of "plain", + # If authentication is needed, change this to one of "plain", # "login" or "cram-md5" - smtp_authentication: 'plain' + smtp_authentication: 'none' # Credentails possibly required to log in to SMTP server if # smtp_authentication != 'plain' diff --git a/config/initializers/mailer_config.rb b/config/initializers/mailer_config.rb index b334cdb42..25cd82ce5 100644 --- a/config/initializers/mailer_config.rb +++ b/config/initializers/mailer_config.rb @@ -6,14 +6,22 @@ Diaspora::Application.configure do config.action_mailer.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} unless Rails.env == 'test' || APP_CONFIG[:mailer_on] != true config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - :address => APP_CONFIG[:smtp_address], - :port => APP_CONFIG[:smtp_port], - :domain => APP_CONFIG[:smtp_domain], - :authentication => APP_CONFIG[:smtp_authentication], - :user_name => APP_CONFIG[:smtp_username], - :password => APP_CONFIG[:smtp_password], - :enable_starttls_auto => true - } + if APP_CONFIG[:smtp_authentication] == "none" + config.action_mailer.smtp_settings = { + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain] + } + else + config.action_mailer.smtp_settings = { + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain], + :authentication => APP_CONFIG[:smtp_authentication], + :user_name => APP_CONFIG[:smtp_username], + :password => APP_CONFIG[:smtp_password], + :enable_starttls_auto => true + } + end end end From a16f35325c6adf32d53ad98508d9d154fdc1385b Mon Sep 17 00:00:00 2001 From: Hexagon Date: Fri, 26 Nov 2010 20:15:02 +0100 Subject: [PATCH 5/8] Changing default smtp auth to plain --- config/app_config.yml.example | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/app_config.yml.example b/config/app_config.yml.example index e224d47e9..ebc90d56e 100644 --- a/config/app_config.yml.example +++ b/config/app_config.yml.example @@ -56,12 +56,13 @@ default: # Sender address in diaspora's outgoing mail. smtp_sender_address: 'no-reply@example.com' - # If authentication is needed, change this to one of "plain", - # "login" or "cram-md5" - smtp_authentication: 'none' + # Authentication required to send mail. Use one of 'one','plain', + # 'login' or 'cram-md5'. Use 'none' if server do not support + # authentication + smtp_authentication: 'plain' # Credentails possibly required to log in to SMTP server if - # smtp_authentication != 'plain' + # smtp_authentication != 'none' smtp_username: 'smtp_username' smtp_password: 'secret' From f8229d07e8bc28f1bcf10a970f24404260758c2b Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 26 Nov 2010 12:16:10 -0800 Subject: [PATCH 6/8] Adding copyright to js files --- public/javascripts/custom-mobile-scripting.js | 5 +++++ public/javascripts/diaspora.js | 5 +++++ public/javascripts/mobile.js | 5 +++++ spec/javascripts/aspect-edit-spec.js | 5 +++++ spec/javascripts/diaspora-spec.js | 5 +++++ spec/javascripts/mobile-interface-spec.js | 5 +++++ spec/javascripts/publisher-spec.js | 5 +++++ spec/javascripts/web-socket-receiver-spec.js | 5 +++++ 8 files changed, 40 insertions(+) diff --git a/public/javascripts/custom-mobile-scripting.js b/public/javascripts/custom-mobile-scripting.js index 6d7583b6a..25e614dcd 100644 --- a/public/javascripts/custom-mobile-scripting.js +++ b/public/javascripts/custom-mobile-scripting.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + // $(document).bind("mobileinit", function(){ // $.extend( $.mobile , { // diff --git a/public/javascripts/diaspora.js b/public/javascripts/diaspora.js index 4543959fe..dc454466f 100644 --- a/public/javascripts/diaspora.js +++ b/public/javascripts/diaspora.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + var Diaspora = Diaspora || {}; Diaspora.widgets = Diaspora.widgets || { pageWidgets: {}, diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js index 89c7368ff..65e8de4d4 100644 --- a/public/javascripts/mobile.js +++ b/public/javascripts/mobile.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + var Mobile = { initialize : function(){ $('#aspect_picker').change(Mobile.changeAspect); diff --git a/spec/javascripts/aspect-edit-spec.js b/spec/javascripts/aspect-edit-spec.js index 3b340039b..1e84d3eef 100644 --- a/spec/javascripts/aspect-edit-spec.js +++ b/spec/javascripts/aspect-edit-spec.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + describe("AspectEdit", function() { beforeEach(function() { diff --git a/spec/javascripts/diaspora-spec.js b/spec/javascripts/diaspora-spec.js index 259d1288d..fc64b2f37 100644 --- a/spec/javascripts/diaspora-spec.js +++ b/spec/javascripts/diaspora-spec.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + describe("Diaspora", function() { describe("widgets", function() { beforeEach(function() { diff --git a/spec/javascripts/mobile-interface-spec.js b/spec/javascripts/mobile-interface-spec.js index b8b39e4d0..4b8e6ed37 100644 --- a/spec/javascripts/mobile-interface-spec.js +++ b/spec/javascripts/mobile-interface-spec.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + describe("mobile interface", function() { describe("initialize", function() { it("attaches a change event to the select box", function() { diff --git a/spec/javascripts/publisher-spec.js b/spec/javascripts/publisher-spec.js index 9cbfdc54b..82e7c9bc8 100644 --- a/spec/javascripts/publisher-spec.js +++ b/spec/javascripts/publisher-spec.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + describe("Publisher", function() { }); diff --git a/spec/javascripts/web-socket-receiver-spec.js b/spec/javascripts/web-socket-receiver-spec.js index 95ab03a33..84bb8321b 100644 --- a/spec/javascripts/web-socket-receiver-spec.js +++ b/spec/javascripts/web-socket-receiver-spec.js @@ -1,3 +1,8 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + describe("WebSocketReceiver", function() { it("sets a shortcut", function() { expect(WSR).toEqual(WebSocketReceiver); From a0f9fb35f3323872bd3231b16c2210238c03857b Mon Sep 17 00:00:00 2001 From: MrZYX Date: Fri, 26 Nov 2010 21:01:13 +0100 Subject: [PATCH 7/8] made pagination translatable --- config/initializers/will_paginate.rb | 6 ++++++ config/locales/diaspora/en.yml | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 config/initializers/will_paginate.rb diff --git a/config/initializers/will_paginate.rb b/config/initializers/will_paginate.rb new file mode 100644 index 000000000..eb149ea22 --- /dev/null +++ b/config/initializers/will_paginate.rb @@ -0,0 +1,6 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + +WillPaginate::ViewHelpers.pagination_options[:previous_label] = "« #{I18n.t('pagination.previous')}" +WillPaginate::ViewHelpers.pagination_options[:next_label] = "#{I18n.t('pagination.next')} »" diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index d780d8f62..e0e00110e 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -394,3 +394,6 @@ en: webfinger: fetch_failed: "failed to fetch webfinger profile for %{profile_url}" hcard_fetch_failed: "there was a problem fetching the hcard for #{@account}" + pagination: + next: "Next" + previous: "Previous" From abae16472d69d69e2d72ed473d2bf549c11f1fb9 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 26 Nov 2010 13:09:05 -0800 Subject: [PATCH 8/8] pagination works on aspects#show --- app/controllers/aspects_controller.rb | 2 +- spec/controllers/aspects_controller_spec.rb | 22 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index fc2e40006..04328b5fe 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -57,7 +57,7 @@ class AspectsController < ApplicationController render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else @aspect_contacts = @aspect.contacts - @posts = @aspect.posts.find_all_by__type("StatusMessage", :order => 'created_at desc').paginate :per_page => 15 + @posts = @aspect.posts.find_all_by__type("StatusMessage", :order => 'created_at desc').paginate :page => params[:page], :per_page => 15 respond_with @aspect end end diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index c017d5554..ac78d930a 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -54,6 +54,28 @@ describe AspectsController do end end + describe "#show" do + it "succeeds" do + get :show, 'id' => @aspect.id.to_s + response.should be_success + end + it "assigns aspect, aspect_contacts, and posts" do + get :show, 'id' => @aspect.id.to_s + assigns(:aspect).should == @aspect + assigns(:aspect_contacts).should == @aspect.contacts + assigns(:posts).should == [] + end + it "paginates" do + 16.times { |i| @user2.post(:status_message, :to => @aspect2.id, :message => "hi #{i}") } + + get :show, 'id' => @aspect.id.to_s + assigns(:posts).count.should == 15 + + get :show, 'id' => @aspect.id.to_s, 'page' => '2' + assigns(:posts).count.should == 1 + end + end + describe "#create" do describe "with valid params" do it "creates an aspect" do