Update files
This commit is contained in:
parent
bc2d103e50
commit
834982ef6c
|
|
@ -330,3 +330,4 @@ pm2 env <app_name>
|
||||||
**Рекомендация:** Используйте **MongoDB Atlas** для production - это безопасно, надежно и бесплатно для малых проектов!
|
**Рекомендация:** Используйте **MongoDB Atlas** для production - это безопасно, надежно и бесплатно для малых проектов!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ const ensureUserSettings = async (user) => {
|
||||||
updated = true;
|
updated = true;
|
||||||
} else {
|
} else {
|
||||||
if (user.settings.whitelist.noNSFW === undefined) {
|
if (user.settings.whitelist.noNSFW === undefined) {
|
||||||
user.settings.whitelist.noNSFW = true;
|
user.settings.whitelist.noNSFW = true;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
if (user.settings.whitelist.noHomo === undefined) {
|
if (user.settings.whitelist.noHomo === undefined) {
|
||||||
user.settings.whitelist.noHomo = true;
|
user.settings.whitelist.noHomo = true;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ router.get('/:id/posts', authenticate, async (req, res) => {
|
||||||
if (req.user.settings?.whitelist?.noHomo) {
|
if (req.user.settings?.whitelist?.noHomo) {
|
||||||
query.isHomo = { $ne: true };
|
query.isHomo = { $ne: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
const posts = await Post.find(query)
|
const posts = await Post.find(query)
|
||||||
.populate('author', 'username firstName lastName photoUrl')
|
.populate('author', 'username firstName lastName photoUrl')
|
||||||
.sort({ createdAt: -1 })
|
.sort({ createdAt: -1 })
|
||||||
|
|
@ -160,7 +160,7 @@ router.put('/profile', authenticate, async (req, res) => {
|
||||||
req.user.settings.whitelist = { noNSFW: true, noHomo: true };
|
req.user.settings.whitelist = { noNSFW: true, noHomo: true };
|
||||||
} else {
|
} else {
|
||||||
if (req.user.settings.whitelist.noNSFW === undefined) {
|
if (req.user.settings.whitelist.noNSFW === undefined) {
|
||||||
req.user.settings.whitelist.noNSFW = true;
|
req.user.settings.whitelist.noNSFW = true;
|
||||||
}
|
}
|
||||||
if (req.user.settings.whitelist.noHomo === undefined) {
|
if (req.user.settings.whitelist.noHomo === undefined) {
|
||||||
req.user.settings.whitelist.noHomo = true;
|
req.user.settings.whitelist.noHomo = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue