Fix bug
This commit is contained in:
@ -29,7 +29,7 @@ module.exports = (params, user, app, isSecure) =>
|
||||
data: Object.assign(user.data || {}, JSON.parse(data))
|
||||
}
|
||||
};
|
||||
await User.updateOne({ _id: user._id }, set);
|
||||
await User.update({ _id: user._id }, set);
|
||||
res(204);
|
||||
} else {
|
||||
const appdata = await Appdata.findOne({
|
||||
@ -41,7 +41,7 @@ module.exports = (params, user, app, isSecure) =>
|
||||
data: Object.assign((appdata || {}).data || {}, JSON.parse(data))
|
||||
}
|
||||
};
|
||||
await Appdata.updateOne({
|
||||
await Appdata.update({
|
||||
app_id: app._id,
|
||||
user_id: user._id
|
||||
}, Object.assign({
|
||||
|
@ -44,14 +44,13 @@ module.exports = (params) =>
|
||||
const favorites = await Favorites
|
||||
.find({
|
||||
user_id: user._id
|
||||
}, {}, {
|
||||
}, {
|
||||
limit: limit,
|
||||
skip: offset,
|
||||
sort: {
|
||||
_id: sort == 'asc' ? 1 : -1
|
||||
}
|
||||
})
|
||||
.toArray();
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(favorites.map(async favorite =>
|
||||
|
@ -92,11 +92,10 @@ module.exports = (params, user) =>
|
||||
|
||||
// Issue query
|
||||
const notifications = await Notification
|
||||
.find(query, {}, {
|
||||
.find(query, {
|
||||
limit: limit,
|
||||
sort: sort
|
||||
})
|
||||
.toArray();
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(notifications.map(async notification =>
|
||||
|
@ -59,11 +59,10 @@ module.exports = (params, user) =>
|
||||
|
||||
// Issue query
|
||||
const history = await Signin
|
||||
.find(query, {}, {
|
||||
.find(query, {
|
||||
limit: limit,
|
||||
sort: sort
|
||||
})
|
||||
.toArray();
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(history.map(async record =>
|
||||
|
@ -8,6 +8,7 @@ import User from '../../models/user';
|
||||
import { isValidBirthday } from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import event from '../../event';
|
||||
import config from '../../../conf';
|
||||
|
||||
/**
|
||||
* Update myself
|
||||
@ -73,9 +74,7 @@ module.exports = async (params, user, _, isSecure) =>
|
||||
user.banner_id = new mongo.ObjectID(banner);
|
||||
}
|
||||
|
||||
await User.updateOne({ _id: user._id }, {
|
||||
$set: user
|
||||
});
|
||||
await User.update(user._id, user);
|
||||
|
||||
// Serialize
|
||||
const iObj = await serialize(user, user, {
|
||||
|
Reference in New Issue
Block a user