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

@@ -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.