From 10c013046d195713b5dc2e653c87d4d66d66c2e7 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Mon, 16 Jan 2023 17:31:46 +0800 Subject: [PATCH] Fix bug. --- app/controllers/seminars_controller.rb | 7 +------ config/routes.rb | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index cc8f4fd..7d2ca1e 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -780,11 +780,6 @@ class SeminarsController < ApplicationController mail_sentdate:Time.current, mail_subject: email_set[0].title[I18n.locale], template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text}) - end - begin - mail.deliver - rescue => e - puts ["email can't deliver",e] - end + end end end diff --git a/config/routes.rb b/config/routes.rb index 3a242de..2112d6d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,10 @@ Rails.application.routes.draw do Thread.new do if Page.fields.include?('all_pageids') s = Site.first - if s.respond_to?(:tmp_flags) && !(s.tmp_flags.include?('fix_sr')) + update_flag = s.respond_to?(:tmp_flags) + need_update1 = update_flag && !(s.tmp_flags.include?('fix_sr')) + need_update2 = !update_flag || !(s.tmp_flags.include?('sm1')) + if need_update1 Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p| p.save end @@ -14,6 +17,16 @@ Rails.application.routes.draw do tmp_flags << 'fix_sr' Site.update_all(:tmp_flags => tmp_flags) end + if need_update2 + SeminarMain.where(:enable_recaptcha=>nil).each do |seminar_main| + seminar_main.update_enable_recaptcha + end + if update_flag + s = Site.first + s.tmp_flags << 'sm1' + s.save + end + end end end locales = Site.first.in_use_locales rescue I18n.available_locales -- 2.40.1