Fixed undefined user ID in postgres function. Fixed and improved mobile alignment for new and stash icons on scene tile.

This commit is contained in:
DebaucheryLibrarian 2021-03-20 00:12:12 +01:00
parent 3b3f4a1f2d
commit e301e2184c
3 changed files with 11 additions and 4 deletions

View File

@ -204,7 +204,7 @@ export default {
width: 1rem;
height: 1rem;
box-sizing: border-box;
padding: .375rem .25rem;
margin: .25rem;
border-radius: 0 0 .5rem 0;
color: var(--primary);
font-size: 1rem;
@ -434,7 +434,13 @@ export default {
.tile.new .poster::after {
bottom: 0;
top: auto;
border-radius: 0 .5rem 0 0;
margin: 0 .25rem;
}
.stash {
left: 0;
right: auto;
padding: .25rem .5rem .5rem .25rem;
}
}
</style>

View File

@ -1157,7 +1157,8 @@ exports.up = knex => Promise.resolve()
// allow vim fold
return knex.raw(`
CREATE FUNCTION current_user_id() RETURNS INTEGER AS $$
SELECT current_setting('user.id', true)::integer;
/* if the user ID is undefined, the adapter will pass it as a string, which cannot be cast as NULL by ::integer */
SELECT NULLIF(current_setting('user.id', true), '')::integer;
$$ LANGUAGE SQL STABLE;
/* We need both the release entries and their search ranking, and PostGraphile does not seem to allow virtual foreign keys on function results.

View File

@ -14,7 +14,7 @@ const connectionString = `postgres://${config.database.query.user}:${config.data
async function pgSettings(req) {
return {
'user.id': req.session.user?.id,
'user.id': req.session.user?.id || null, // undefined is passed as an empty string, avoid
};
}