FEATURE: Add event trigger when a user is logged out.

This commit is contained in:
Guo Xiang Tan
2016-07-04 17:20:30 +08:00
parent 0ffe8402a9
commit 22ade1f811
4 changed files with 19 additions and 4 deletions

View File

@@ -854,6 +854,11 @@ class User < ActiveRecord::Base
User.where(admin: true).where.not(id: id).where.not(id: Discourse::SYSTEM_USER_ID).blank?
end
def logged_out
MessageBus.publish "/logout", self.id, user_ids: [self.id]
DiscourseEvent.trigger(:user_logged_out, self)
end
protected
def badge_grant
@@ -999,7 +1004,6 @@ class User < ActiveRecord::Base
end
end
end
# == Schema Information