mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
prevent challenge tasks being deleted when challenge ID (cid) has been lost - possible fix for https://github.com/HabitRPG/habitrpg/issues/4466
This commit is contained in:
@@ -539,6 +539,9 @@ UserSchema.pre('save', function(next) {
|
|||||||
|
|
||||||
UserSchema.methods.unlink = function(options, cb) {
|
UserSchema.methods.unlink = function(options, cb) {
|
||||||
var cid = options.cid, keep = options.keep, tid = options.tid;
|
var cid = options.cid, keep = options.keep, tid = options.tid;
|
||||||
|
if (!cid) {
|
||||||
|
return cb("Could not remove challenge tasks. Please delete them manually.");
|
||||||
|
}
|
||||||
var self = this;
|
var self = this;
|
||||||
switch (keep) {
|
switch (keep) {
|
||||||
case 'keep':
|
case 'keep':
|
||||||
|
|||||||
Reference in New Issue
Block a user