From 68d79bfa9c9911c21b1dbec11892a586725c48d2 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 9 Jan 2021 17:57:14 +0900 Subject: [PATCH] Publish PostUpdated only when the post is published --- plume-models/src/posts.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 4a9d1c5b..2f95a81a 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -89,7 +89,9 @@ impl Post { diesel::update(self).set(self).execute(conn)?; let post = Self::get(conn, self.id)?; // TODO: Call publish_published() when newly published - self.publish_updated(); + if post.published { + self.publish_updated(); + } Ok(post) }