Skip to content

Add user preference for the missing visible signature warning #8322

Description

@vitormattos

Context

Part of #8321.

LibreSign will warn a requester when one or more signers have no visible signature field.

The requester can choose not to see this warning again.

LibreSign already has a generic API to save user configuration. This issue only needs to add the new preference to the existing user configuration flow.

Preference

Add this user configuration key:

warn_without_visible_signature_fields

The value controls only whether the warning is shown.

Expected values:

  • 1: show the warning;
  • 0: do not show the warning.

When the user has no saved value, the default must be 1.

This preference must not change signature fields, signature positions, requests or signing behavior.

Backend changes

Reuse the existing endpoint:

PUT /apps/libresign/api/v1/account/config/{key}

Do not create a new controller or endpoint.

The existing endpoint already stores values for the authenticated user.

Update AccountService::getConfig() so the frontend receives:

{
  "warn_without_visible_signature_fields": true
}

when the warning is enabled, and:

{
  "warn_without_visible_signature_fields": false
}

when it is disabled.

If no value is stored, return true.

Follow the same pattern already used by boolean user settings such as:

  • files_list_grid_view;
  • policy_workbench_catalog_compact_view;
  • policy_workbench_catalog_collapsed.

Do not add a system policy or group configuration.

Reset behavior

The existing user-config API uses an empty value to remove/reset a user setting.

For this preference, resetting the value must restore the default:

warn_without_visible_signature_fields = true

No migration is needed because this is a new preference and the default applies when no value exists.

Behat tests

Update:

tests/integration/features/settings/user-config.feature

This file already tests save, update and delete behavior for user configuration keys.

Add warn_without_visible_signature_fields to the existing CRUD scenario.

Cover:

  1. save 0 and confirm the API accepts it;
  2. update it to 1;
  3. reset it with an empty value;
  4. confirm the returned user configuration uses the default true after reset.

Keep the existing test style instead of creating a separate feature file.

If the existing scenario already covers authentication for this endpoint, do not duplicate that test only for this key.

Unit tests

Update the existing AccountService unit tests for getConfig().

Cover at least:

  • stored 1 returns true;
  • stored 0 returns false;
  • no stored value returns the default true.

Use a data provider if it keeps these cases small and clear.

Quality

Run the related backend checks and tests.

At minimum:

  • the affected PHPUnit tests;
  • tests/integration/features/settings/user-config.feature;
  • Psalm;
  • PHPCS.

Do not change unrelated user configuration behavior.

Good first issue

This is a small backend change using an existing LibreSign user configuration API.

The main work is:

  • add one user configuration key to AccountService::getConfig();
  • reuse the existing /account/config/{key} endpoint;
  • extend the existing PHPUnit tests;
  • extend tests/integration/features/settings/user-config.feature.

No new database table, migration, controller or policy is needed.

Please follow the existing user configuration patterns and keep the change focused.

Additional context

  • If you have questions, feel free to ask in this issue.
  • Give a ⭐️ star to this repository if you find LibreSign useful and would like to support the project.
  • You can also join our community: https://t.me/LibreSign

Done when

  • warn_without_visible_signature_fields is available in user config.
  • The default value is true.
  • 0 is returned as false.
  • 1 is returned as true.
  • Resetting the stored value restores the default.
  • The existing user-config API is reused.
  • PHPUnit covers the value mapping and default.
  • Behat covers save, update and reset.
  • Psalm and PHPCS pass.

Activity

  1. changed the title [-]Store the missing visible signature warning preference per user[/-] [+]Add user preference for the missing visible signature warning[/+] on Sep 9, 2026
  2. maia-andre commented on Sep 11, 2026

    @maia-andre
    Contributor

    I took this one and opened #8349.

    Two things worth your attention, both reported in the pull request.

    The default needed a different mapping than the pattern you pointed at. files_list_grid_view, policy_workbench_catalog_compact_view and policy_workbench_catalog_collapsed all use getUserConfigByKey(...) === '1', and getUserConfigByKey() returns '' when nothing is stored, so that expression defaults to false. This preference defaults to true, so it maps with !== '0': only an explicit 0 hides the warning, and the empty value used to reset restores the default. Implementing it with === '1' fails the new test on exactly the default case, so the distinction is guarded rather than assumed.

    One Behat item is covered by PHPUnit instead, and I would rather flag it than skip it quietly. Item 4 of your test list asks to confirm the returned user configuration uses the default true after reset, but no OCS endpoint exposes AccountService::getConfig(): /account/me returns getSettings(), and getConfig() only reaches the frontend through initialState in PageController, which Behat does not read. So Behat covers the API contract — save 0, update to 1, reset with an empty value, in the existing CRUD scenario — and the default after reset is asserted in the unit test, where the mapping lives. If you would prefer an endpoint that exposes the user config so Behat can assert it end to end, that is a larger change and I would open it as its own issue.

    Local results: AccountServiceTest OK with 36 tests and 86 assertions, psalm unchanged at 4 pre-existing errors, PHPCS clean. Behat was left to CI because tests/integration has no vendor installed locally.

    Backport note: the cherry-pick applies cleanly to stable35 only. On stable32, stable33 and stable34 getConfig() still ends with a bare array_filter($info), which drops falsy values — the key would disappear from the payload when a user disables the warning, which is the opposite of the intended behaviour.

  3. vitormattos commented on Sep 11, 2026

    @vitormattos
    MemberAuthor

    Thanks for checking these details and explaining them clearly.

    The !== '0' mapping makes sense here because this preference must default to true.

    For the Behat coverage, I agree with keeping the test on the existing API behavior and covering the default value in the AccountService unit test. I don't think we should add a new endpoint only to make this assertion end to end.

    For the backport, since this preference is part of the new #8321 feature, let's keep it on main only and introduce the complete feature from Nextcloud 36.

  4. moved this from 0. Backlog to 4. to release in LibreSign Roadmapon Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend workgood first issueGood for newcomersphpWork involving PHP code

    Fields

    Priority

    Low

    Start date

    None yet

    Target date

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions