mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:42:45 +08:00
FEATURE: Don't create PM for successful automatic backups
This commit is contained in:
parent
3d2c72dd33
commit
0bc1fa8aa4
|
@ -276,18 +276,18 @@ module BackupRestore
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_user
|
def notify_user
|
||||||
|
return if @success && @user.id == Discourse::SYSTEM_USER_ID
|
||||||
|
|
||||||
log "Notifying '#{@user.username}' of the end of the backup..."
|
log "Notifying '#{@user.username}' of the end of the backup..."
|
||||||
status = @success ? :backup_succeeded : :backup_failed
|
status = @success ? :backup_succeeded : :backup_failed
|
||||||
|
|
||||||
post = SystemMessage.create_from_system_user(@user, status,
|
post = SystemMessage.create_from_system_user(
|
||||||
logs: Discourse::Utils.pretty_logs(@logs)
|
@user, status, logs: Discourse::Utils.pretty_logs(@logs)
|
||||||
)
|
)
|
||||||
|
|
||||||
if !@success && @user.id == Discourse::SYSTEM_USER_ID
|
if @user.id == Discourse::SYSTEM_USER_ID
|
||||||
post.topic.invite_group(@user, Group[:admins])
|
post.topic.invite_group(@user, Group[:admins])
|
||||||
end
|
end
|
||||||
|
|
||||||
post
|
|
||||||
rescue => ex
|
rescue => ex
|
||||||
log "Something went wrong while notifying user.", ex
|
log "Something went wrong while notifying user.", ex
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user