mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
new usersetting to blacklist (filter) also on description
This commit is contained in:
@@ -103,6 +103,28 @@ export default async function userSettingsPlugin(fastify) {
|
||||
}
|
||||
});
|
||||
|
||||
fastify.post('/blacklist-filter-on-details', async (request, reply) => {
|
||||
const userId = request.session.currentUser;
|
||||
const { blacklist_filter_on_provider_details } = request.body;
|
||||
|
||||
const globalSettings = await getSettings();
|
||||
if (globalSettings.demoMode && !isAdmin(request)) {
|
||||
return reply.code(403).send({ error: 'In demo mode, it is not allowed to change settings.' });
|
||||
}
|
||||
|
||||
if (typeof blacklist_filter_on_provider_details !== 'boolean') {
|
||||
return reply.code(400).send({ error: 'blacklist_filter_on_provider_details must be a boolean.' });
|
||||
}
|
||||
|
||||
try {
|
||||
upsertSettings({ blacklist_filter_on_provider_details }, userId);
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
logger.error('Error updating blacklist-filter-on-details setting', error);
|
||||
return reply.code(500).send({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
fastify.post('/listings-view-mode', async (request, reply) => {
|
||||
const userId = request.session.currentUser;
|
||||
const { listings_view_mode } = request.body;
|
||||
|
||||
Reference in New Issue
Block a user