Przeglądaj źródła

ensure to avoid unique constraint when deleting user

Yuki Takei 8 lat temu
rodzic
commit
5963e704e7
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      lib/models/user.js

+ 3 - 2
lib/models/user.js

@@ -257,12 +257,13 @@ module.exports = function(crowi) {
     debug('Delete User', this);
 
     const now = new Date();
+    const deletedLabel = `deleted_at_${now.getTime()}`;
 
     this.status = STATUS_DELETED;
-    this.username = `deleted_at_${now.getTime()}`;
+    this.username = deletedLabel;
     this.password = '';
     this.name = '';
-    this.email = 'deleted@deleted';
+    this.email = `${deletedLabel}@deleted`;
     this.googleId = null;
     this.isGravatarEnabled = false;
     this.image = null;