Commit Graph

68 Commits

Author SHA1 Message Date
dependabot[bot]
f4203909db Bump rubocop from 1.56.4 to 1.61.0
This version fixes false negatives for Lint/SymbolConversion when using
string interpolation, for Style/RedundantArgument when using the safe
navigation operator, for Style/RedundantParentheses when logical
operators are involved and for Style/RedundantReturn with lambda ending
with return. We're applying the new rules.

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.4 to 1.61.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.56.4...v1.61.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-02 16:31:10 +02:00
Senén Rodero Rodríguez
0643606dcd Add new setting to enable/disable map marker clustering 2024-01-29 17:56:54 +01:00
Senén Rodero Rodríguez
f8835debae Move logic from key definition to views
Before this change, two important things depend on the format of each key,
where to render it in the administration panel and which kind of interface
to use for each setting. Following this strategy led us to a very complex
code, very difficult to maintain or modify. So, we do not want to depend
on the setting key structure anymore to decide how or where to render each
setting.

With this commit, we get rid of the key format-based rules. Now we render
each setting explicitly passing to it the type and the tab where it belongs.
2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
6a64f38d17 Use admin table settings component to render featured settings
Now, with the same template we can render all kind of settings.
2024-01-25 18:29:38 +01:00
Javi Martín
243d55ec82 Add method to get the archived proposals date limit 2023-08-30 14:46:35 +02:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Javi Martín
7dfbf772e2 Use the new name in default settings 2023-07-12 16:05:33 +02:00
Javi Martín
061ae94f98 Use the tenant name as default organization name
This way we'll avoid having all tenant organizations named "CONSUL" by
default, and we'll also use different email senders per tenant, which
will reduce the change of the emails being marked as spam.
2022-11-28 16:42:41 +01:00
Javi Martín
03614325d1 Use current host as default email address domain
We were using `consul.dev` as default, which might be fine for the
development environment, but it's something that definitely needs to be
changed on production.

Now we're providing a better default setting: using the same domain
which is used to generate URLs in emails. This also makes it easier to
configure new tenants, since the setting will default to whatever host
the new tenant is using.

The `|| "consul.dev"` part might not be needed; I'm keeping it because
I'm not sure production environents would not experience any new issues
if we don't add it, but we might remove it in the future.
2022-11-28 16:39:09 +01:00
Javi Martín
f871658510 Use default_url_options to generate absolute URLs
In the dev seeds, we were using `Setting["url"]/proposals`, but we can
use `proposals_url` instead, similar to what we do in the rest of the
application.

We can do a similar thing in the sitemap. This way the sitemap will also
work on installations who haven't manually set the "url" setting.

Since we aren't using `Setting["url"]` anywhere anymore, we're removing
it.

This setting was mainly redundant, since we already had the
`server_name` in the secrets. Furthermore, `server_name` is
automatically configured when running the installer, while
`Setting["url"]` had to be manually set in the admin section the
application was installed.

Note we're using `ActionMailer::Base` setting to generate URLs. Sounds a
bit strange, but it's a standard way Rails provides to generate URLs
outside the context of a request.
2022-10-02 16:54:06 +02:00
Javi Martín
ea3abd6317 Add and apply Rails/Pick rubocop rule
The `pick` method was added in Rails 6.0.
2022-08-24 18:11:56 +02:00
Javi Martín
e4d69d12d4 Allow removing investment supports by default
When we added this setting in commit 9979b5399, we disabled it by
default so it would be compatible with existing installations.

Since then, we've released version 1.4, which adds the settings to
existing databases. That means we can now enable it by default and
existing installations won't be affected.
2022-06-03 20:10:33 +02:00
decabeza
682781cd3d Include machine learning settings type
On the Configuration settings page three settings appeared without
description:

* Comments Summary: No description.
* Related Content: No description.
* Tags: No description.

These settings are related with the AI / Machine learning feature. They
only should appear on AI / Machine learning setting page when the
feature is enabled.
2022-05-05 18:30:33 +02:00
Javi Martín
c2e95f6b86 Allow any postal code by default
Due to the way Madrid handled postal code validations (see issue 533),
by default we were requiring everyone to validate against the local
census *and* to specify valid postal codes.

This could be useful in some cases, but in other cases, the census
validation will be enough and there'll be no need to manually define the
valid postal codes. Besides, some CONSUL installations are used in
organizations or political parties where the postal code validation
doesn't make sense.
2021-12-16 13:57:00 +01:00
Javi Martín
5cc10cbadf Allow dashes in postal codes
In some countries, postal codes are defined with a dash in the middle,
so we're using a colon to define ranges instead. We could also use two
dots, like in Ruby ranges, but IMHO this would cause typos since people
would enter codes separated with three dots or just one dot.
2021-12-16 13:57:00 +01:00
Laura Concepción Rodríguez
f4512b2117 Redefine postal code verification methods to use setting config parameter 2021-12-16 13:57:00 +01:00
decabeza
9979b53994 Add setting to allow remove investments supports 2021-11-08 01:37:41 +01:00
Javi Martín
797f61c0ca Enable SDG content by default
We didn't enable it by default in commit 676adfcb3 so existing
installations didn't suddenly get a new section without expecting it.

But since the setting already exists for installations using version
CONSUL 1.3, now it will only be enabled for new installations.
2021-09-30 14:44:30 +02:00
Machine Learning
4d27bbebad Add experimental machine learning 2021-08-16 16:31:04 +02:00
Javi Martín
32a61f826c Make it easier for admins to enable SDG processes
In order to ensure compatibility with existing CONSUL installations, we
disabled all settings related to SDG. However, we also made it much
harder to enable SDG globally on the site, since administrators first
had to enable the SDG feature and then enable it for each process.

Most people will expect SDG is enabled for all processes once they
enable the SDG feature, so that's what we're doing. They can of course
disable specific processes should they wish to do so.
2021-04-21 18:37:54 +02:00
taitus
676adfcb3f Add new SDG feature Setting 2020-12-03 18:26:00 +01:00
taitus
79cb78880a Add default values for new sdg settings 2020-12-03 18:00:10 +01:00
taitus
609e51bbf3 Include new type 'sdg' on settings 2020-12-03 18:00:10 +01:00
Javi Martín
727e743887 Remove autoload trigger
I'm not sure why the code didn't work without this line, but it doesn't
seem to be necessary anymore (maybe after upgrading Ruby or Rails?).

I'm removing it now because... why not now? :) The Ruby interpreter is
raising a warning due to this line, and in Ruby 2.5 constant lookup has
changed slightly (although I don't think this line is affected by that
change).

Note about the change in the Setting model: Ruby actually ignores return
values in setter methods, so the line isn't necessary.
2020-07-08 12:39:25 +02:00
Javier Martín
14b1f1b4d3 Merge pull request #3911 from rockandror/dashboard-email
Improve Dashboard emails
2020-02-19 19:06:53 +01:00
taitus
45aec05b93 Update and rename Setting as feature type
The old Setting["dashboard.emails"] is a Feature Setting, but appeared as
Configuration Setting without button for enable/disable.
In this commit, we update the old setting to behave like a Feature Setting.
Too we rename setting to clarify what emails are blocked with this feature.
2020-02-17 16:30:38 +01:00
Julian Herrero
193e51d42f Enable Wordpress Oauth login and registration 2020-02-07 12:23:41 +07:00
Javi Martín
f3df3f4fbc Remove people proposal model
This model isn't used anywhere, since it was created as part of a
feature which couldn't be completed.

This commit reverts commit 46e5d6a9.
2019-10-30 02:26:42 +01:00
Javi Martín
93c6347b45 Apply Rails/FindBy rubocop rule
We were already using it in most places.
2019-10-23 18:29:09 +02:00
Juanjo Bazán
0063e7b4d8 Add feature flag for the GraphQL API 2019-10-20 14:52:07 +02:00
taitus
3e383d7c1f Add new fields to form
- Add :date_of_birth and :postal_code
- Only display new fields when aplication has configured the
custom census API and contains alias values for fields. Add 2
class Setting methods to check this feature:
  - force_presence_date_of_birth?
  - force_presence_postal_code?
2019-07-29 13:10:09 +02:00
taitus
637675a1f5 Add content to the Remote Census Configuration tab
- Render remote census configuration content on settings index.
 - Update type method from Setting
   On Admin::SettingsController#index we are using 'all_settings' to
   group all settings by 'type' method.
   'type' method return the first part of key when split by '.'
   To allow use by example: all_settings["remote_census.general"]
   and recover only settings related with this key we have added new
   'elsif' on 'type' method.
2019-07-29 13:10:09 +02:00
taitus
3df856ff7e Add new Settings related to the remote census
These Settings will store all the values needed to
connect to the remote census.
2019-07-29 13:10:09 +02:00
taitus
f6beff91be Add new feature setting 'remote_census'
It will allow to enable remote census configuration.
2019-07-29 13:10:09 +02:00
taitus
21f347778b Add Remote Translations Settings
- Add to seeds and dev_seeds
- Add locales
2019-06-27 09:21:18 +02:00
Senén Rodero Rodríguez
b5663a7c17 Add translation interface setting values
* Disable translation interface by default
 * Also add rake task to enable translations interface through rake
   command
2019-06-27 09:20:25 +02:00
voodoorai2000
d9cc726085 Add setting for max votes to edit a people proposal 2019-06-07 12:29:30 +02:00
Raimond Garcia
a874d25bfa Merge pull request #3413 from LextrendIT/feature/notify_evaluation_comments
notify by email new evaluation comments
2019-06-06 11:29:38 +02:00
lalo
8061bfa5e8 Send email to users related with an investment when valuation comment is created 2019-06-05 17:02:59 +02:00
Julian Herrero
8e0bbf54f6 Replace harcoded images and documents settings 2019-06-04 11:50:09 +02:00
Julian Herrero
220bfb065a Add images and documents settings to admin panel 2019-06-04 11:47:22 +02:00
Julian Herrero
35cd26c117 Add images and document settings to the DB 2019-06-04 11:45:38 +02:00
Julian Herrero
e32faf3a3c Extract setting prefix to a method
We may need to access the setting key prefix in the future, so it's
better to have it in a method to avoid duplication
2019-06-04 11:39:53 +02:00
Javi Martín
bb504d90fb Add method to add new settings 2019-05-31 19:33:31 +02:00
Javi Martín
555fae0811 Order settings to follow our traditional order
Settings are displayed in the administration in the order they are
created, and reordering them alphabetically in the code caused them to
be displayed in a different order.

Since we don't want to confuse our users by randomly changing the order,
I've grouped the settings by namespaces and ordered each namespace the
way it used to be.

Note dev seeds don't need to be changed, since they are executed after
default settings have been created.
2019-05-31 19:30:35 +02:00
Javi Martín
cf26b230c9 Use a rounded value for default supports needed
We were using the value which is used in Madrid.
2019-05-31 19:30:14 +02:00
Javi Martín
ff21ce7665 Use translations for official level names seeds 2019-05-31 19:30:14 +02:00
Javi Martín
7830d90d4a Extract method to reset default settings 2019-05-31 19:28:50 +02:00
Javi Martín
9e6e6d6c9e Sort settings alphabetically 2019-05-31 19:28:50 +02:00
Javi Martín
bac0004fed Move default settings to Settings model 2019-05-31 19:28:35 +02:00