Add streaming API updates for announcements being modified or deleted (#12963)
Change `all_day` to be a visual client-side cue only Publish immediately if `scheduled_at` is in the past Add `published_at` and `updated_at` to announcements JSON
This commit is contained in:
parent
408b3e2b93
commit
b9d74d4076
12 changed files with 100 additions and 41 deletions
|
@ -20,6 +20,7 @@ class Admin::AnnouncementsController < Admin::BaseController
|
|||
@announcement = Announcement.new(resource_params)
|
||||
|
||||
if @announcement.save
|
||||
PublishScheduledAnnouncementWorker.perform_async(@announcement.id) if @announcement.published?
|
||||
log_action :create, @announcement
|
||||
redirect_to admin_announcements_path
|
||||
else
|
||||
|
@ -35,6 +36,7 @@ class Admin::AnnouncementsController < Admin::BaseController
|
|||
authorize :announcement, :update?
|
||||
|
||||
if @announcement.update(resource_params)
|
||||
PublishScheduledAnnouncementWorker.perform_async(@announcement.id) if @announcement.published?
|
||||
log_action :update, @announcement
|
||||
redirect_to admin_announcements_path
|
||||
else
|
||||
|
@ -45,6 +47,7 @@ class Admin::AnnouncementsController < Admin::BaseController
|
|||
def destroy
|
||||
authorize :announcement, :destroy?
|
||||
@announcement.destroy!
|
||||
UnpublishAnnouncementWorker.perform_async(@announcement.id) if @announcement.published?
|
||||
log_action :destroy, @announcement
|
||||
redirect_to admin_announcements_path
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue