Commit Graph

17891 Commits

Author SHA1 Message Date
Javi Martín
becd0acff1 Remove Github Changelog Generator dependency
Unfortunately this gem no longer works on our repository because it
reaches a request limit:

Octokit::TooManyRequests
403 - You have exceeded a secondary rate limit. Please wait a few
minutes before you try again.
See: https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits

We can still use github_fast_changelog, which can be run locally without
being included as a dependencly, to help us update our CHANGELOG.
2023-01-11 15:38:46 +01:00
Javi Martín
30edfbcea6 Merge pull request #4878 from consul/verification_info
Show verification info only if verification is enabled
2023-01-10 15:01:06 +01:00
Javi Martín
00849f500b Merge pull request #5059 from consul/dependabot/bundler/httparty-0.21.0
Bump httparty from 0.20.0 to 0.21.0
2023-01-04 16:13:27 +01:00
Javi Martín
f1387092e8 Don't use line-height to set verified text margin
Using line-height is confusing and has unexpected results when texts
span over multiple lines, as might be the case in some language and
screen resolution combinations.
2023-01-04 16:06:29 +01:00
Javi Martín
6cc2003e1f Fix contrast in account verified text
The contrast value was 1.75, which makes the text hard to read and it
isn't even near to the minimum accessibility requirements.

We're using the `$color-success` variable since the `$check` color is
green and this one is green too.
2023-01-04 16:06:29 +01:00
Javi Martín
3938f4ff95 Render account verified icon using CSS
As mentioned in commit 925f04e3f, icon classes make screen readers
announce strange symbols and aren't properly displayed for people who
have changed their preferred font family.
2023-01-04 16:06:29 +01:00
decabeza
d59d02ba83 Show verification info only if verification is enabled 2023-01-04 16:06:29 +01:00
Javi Martín
3f664e4ccd Don't ask verified users to verify their account
It was strange to tell users they need to verify their account in order
to perform all available actions when they've already verified their
account.
2023-01-04 16:06:29 +01:00
Javi Martín
1ecd422f7f Extract component to render verification info
We're also adding tests showing the current behavior, which we're about
to change.
2023-01-04 16:06:29 +01:00
dependabot[bot]
ac7dc058ab Bump httparty from 0.20.0 to 0.21.0
Bumps [httparty](https://github.com/jnunemaker/httparty) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/jnunemaker/httparty/releases)
- [Changelog](https://github.com/jnunemaker/httparty/blob/master/Changelog.md)
- [Commits](https://github.com/jnunemaker/httparty/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: httparty
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-04 15:52:14 +01:00
Senén Rodero
f9ec038671 Merge pull request #5048 from consul/tenant_administrator
Create an administrator in new tenant
2022-12-29 16:31:38 +01:00
taitus
951eec7d08 Copy the main tenant administrator login credentials into the new tenant
Co-Authored-By: Senén Rodero <senenrodero@gmail.com>
2022-12-29 15:43:16 +01:00
Javi Martín
171cf4e634 Merge pull request #5050 from consul/hide_tenants
Make it possible to disable tenants
2022-12-28 15:06:49 +01:00
Javi Martín
25435b0297 Make it possible to disable tenants
Note we could use `acts_as_paranoid` with the `without_default_scope`
option, but we aren't doing so because it isn't possible to consider
deleted records in uniqueness validations with the paranoia gem [1].
I've added tests for these cases so we don't accidentally add
`acts_as_paranoid` in the future.

Also note we're extracting a `RowComponent` because, when
enabling/disabling a tenant, we're also enabling/disabling the link
pointing to its URL, and so we need to update the URL column after the
AJAX call.

[1] See issues 285 and 319 in https://github.com/rubysherpas/paranoia/
2022-12-28 14:34:00 +01:00
Javi Martín
0dac6ead77 Raise an exception when accessing a domain as subdomain
We were returning `nil` in this case, meaning we would be accessing the
main tenant in this situation instead of returning "Not Found".
2022-12-28 14:34:00 +01:00
Javi Martín
0d18e25e99 Extract component to render a switch
We're going to use it in other places.
2022-12-28 14:34:00 +01:00
Javi Martín
72704d7761 Use separate actions to enable/disable budget phases
This is consistent with the way we use separate actions to hide and
restore records, which is similar to enabling and disabling a record. We
might do something similar with the `toggle_selection` actions in the
future. For now, we're only doing it with budget phases because we're
going to add a similar switch control to hide and restore tenants.

We're also making these actions idempotent, so sending many requests to
the same action will get the same result, which wasn't the case with the
`toggle` action. Although it's a low probability case, the `toggle`
action could result in disabling a phase when trying to enable it if
someone else has enabled it between the time the page loaded and the
time the admin clicked on the "enable" button.
2022-12-28 14:34:00 +01:00
Javi Martín
3e7b68c544 Merge pull request #5053 from consul/ruby_2.7.7
Upgrade Ruby to version 2.7.7
2022-12-28 14:26:49 +01:00
Esther Nass
9616637aa4 Merge pull request #5056 from consul/consul_democracy_logo
Update consul democracy logo
2022-12-22 15:17:06 +01:00
decabeza
41dd51b189 Update consul democracy logo 2022-12-22 12:42:58 +01:00
Javi Martín
47a5840c70 Upgrade Ruby to version 2.7.7
So get the latest fixes in the 2.7.x series.

We're also updating the parser gem so we don't get any warnings.
2022-12-21 15:57:02 +01:00
Senén Rodero
fc0bb21821 Merge pull request #5052 from consul/tenant_not_found_exception
Do not track `Apartment::TenantNotFound` exceptions through `Airbrake`
2022-12-20 17:20:47 +01:00
Senén Rodero Rodríguez
e08d287ef8 Do not track Apartment::TenantNotFound exceptions through Airbrake
As we do with `ActiveRecord::NotFound` exceptions. Otherwise, we
can quickly flood the third-party application in charge of tracking
exceptions.
2022-12-20 16:46:00 +01:00
Javi Martín
d63efc7815 Merge pull request #5046 from consul/tenant_url
Use the tenant URL as a link to the tenant
2022-12-15 13:20:07 +01:00
Javi Martín
f70e3fae6e Merge pull request #5047 from consul/dependabot/bundler/rails-html-sanitizer-1.4.4
Bump rails-html-sanitizer from 1.4.3 to 1.4.4
2022-12-14 18:34:38 +01:00
dependabot[bot]
f705eecc19 Bump rails-html-sanitizer from 1.4.3 to 1.4.4
Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.3 to 1.4.4.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.4.3...v1.4.4)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 18:18:31 +01:00
Javi Martín
6506f8d7cf Merge pull request #5045 from consul/dependabot/bundler/loofah-2.19.1
Bump loofah from 2.18.0 to 2.19.1
2022-12-14 18:17:51 +01:00
dependabot[bot]
892db0a1a4 Bump loofah from 2.18.0 to 2.19.1
Bumps [loofah](https://github.com/flavorjones/loofah) from 2.18.0 to 2.19.1.
- [Release notes](https://github.com/flavorjones/loofah/releases)
- [Changelog](https://github.com/flavorjones/loofah/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flavorjones/loofah/compare/v2.18.0...v2.19.1)

---
updated-dependencies:
- dependency-name: loofah
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 17:59:17 +01:00
Javi Martín
41c01da133 Merge pull request #5044 from consul/dependabot/bundler/nokogiri-1.13.10
Bump nokogiri from 1.13.9 to 1.13.10
2022-12-14 17:57:32 +01:00
dependabot[bot]
dc00b3ca8d Bump nokogiri from 1.13.9 to 1.13.10
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.9 to 1.13.10.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.9...v1.13.10)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 17:04:55 +01:00
Javi Martín
7bcdb6a9db Use the tenant URL as a link to the tenant
In general, we don't use links inside admin tables because we don't know
where the link will point to, and use "view" actions/links instead.

However, in this case, we're showing a URL, so it's perfectly obvious
where the link will point to. And so it makes sense to use the URL as a
link instead of using a "view" action/link.
2022-12-14 13:52:26 +01:00
Senén Rodero
b5f1b64d8a Merge pull request #5040 from consul/i18n_crowdin
Update translations from Crowdin
2022-12-13 17:08:52 +01:00
Javi Martín
09b9d2b88e Merge pull request #5007 from consul/tenant_domains
Allow using domains in tenants
2022-12-13 13:33:15 +01:00
Javi Martín
e1e16d21c3 Allow having tenants with different domains
Some institutions using CONSUL have expressed interest in this feature
since some of their tenants might already have their own domains.

We've considered many options for the user interface to select whether
we're using a subdomain or a domain, like having two separate fields,
using a check box, ... In the end we've chosen radio buttons because
they make it easier to follow a logical sequence: first you decide
whether you're introducing a domain or subdomain, and then you enter it.

We've also considered hiding this option and assuming "if it's got a
dot, it's a domain". However, this wouldn't work with nested subdomains
and it wouldn't work with domains which are simply machine names.

Note that a group of radio buttons (or check boxes) is difficult to
style when the text of the label might expand over more than one line
(as is the case here on small screens); in this case, most solutions
result in the second line of the label appearing immediately under the
radio button, instead of being aligned with the first line of the label.
That's why I've added a container for the input+label combination.
2022-12-13 13:10:02 +01:00
Javi Martín
e9c2776252 Don't create schemas in model tests unless needed
Creating a schema takes about 3-4 seconds on my machine, so omitting
the callbacks makes tests much faster.

To do so, we're using the `insert!` method added in Rails 6.0, which
inserts a record without executing callbacks or validations. To make the
tests look consistent, we're adding a FactoryBot strategy which uses
`insert!` instead of `create!`.

Note this strategy is useless in most cases because it doesn't work when
models have translatable attributes or associations. However, IMHO it's
worth it even if we only use it for tenants.

We could also use `Tenant.insert!` instead, but then we would have to
add all the mandatory attributes, and in this case the code is clearer
if we only add the attributes we need for the test.
2022-12-13 13:10:02 +01:00
Javi Martín
50076870eb Merge pull request #5041 from consul/not_found_tenants
Respond with not found on missing tenants
2022-12-12 11:49:55 +01:00
Javi Martín
bc716f6726 Merge pull request #5036 from consul/author_lock
Simplify locking current user when voting
2022-12-12 11:47:30 +01:00
Senén Rodero Rodríguez
33378229df Update translation from Crowdin 2022-12-09 11:47:13 +01:00
Esther Nass
5cbf4f1766 Merge pull request #5043 from cronopioelectronico/master
change name
2022-12-07 15:40:23 +01:00
cronopioelectronico
479ee80fba change name 2022-12-06 14:01:57 +00:00
Javi Martín
94f78c0a55 Respond with not found on missing tenants
Just like we respond with "not found" for any other record. This
improves the user experience because with the "Not found" error message
people realize the URL is wrong instead of thinking that they broke the
application.
2022-12-04 15:36:29 +01:00
Javi Martín
159a24f452 Don't create unnecessary tenants in tenant tests
While creating the "venus" tenant for every test makes the code cleaner,
it also makes the tests much slower, so we aren't doing so in tests
where we don't use this tenant.
2022-12-03 17:09:28 +01:00
Javi Martín
f4bd8e9ef9 Merge pull request #4902 from consul/permission_list_accessibility
Add account permissions hint for screen reader users
2022-12-01 14:02:19 +01:00
Javi Martín
2bac80215f Add permissions hint for visually impaired people
We were displaying an icon showing that certain actions can't be
performed. However, people who can't see the icons were hearing that
they _can_ perform certain actions while the opposite is true.

We've considered other options to solve this problem. One was to split
the list in two: actions that can be performed and actions that can't be
performed. It was tricky because in some cases we're listing that
actions that can be performed now and in other cases we're displaying
the actions that people will be able to perform once they verify their
account.

Another option was to include the word "Cannot" as a prefix instead of
"Additional verification needed". We haven't done so because, while in
English we say "cannot do this thing", in other languages they say
"this thing cannot do".

So we've gone with a solution where people hearing what's on the screen
know what's going on and we don't have to make big changes in the code.
2022-11-29 18:48:24 +01:00
Javi Martín
66c2583557 Render icons using CSS in user permissions
As mentioned in commit 925f04e3f, icon classes make screen readers
announce strange symbols and aren't properly displayed for people who
have changed their preferred font family.
2022-11-29 18:48:24 +01:00
Javi Martín
0c62977668 Extract method to define permissions
This way we simplify the ERB code.

Due to the bug mentioned in the previous commit, we're keeping the
original code instead of using `can?` to check permissions.
2022-11-29 18:48:24 +01:00
Javi Martín
9b908d7264 Extract component to render account permissions
We were using similar code in four different places; six, if we count
the welcome pages seeds. Reducing duplication in the pages seeds is a
bit tricky because administrators are supposed to edit their content and
might remove the HTML class we use to define styles. However, we can
share the code everywhere else.

Note that there's a bug in the application since we show that level 2
users cannot vote for budget projects but we give them permission to do
so in the abilities model. We're keeping the same behavior after this
refactoring but we might change it in the future.
2022-11-29 18:48:24 +01:00
Javi Martín
feaa9ee736 Merge pull request #5039 from consul/fix_coveralls_build_number
Use Coveralls Github Action to send test reports
2022-11-29 18:37:05 +01:00
Javi Martín
8ed8cc8b93 Use Coveralls Github Action to send test reports
Coveralls stopped working back in July when we reached build number 3790
because back when we used Travis we created builds from numbers 3791 to
35700.

After trying to change the numbers in several ways, all of them
resulting in a "No build matching CI build number" message, we're trying
the Github Action provided by Coveralls instead. In order to make it
work, we need to add the `simplecov-lcov` gem and generate the report at
`coverage/lcov.info`. Note that, for some reason, `simplecov-lcov`
doesn't seem to depend on `simplecov` and we need `simplecov` 0.18 or
later, so we're manually adding this dependency as well.
2022-11-29 14:51:22 +01:00
Javi Martín
e3aba17470 Merge pull request #5030 from consul/tenant_variants
Allow rendering different ERB files per tenant
2022-11-29 14:22:45 +01:00