This commit is contained in:
邱博亞 2022-12-21 09:27:34 +08:00
parent 3030d5926b
commit 443d7d44d4
2 changed files with 4 additions and 0 deletions

View File

@ -635,6 +635,7 @@ class Admin::AnnouncementsController < OrbitAdminController
params.require(:announcement_setting).permit!
end
def update_calendar(bps,bulletin)
bps = bps.to_h.with_indifferent_access
if bps[:add_to_calendar] == '0' && !bps[:event_id].blank?
Event.find(bps[:event_id]).destroy rescue nil
bps[:event_id] = nil

View File

@ -38,6 +38,9 @@ class Bulletin
SubPart.class_eval { include BulletinModel::Cache }
Page.class_eval { include BulletinModel::Cache }
before_destroy do
if self.event_id.present? && !defined?(Calendar).nil?
Event.where(:id=>self.event_id).destroy
end
AnnsCache.all.destroy
end
field :is_edit, type: Boolean, default: false #use to check whether the preview record changed