From 2cebfa54ccaf5c10bf83dff78f93b5f39c29b11e Mon Sep 17 00:00:00 2001 From: Ilya Zhitomirskiy <iz268@nyu.edu> Date: Mon, 19 Sep 2011 15:52:25 -0700 Subject: [PATCH] fixed couple of specs, removed the federation fallback, and fixed the public hashtag pages (not displaying the publisher) --- app/views/tags/show.haml | 3 ++- lib/diaspora/encryptable.rb | 5 ----- spec/lib/diaspora/encryptable_spec.rb | 15 +++------------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/app/views/tags/show.haml b/app/views/tags/show.haml index 729f5eff2b..c9590762cd 100644 --- a/app/views/tags/show.haml +++ b/app/views/tags/show.haml @@ -58,7 +58,8 @@ %h2 = "##{params[:name]}" - = render 'shared/publisher', :selected_aspects => all_aspects.map{|a| a.id}, :aspect_ids => all_aspects.map{|a| a.id}, :for_all_aspects => true, :aspect => all_aspects.first + - if current_user + = render 'shared/publisher', :selected_aspects => all_aspects.map{|a| a.id}, :aspect_ids => all_aspects.map{|a| a.id}, :for_all_aspects => true, :aspect => all_aspects.first %hr diff --git a/lib/diaspora/encryptable.rb b/lib/diaspora/encryptable.rb index cb31e56d64..83ca2f54c9 100644 --- a/lib/diaspora/encryptable.rb +++ b/lib/diaspora/encryptable.rb @@ -1,7 +1,5 @@ module Diaspora module Encryptable - - LAST_FALLBACK_TIME = "Sept 19 2011 17:00 UTC " # Check that signature is a correct signature of #signable_string by person # # @param [String] signature The signature to be verified. @@ -20,9 +18,6 @@ module Diaspora end log_string = "event=verify_signature status=complete guid=#{self.guid}" validity = person.public_key.verify OpenSSL::Digest::SHA256.new, Base64.decode64(signature), signable_string - if !validity && Time.now < Time.parse(LAST_FALLBACK_TIME) - validity = person.public_key.verify "SHA", Base64.decode64(signature), signable_string - end log_string += " validity=#{validity}" Rails.logger.info(log_string) validity diff --git a/spec/lib/diaspora/encryptable_spec.rb b/spec/lib/diaspora/encryptable_spec.rb index 9906ad8709..dcf46cec70 100644 --- a/spec/lib/diaspora/encryptable_spec.rb +++ b/spec/lib/diaspora/encryptable_spec.rb @@ -21,18 +21,9 @@ describe Diaspora::Encryptable do @comment.verify_signature(sig, bob.person).should be_true end - context "fallback" do - it "checks the SHA if it's within the week of the rollout window" do - sig = Base64.encode64s(bob.encryption_key.sign( "SHA", @comment.signable_string )) - @comment.verify_signature(sig, bob.person).should be_true - end - - it 'does not verify the fallback after rollout window' do - Kernel::silence_warnings { Diaspora::Encryptable.const_set(:LAST_FALLBACK_TIME,((Time.now - 1.week).to_s))} - - sig = Base64.encode64s(bob.encryption_key.sign( "SHA", @comment.signable_string )) - @comment.verify_signature(sig, bob.person).should be_false - end + it 'does not verify the fallback after rollout window' do + sig = Base64.encode64s(bob.encryption_key.sign( "SHA", @comment.signable_string )) + @comment.verify_signature(sig, bob.person).should be_false end end end -- GitLab