From a06516b80fd2a9ee68e100a5274dd208c2a4ffce Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:00:31 +1300 Subject: [PATCH 1/9] Put displayed link back to using login_name --- app/assets/javascripts/crops.js.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/crops.js.erb b/app/assets/javascripts/crops.js.erb index 5c92b2adb..409e7a9f2 100644 --- a/app/assets/javascripts/crops.js.erb +++ b/app/assets/javascripts/crops.js.erb @@ -17,7 +17,7 @@ function showCropMap(cropmap) { var marker = new L.Marker(new L.LatLng(owner.latitude, owner.longitude)); var planting_url = "/plantings/" + planting.id; - var planting_link = "" + owner.slug + "'s " + crop.name + ""; + var planting_link = "" + owner.login_name + "'s " + crop.name + ""; var where = "

" + owner.location + "

"; @@ -54,4 +54,4 @@ $(document).ready(function() { $('.btn.toggle.crop-hierarchy').click(function () { $('.toggle.crop-hierarchy').toggleClass('hide'); }); -}); \ No newline at end of file +}); From e337fcb7f7454be87ca122b611a8ad6a0cd67588 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:00:59 +1300 Subject: [PATCH 2/9] Put displayed member back to using member.slug --- app/assets/javascripts/members.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/members.js.erb b/app/assets/javascripts/members.js.erb index 2d3752f53..d7bb5020c 100644 --- a/app/assets/javascripts/members.js.erb +++ b/app/assets/javascripts/members.js.erb @@ -18,7 +18,7 @@ if (document.getElementById("membermap") !== null) { var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude)); var member_url = "/members/" + member.slug; - var member_link = "" + member.slug + ""; + var member_link = "" + member.login_name + ""; var where = "

" + member.location + "

"; From cb6a06feb64d9e9884a099afd3d244f62de02037 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:02:15 +1300 Subject: [PATCH 3/9] find by slug --- app/controllers/charts/crops_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/charts/crops_controller.rb b/app/controllers/charts/crops_controller.rb index 6a1a0e6e8..9626a76b9 100644 --- a/app/controllers/charts/crops_controller.rb +++ b/app/controllers/charts/crops_controller.rb @@ -11,7 +11,7 @@ module Charts end def harvested_for - @crop = Crop.find(params[:crop_slug]) + @crop = Crop.find_by!(slug: params[:crop_slug]) render json: Harvest.joins(:plant_part) .where(crop: @crop) .group("plant_parts.name").count(:id) @@ -20,7 +20,7 @@ module Charts private def pie_chart_query(field) - @crop = Crop.find(params[:crop_slug]) + @crop = Crop.find_by!(slug: params[:crop_slug]) render json: Planting.where(crop: @crop) .where.not(field.to_sym => nil) .where.not(field.to_sym => '') From 3212f748b49e97981e0d30ea835b78b001ce67a3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:03:22 +1300 Subject: [PATCH 4/9] Update crops_controller.rb --- app/controllers/crops_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index e5d36302d..ce64ef0f7 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -49,7 +49,7 @@ class CropsController < ApplicationController end def show - @crop = Crop.includes(:scientific_names, plantings: :photos).find(params[:slug]) + @crop = Crop.includes(:scientific_names, plantings: :photos).find_by!(slug: params[:slug]) @posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page]) # respond_with(@crop) respond_to do |format| From d1a3f41462722f6210a02dcc7f17cc657b527ea8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:04:19 +1300 Subject: [PATCH 5/9] Throw if can't find the @crop --- app/controllers/crops_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index ce64ef0f7..73019a827 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -67,7 +67,7 @@ class CropsController < ApplicationController end def edit - @crop = Crop.find_by(slug: params[:slug]) + @crop = Crop.find_by!(slug: params[:slug]) @crop.alternate_names.build if @crop.alternate_names.blank? @crop.scientific_names.build if @crop.scientific_names.blank? end @@ -88,7 +88,7 @@ class CropsController < ApplicationController end def update - @crop = Crop.find_by(slug: params[:slug]) + @crop = Crop.find_by!(slug: params[:slug]) previous_status = @crop.approval_status @crop.creator = current_member if previous_status == "pending" From b35d13d5e5cc9ffb78aee341d227e516a6902b61 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 18 Jan 2019 20:05:41 +1300 Subject: [PATCH 6/9] Update seeds_controller.rb --- app/controllers/seeds_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index a0cb68b6b..cbed89e5c 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -8,8 +8,8 @@ class SeedsController < ApplicationController # GET /seeds # GET /seeds.json def index - @owner = Member.find_by(slug: params[:member_slug]) - @crop = Crop.find_by(slug: params[:crop_slug]) + @owner = Member.find_by(slug: params[:member_slug]) if params[:member_slug].present? + @crop = Crop.find_by(slug: params[:crop_slug]) if params[:crop_slug].present? @seeds = @seeds.where(owner: @owner) if @owner.present? @seeds = @seeds.where(crop: @crop) if @crop.present? From 2539899934acd2ecedb190da08dfd733ca497b81 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 21 Jan 2019 10:50:22 +1300 Subject: [PATCH 7/9] Fix notification specs --- spec/models/notification_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 33f053bfd..330a97003 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -33,17 +33,17 @@ describe Notification do it "sends email if asked" do @notification2 = FactoryBot.create(:notification) @notification2.send_email - expect(ActionMailer::Base.deliveries.last.to).to eq [@notification2.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).to eq [@notification2.recipient.email] end it "doesn't send email to people who don't want it" do FactoryBot.create(:no_email_notification).send_email - expect(ActionMailer::Base.deliveries.last.to).not_to eq [notification.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).not_to eq [notification.recipient.email] end it "sends email on creation" do @notification2 = FactoryBot.create(:notification) - expect(ActionMailer::Base.deliveries.last.to).to eq [@notification2.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).to eq [@notification2.recipient.email] end it "replaces missing subjects with (no subject)" do From 58f8a882420ada6ed09573e1ba7707ab04eca074 Mon Sep 17 00:00:00 2001 From: apdarr Date: Thu, 17 Jan 2019 11:03:20 -0500 Subject: [PATCH 8/9] set newrelic to use ssl --- config/newrelic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/newrelic.yml b/config/newrelic.yml index 63500e405..b7c9cdfdb 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -65,7 +65,7 @@ common: &default_settings # encryption involved in SSL communication, but this work is done # asynchronously to the threads that process your application code, # so it should not impact response times. - ssl: false + ssl: true # EXPERIMENTAL: enable verification of the SSL certificate sent by # the server. This setting has no effect unless SSL is enabled From 4f4421cb38ac4f211793401015cfd3190a38cb99 Mon Sep 17 00:00:00 2001 From: apdarr Date: Tue, 22 Jan 2019 16:59:38 -0500 Subject: [PATCH 9/9] enforce ssl for new relic --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a9f784ac3..2dcbb1842 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -87,6 +87,7 @@ submit the change with your pull request. - Christopher Bazin / [RobotScissors](https://github.com/robotscissors) - Ahmed Shahin / [codeminator](https://www.github.com/codeminator) - Brandon Baker / [brandonbaker40](https://github.com/brandonbaker40) +- Alex Darr / [apdarr](https://github.com/apdarr) ## Bots