Commit Graph

18014 Commits

Author SHA1 Message Date
Javi Martín
f5484e8c76 Merge pull request #5065 from consul/dependabot/bundler/rack-2.2.6.2
Bump rack from 2.2.4 to 2.2.6.2
2023-01-20 15:35:46 +01:00
dependabot[bot]
2a13bf86ab Bump rack from 2.2.4 to 2.2.6.2
Bumps [rack](https://github.com/rack/rack) from 2.2.4 to 2.2.6.2.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/2.2.4...v2.2.6.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-20 15:19:25 +01:00
Javi Martín
128705595d Merge pull request #5063 from consul/refactor_layout_components
Make it easier to customize admin and main layouts
2023-01-16 19:52:00 +01:00
Javi Martín
967bb4d097 Use link_list to render admin login items
This way it's easier to customize this menu.
2023-01-16 14:44:05 +01:00
Javi Martín
c40c6e04e7 Move login links to components
We're trying to be consistent; in the past, we had the partials
"shared/admin_login_items", "layouts/notification_item" and
"devise/menu/login_items". Now we're moving all these partials to
components in the `Layout` namespace.
2023-01-16 14:44:05 +01:00
Javi Martín
e000bd9a61 Hide menu button to managers on small screens
This menu isn't rendered in this case, so the "menu" button to toggle it
did nothing.
2023-01-16 14:44:01 +01:00
Javi Martín
cb2aebe2c8 Fix current_user usage in management section
In the management section, `current_user` is the user impersonated by
the manager. We were deciding whether to show the admin menu depending
on the privileges of the current user, but this menu should be shown
according to the privileges of the manager who is impersonating the
user.

We're doing a similar (very subtle) change in the login items. We were
rendering the `login_items` partial passing `current_user: user`.
However, inside this method, we were using `user_signed_in`, which
ignored the `current_user` we were passing. The result was always the
same expect in tests where we manually sign in users, but we're changing
it anyway in order to reduce confusion.
2023-01-16 14:22:23 +01:00
Javi Martín
44e3a393a0 Move navigation and footer partials to components
This way it'll be easier to decide when they should be rendered.

In order to be consistent, we're using the `Layout` module for both
components; previously, the navigation partial was in the `shared`
folder while the footer partial was in the `layout` folder, which IMHO
didn't make much sense.
2023-01-16 14:22:23 +01:00
Javi Martín
64536f069c Extract component for account/admin menu links
This way we remove the duplication in the layouts which had these links.

Since we're now passing the `current_user` option to partials in all
cases, IMHO the code is easier to follow if we use the
`Layout::NotificationItemComponent` instead of its partial.
2023-01-16 14:22:23 +01:00
Javi Martín
ca28a31ee5 Extract method in admin header component 2023-01-16 14:22:23 +01:00
Javi Martín
86fd14f8f0 Move admin header partial to a component
This way it's easier to refactor it.

Note we're using `with_request_url` in the tests because the component
renders the locale switcher, which needs a URL in order to work. This
doesn't affect whether we're in the management section or not.
2023-01-16 14:22:13 +01:00
Senén Rodero Rodríguez
569138cbae Extract view into component 2023-01-16 13:36:31 +01:00
Javi Martín
7b30ab7e61 Merge pull request #4967 from consul/dependabot/bundler/master/rubocop-performance-1.14.3
Bump rubocop-performance from 1.11.4 to 1.14.3
2023-01-12 16:57:07 +01:00
decabeza
717845ff1a Change poll button if results or stats are enabled 2023-01-12 15:19:10 +01:00
Javi Martín
d27bfb2afd Merge pull request #5062 from consul/admin_menu_links
Move admin menu methods to the component
2023-01-12 15:03:36 +01:00
Javi Martín
b74d82e17b Fix extra space in admin menu code
Rubocop wasn't warning us about because I guess it thought we were
trying to align these elements.
2023-01-12 14:07:52 +01:00
Javi Martín
dbca3b5342 Move admin menu methods to the component
This way we finish what we started in commit 1046ec5e7, making the menu
easier to customize.
2023-01-12 13:45:10 +01:00
Javi Martín
e3b3a8b87a Remove no longer needed style in admin menu
We don't need it since we removed the `is-active` class in submenu items
in commit 55d2cfe5b.
2023-01-12 13:36:26 +01:00
Javi Martín
efc46fe6c8 Add Performance/StringIdentifierArgument rule
It was added in rubocop-performance 1.13.0. We were already applying it
in most places.

We aren't adding it for performance reasons but in order to make the
code more consistent.
2023-01-11 16:05:20 +01:00
dependabot[bot]
5655702c49 Bump rubocop-performance from 1.11.4 to 1.14.3
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.11.4 to 1.14.3.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.11.4...v1.14.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-11 16:05:17 +01:00
Javi Martín
b717bfbbda Merge pull request #4978 from consul/remove_github_changelog_generator
Remove Github Changelog Generator dependency
2023-01-11 15:56:26 +01:00
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