Fix announcement create error.

This commit is contained in:
chiu 2020-06-01 13:10:51 +08:00
parent 2579c02663
commit 58b5f5509c
1 changed files with 1 additions and 1 deletions

View File

@ -191,6 +191,7 @@ class Admin::AnnouncementsController < OrbitAdminController
def create def create
bps = bulletin_params bps = bulletin_params
bulletin = Bulletin.new(bps)
if !bps['bulletin_links_attributes'].nil? if !bps['bulletin_links_attributes'].nil?
bps['bulletin_links_attributes'].each do |idx,link| bps['bulletin_links_attributes'].each do |idx,link|
bps['bulletin_links_attributes'].delete(idx.to_s) if link['url'].blank? bps['bulletin_links_attributes'].delete(idx.to_s) if link['url'].blank?
@ -207,7 +208,6 @@ class Admin::AnnouncementsController < OrbitAdminController
bps[:is_hidden] = false bps[:is_hidden] = false
end end
bulletin = Bulletin.new(bps)
if !defined?(Calendar).nil? if !defined?(Calendar).nil?
if bps[:add_to_calendar] == '0' && !bps[:event_id].blank? if bps[:add_to_calendar] == '0' && !bps[:event_id].blank?
Event.find(bps[:event_id]).destroy rescue nil Event.find(bps[:event_id]).destroy rescue nil