mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
FIX: Disallow user self-delete when user posted in PMs
All posts created by the user are counted unless they are deleted, belong to a PM sent between a non-human user and the user or belong to a PM created by the user which doesn't have any other recipients. It also makes the guardian prevent self-deletes when SSO is enabled.
This commit is contained in:
@ -630,13 +630,9 @@ const User = RestModel.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("can_delete_account", "reply_count", "topic_count")
|
||||
canDeleteAccount(canDeleteAccount, replyCount, topicCount) {
|
||||
return (
|
||||
!Discourse.SiteSettings.enable_sso &&
|
||||
canDeleteAccount &&
|
||||
(replyCount || 0) + (topicCount || 0) <= 1
|
||||
);
|
||||
@computed("can_delete_account")
|
||||
canDeleteAccount(canDeleteAccount) {
|
||||
return !Discourse.SiteSettings.enable_sso && canDeleteAccount;
|
||||
},
|
||||
|
||||
delete: function() {
|
||||
|
Reference in New Issue
Block a user