From 3e06598e96e015639379a0176cdbd70096075883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 14 May 2018 12:03:15 +0200 Subject: [PATCH] FIX: only unstage staged users --- app/models/user.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index d46bd6a8439..2913c8acaed 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -270,10 +270,12 @@ class User < ActiveRecord::Base end def unstage - self.staged = false - self.custom_fields[FROM_STAGED] = true - self.notifications.destroy_all - DiscourseEvent.trigger(:user_unstaged, self) + if self.staged + self.staged = false + self.custom_fields[FROM_STAGED] = true + self.notifications.destroy_all + DiscourseEvent.trigger(:user_unstaged, self) + end end def self.unstage(params)