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 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 +}); 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 + "
"; 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 => '') diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index e5d36302d..73019a827 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| @@ -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" 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? 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 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