about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-27 11:05:33 +0100
committerGitHub <noreply@github.com>2020-01-27 11:05:33 +0100
commit663ea84b08162578cd06b54bfb998072b2bef8b9 (patch)
treeadb4e2701655dd2d62140f101ebb1815e399d1ff /app/workers
parent4363d06986bb2df1bb15db54df41ddf1d9682afb (diff)
Add publish/unpublish controls to announcements in admin UI (#12967)
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/publish_scheduled_announcement_worker.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/workers/publish_scheduled_announcement_worker.rb b/app/workers/publish_scheduled_announcement_worker.rb
index 4fc6bef2f..efca39d3d 100644
--- a/app/workers/publish_scheduled_announcement_worker.rb
+++ b/app/workers/publish_scheduled_announcement_worker.rb
@@ -7,7 +7,7 @@ class PublishScheduledAnnouncementWorker
   def perform(announcement_id)
     announcement = Announcement.find(announcement_id)
 
-    announcement.update(published: true, published_at: Time.now.utc, scheduled_at: nil) unless announcement.published?
+    announcement.publish! unless announcement.published?
 
     payload = InlineRenderer.render(announcement, nil, :announcement)
     payload = Oj.dump(event: :announcement, payload: payload)