Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] dev from opf:dev #131

Merged
merged 92 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
efc1c71
Update Primer to version 0.22.1
HDinger Feb 8, 2024
0ef47db
Append the ngSelect dropdown to the dialog as it would otherwise be i…
HDinger Feb 9, 2024
33652f5
[#52287] Consent always shown in Browser language despite user's lang…
ba1ash Feb 13, 2024
3572d18
Modify set_localization to respect session[:authenticated_user_id].
ba1ash Feb 13, 2024
0054a86
Fix tests.
ba1ash Feb 13, 2024
fd44cac
Bumped version to 13.3.1
cbliard Feb 14, 2024
481dbaf
Amend release notes for 13.3.0
cbliard Feb 14, 2024
cbd433c
[52805] Fix migration error when default language is pt-br
cbliard Feb 14, 2024
2f68f69
[chore] replaced some "derived" wording with "total"
Kharonus Feb 14, 2024
19d183f
Merge pull request #14786 from opf/chore/last-minute-locale-updates
Kharonus Feb 14, 2024
f9f37ae
Merge pull request #14785 from opf/bug/52805-fix-migration-failure-wh…
machisuji Feb 14, 2024
95e2218
update locales from crowdin [ci skip]
openprojectci Feb 15, 2024
c0ba4e0
Progress reporting docs update (#14790)
MayaBerd Feb 15, 2024
6f524e9
Bump primer to 0.22.2
HDinger Feb 15, 2024
7adcbfa
update locales from crowdin [ci skip]
openprojectci Feb 16, 2024
d9985aa
Use native `showModal` function as it is the new recommended way to c…
HDinger Feb 16, 2024
e85f96e
Update Glossary
corinnaguenther Feb 16, 2024
527a4a2
Update docs/glossary/README.md
corinnaguenther Feb 16, 2024
47a58c4
Update docs/glossary/README.md
corinnaguenther Feb 16, 2024
42ebaba
update locales from crowdin [ci skip]
openprojectci Feb 17, 2024
622ba72
Merge pull request #14683 from opf/housekeeping/bump-primer
oliverguenther Feb 18, 2024
1933a6c
Merge remote-tracking branch 'origin/release/13.3' into dev
oliverguenther Feb 18, 2024
a2a121c
Revert "Update Primer to version 0.22.2"
oliverguenther Feb 18, 2024
016eb1e
Merge remote-tracking branch 'origin/release/13.3' into dev
oliverguenther Feb 18, 2024
88b63db
update locales from crowdin [ci skip]
openprojectci Feb 19, 2024
686c617
update locales from crowdin [ci skip]
openprojectci Feb 19, 2024
eb8edfc
Bump browserslist from 4.22.3 to 4.23.0 in /frontend
dependabot[bot] Feb 19, 2024
03743b3
Bump googleauth from 1.10.0 to 1.11.0
dependabot[bot] Feb 19, 2024
0048690
Merge pull request #14799 from opf/dependabot/npm_and_yarn/frontend/d…
ulferts Feb 19, 2024
232a02b
[#52527] Update documentation (#14782)
Kharonus Feb 19, 2024
161aa55
[#52442] Update classic meetings docs: "send for review" - button ht…
MayaBerd Feb 19, 2024
d62f98a
Changing Project lists documentation
MayaBerd Feb 19, 2024
6d53058
Replace empty string with "undefined" so that the uiSrefActive matche…
HDinger Feb 19, 2024
33d13cd
chore(docs): fix links
as-op Feb 19, 2024
a3bea26
Merge pull request #14804 from opf/Changing-Projects-lists-to-Project…
as-op Feb 19, 2024
c7a1a33
Revert "Try avoiding ruby segfault with brakeman"
cbliard Feb 19, 2024
e3b437e
Update docs/glossary/README.md
corinnaguenther Feb 19, 2024
bcf14cc
Update docs/glossary/README.md
corinnaguenther Feb 19, 2024
f89d6b9
Only add the default title if there was none set before (see #52765)
HDinger Feb 19, 2024
1832689
Exclude builtin sharing permissions to be selectable for group member…
HDinger Feb 19, 2024
38f9ee3
Merge pull request #14795 from opf/epic/49185-keep-glossary-updated
corinnaguenther Feb 19, 2024
8eb0566
Merge pull request #14805 from opf/bug/52758-queries-are-not-highligh…
aaron-contreras Feb 19, 2024
8c6bd62
Merge pull request #14810 from opf/bug/52834-sharing-roles-can-be-sel…
aaron-contreras Feb 19, 2024
a9b6e65
Seed global queries only when there are none
cbliard Feb 14, 2024
aba80d0
Add unit tests to ensure correct record creation
cbliard Feb 14, 2024
cebedc9
Reference standardized types and priorities on seeders
aaron-contreras Feb 14, 2024
dc6b3a7
Use better default values for seeded dev data
cbliard Feb 19, 2024
a31aa1d
Merge pull request #14808 from opf/bug/52765-when-multi-select-user-c…
aaron-contreras Feb 19, 2024
559b6d7
Merge pull request #14788 from opf/reproducing-seeding-issue
cbliard Feb 19, 2024
0c54c0c
Merge remote-tracking branch 'origin/release/13.3' into dev
cbliard Feb 19, 2024
5aefbbc
Do not try displaying local screenshot urls
cbliard Feb 19, 2024
dd0139c
Fix CKEditor crashing on click on code block border
oliverguenther Feb 19, 2024
560fab2
fix typo in docs for integrations
lindenthal Feb 19, 2024
d43f8e6
Merge pull request #14814 from opf/fix/52641/ckeditor-crash
cbliard Feb 19, 2024
2b6fa13
Take care that special code for demo project actions is really execut…
HDinger Feb 19, 2024
b8874bf
[#52448] Disable work package module does not work
ba1ash Feb 19, 2024
79691f1
Merge pull request #14801 from opf/dependabot/bundler/dev/googleauth-…
ulferts Feb 19, 2024
8b693ef
Apply suggestions from code review.
ba1ash Feb 19, 2024
1b6b23a
Apply suggestions from code review.
ba1ash Feb 19, 2024
37c46a7
Bump lookbook version and fix broken previews
oliverguenther Feb 19, 2024
3581b2f
Merge pull request #14779 from opf/bug/52287-consent-always-shown-in-…
oliverguenther Feb 19, 2024
0e14e40
update locales from crowdin [ci skip]
openprojectci Feb 20, 2024
d611f32
update locales from crowdin [ci skip]
openprojectci Feb 20, 2024
68f556e
Increase the breakpoint at which the main menu will be collapsed to t…
HDinger Feb 19, 2024
467923f
Merge pull request #14806 from opf/bug/52671-work-package-title-not-r…
HDinger Feb 20, 2024
36301f6
Merge remote-tracking branch 'origin/release/13.3' into dev
ulferts Feb 20, 2024
c8c5665
bump aws-partitions
ulferts Feb 20, 2024
ea9c2c8
bump aws-sdk-core
ulferts Feb 20, 2024
f148dfd
bump bindata
ulferts Feb 20, 2024
e12399a
bump crack
ulferts Feb 20, 2024
6a5c771
bump doorkeeper
ulferts Feb 20, 2024
fa5e24b
[#51456] Add information on renaming projects to Nextcloud guide htt…
MayaBerd Feb 20, 2024
747d495
Merge pull request #14815 from opf/bug/52448-disable-work-package-mod…
ba1ash Feb 20, 2024
d5150bf
Revert "Revert "Update Primer to version 0.22.2""
oliverguenther Feb 18, 2024
6e4a038
Revert "Revert "Update Primer to version 0.22.2""
oliverguenther Feb 18, 2024
18c2acf
Merge remote-tracking branch 'origin/release/13.3' into dev
oliverguenther Feb 20, 2024
b5059cd
Bump @floating-ui/dom from 1.6.1 to 1.6.3 in /frontend
dependabot[bot] Feb 20, 2024
85432d5
Merge pull request #14774 from opf/dependabot/npm_and_yarn/frontend/d…
ulferts Feb 20, 2024
f93df32
bump letter_opener
ulferts Feb 20, 2024
0e26189
bump parallel_tests
ulferts Feb 20, 2024
379955d
bump rack-mini-profiler
ulferts Feb 20, 2024
f653521
bump rb_sys
ulferts Feb 20, 2024
5db4fbd
bump redis-client
ulferts Feb 20, 2024
6139fa8
bump selenium-devtools
ulferts Feb 20, 2024
07cefa1
bump turbo-rails
ulferts Feb 20, 2024
124c022
bump webmock
ulferts Feb 20, 2024
2d73880
bump pg
ulferts Feb 20, 2024
0196911
bump selenium-webdriver
ulferts Feb 20, 2024
f836ad7
bump aws-sdk-sns
ulferts Feb 20, 2024
fbcadc9
rewrite budget angular service with stimulus
ulferts Feb 19, 2024
8763606
Merge pull request #14822 from opf/fix/bump_gems
ulferts Feb 20, 2024
1f7d376
Fix CD workflow (#14823)
crohr Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/brakeman-scan-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
# FIXME: remove the ruby version once '3.2.2' is released.
# This is set to head to fix ruby segfaulting when brakeman is
# used. See https://bugs.ruby-lang.org/issues/19433
ruby-version: 'head'

- name: Setup Brakeman
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
TOKEN: ${{ secrets.OPENPROJECT_CI_TOKEN }}
REPOSITORY: opf/openproject-flavours
WORKFLOW_ID: ci.yml
CORE_REF: ${{ github.ref_name }}
run: |
curl -i --fail-with-body -H"authorization: Bearer $TOKEN" \
-XPOST -H"Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/actions/workflows/$WORKFLOW_ID/dispatches \
-d '{"ref": "dev", "inputs": { "ref" : "'$CORE_REF'" }}'
-d '{"ref": "dev", "inputs": { "ref" : "${{ github.ref_name }}" }}'
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ gem 'appsignal', '~> 3.0', require: false

gem 'view_component'
# Lookbook
gem 'lookbook', github: 'ViewComponent/lookbook', ref: '473f86d7e343cd78b74cc293a4de06b9b5e7a3e2'
gem 'lookbook', '~> 2.2.1'

# Require factory_bot for usage with openproject plugins testing
gem 'factory_bot', '~> 6.4.0', require: false
Expand Down Expand Up @@ -263,7 +263,7 @@ group :test do
gem 'capybara-screenshot', '~> 1.0.17'
gem 'cuprite', '~> 0.15.0'
gem 'selenium-devtools'
gem 'selenium-webdriver', '~> 4.17.0'
gem 'selenium-webdriver', '~> 4.18.0'

gem 'fuubar', '~> 2.5.0'
gem 'timecop', '~> 0.9.0'
Expand Down Expand Up @@ -382,4 +382,4 @@ end

gem 'openproject-octicons', '~>19.8.0'
gem 'openproject-octicons_helper', '~>19.8.0'
gem 'openproject-primer_view_components', '~>0.20.0'
gem 'openproject-primer_view_components', '~>0.22.2'
82 changes: 39 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
GIT
remote: https://github.com/ViewComponent/lookbook.git
revision: 473f86d7e343cd78b74cc293a4de06b9b5e7a3e2
ref: 473f86d7e343cd78b74cc293a4de06b9b5e7a3e2
specs:
lookbook (2.2.0)
activemodel
css_parser
htmlbeautifier (~> 1.3)
htmlentities (~> 4.3.4)
marcel (~> 1.0)
railties (>= 5.0)
redcarpet (~> 3.5)
rouge (>= 3.26, < 5.0)
view_component (>= 2.0)
yard (~> 0.9.25)
zeitwerk (~> 2.5)

GIT
remote: https://github.com/citizensadvice/capybara_accessible_selectors
revision: 621e394ff9bafb420fb15792c3a3e3334a618687
Expand Down Expand Up @@ -219,7 +201,7 @@ PATH
remote: modules/two_factor_authentication
specs:
openproject-two_factor_authentication (1.0.0)
aws-sdk-sns (~> 1.71.0)
aws-sdk-sns (~> 1.72.0)
messagebird-rest (~> 1.4.2)
rotp (~> 6.1)

Expand Down Expand Up @@ -351,11 +333,12 @@ GEM
awesome_nested_set (3.6.0)
activerecord (>= 4.0.0, < 7.2)
aws-eventstream (1.3.0)
aws-partitions (1.888.0)
aws-sdk-core (3.191.1)
aws-partitions (1.894.0)
aws-sdk-core (3.191.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
base64
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.77.0)
aws-sdk-core (~> 3, >= 3.191.0)
Expand All @@ -364,7 +347,7 @@ GEM
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sdk-sns (1.71.0)
aws-sdk-sns (1.72.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.8.0)
Expand All @@ -390,7 +373,7 @@ GEM
parser (>= 2.4)
smart_properties
bigdecimal (3.1.6)
bindata (2.4.15)
bindata (2.5.0)
bootsnap (1.18.3)
msgpack (~> 1.2)
brakeman (6.1.2)
Expand Down Expand Up @@ -435,7 +418,7 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
cookiejar (0.3.4)
crack (0.4.6)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
Expand Down Expand Up @@ -469,7 +452,7 @@ GEM
disposable (0.6.3)
declarative (>= 0.0.9, < 1.0.0)
representable (>= 3.1.1, < 4)
doorkeeper (5.6.8)
doorkeeper (5.6.9)
railties (>= 5)
dotenv (3.0.2)
dotenv-rails (3.0.2)
Expand Down Expand Up @@ -588,7 +571,7 @@ GEM
google-apis-core (>= 0.12.0, < 2.a)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
googleauth (1.10.0)
googleauth (1.11.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand All @@ -614,7 +597,7 @@ GEM
html-pipeline (2.14.3)
activesupport (>= 2)
nokogiri (>= 1.4)
htmlbeautifier (1.4.2)
htmlbeautifier (1.4.3)
htmldiff (0.0.1)
htmlentities (4.3.4)
http-2-next (1.0.3)
Expand Down Expand Up @@ -666,14 +649,15 @@ GEM
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (2.7.1)
jwt (2.8.0)
base64
ladle (1.0.1)
open4 (~> 1.0)
language_server-protocol (3.17.0.3)
launchy (2.5.2)
addressable (~> 2.8)
lefthook (1.6.1)
letter_opener (1.8.1)
letter_opener (1.9.0)
launchy (>= 2.2, < 3)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
Expand All @@ -690,6 +674,18 @@ GEM
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lookbook (2.2.1)
activemodel
css_parser
htmlbeautifier (~> 1.3)
htmlentities (~> 4.3.4)
marcel (~> 1.0)
railties (>= 5.0)
redcarpet (~> 3.5)
rouge (>= 3.26, < 5.0)
view_component (>= 2.0)
yard (~> 0.9.25)
zeitwerk (~> 2.5)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
Expand Down Expand Up @@ -756,7 +752,7 @@ GEM
actionview
openproject-octicons (= 19.8.0)
railties
openproject-primer_view_components (0.20.0)
openproject-primer_view_components (0.22.2)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.8.0)
Expand All @@ -769,7 +765,7 @@ GEM
activerecord (>= 6.1)
request_store (~> 1.4)
parallel (1.24.0)
parallel_tests (4.5.0)
parallel_tests (4.5.1)
parallel
parser (3.3.0.5)
ast (~> 2.4.1)
Expand All @@ -783,7 +779,7 @@ GEM
hashery (~> 2.0)
ruby-rc4
ttfunk
pg (1.5.4)
pg (1.5.5)
plaintext (0.3.4)
activesupport (> 2.2.1)
nokogiri (~> 1.10, >= 1.10.4)
Expand Down Expand Up @@ -831,7 +827,7 @@ GEM
rack (>= 1.0, < 4)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-mini-profiler (3.3.0)
rack-mini-profiler (3.3.1)
rack (>= 1.2.0)
rack-oauth2 (2.2.1)
activesupport
Expand Down Expand Up @@ -895,15 +891,15 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rb_sys (0.9.87)
rb_sys (0.9.88)
rbtree3 (0.7.1)
rdoc (6.6.2)
psych (>= 4.0.0)
recaptcha (5.16.0)
redcarpet (3.6.0)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.19.1)
redis-client (0.20.0)
connection_pool
regexp_parser (2.9.0)
reline (0.4.2)
Expand Down Expand Up @@ -999,9 +995,9 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
secure_headers (6.5.0)
selenium-devtools (0.121.0)
selenium-devtools (0.122.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.17.0)
selenium-webdriver (4.18.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
Expand All @@ -1010,7 +1006,7 @@ GEM
shoulda-context (2.0.0)
shoulda-matchers (6.1.0)
activesupport (>= 5.2.0)
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
Expand Down Expand Up @@ -1059,7 +1055,7 @@ GEM
timeout (0.4.1)
trailblazer-option (0.1.2)
ttfunk (1.7.0)
turbo-rails (2.0.2)
turbo-rails (2.0.3)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -1098,7 +1094,7 @@ GEM
activesupport
faraday (~> 2.0)
faraday-follow_redirects
webmock (3.20.0)
webmock (3.21.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down Expand Up @@ -1195,7 +1191,7 @@ DEPENDENCIES
letter_opener
listen (~> 3.8.0)
lograge (~> 0.14.0)
lookbook!
lookbook (~> 2.2.1)
mail (= 2.8.1)
matrix (~> 0.4.2)
md_to_pdf!
Expand Down Expand Up @@ -1227,7 +1223,7 @@ DEPENDENCIES
openproject-octicons (~> 19.8.0)
openproject-octicons_helper (~> 19.8.0)
openproject-openid_connect!
openproject-primer_view_components (~> 0.20.0)
openproject-primer_view_components (~> 0.22.2)
openproject-recaptcha!
openproject-reporting!
openproject-storages!
Expand Down Expand Up @@ -1284,7 +1280,7 @@ DEPENDENCIES
sanitize (~> 6.1.0)
secure_headers (~> 6.5.0)
selenium-devtools
selenium-webdriver (~> 4.17.0)
selenium-webdriver (~> 4.18.0)
semantic (~> 1.6.1)
shoulda-context (~> 2.0)
shoulda-matchers (~> 6.0)
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,15 @@ def reset_i18n_fallbacks
end

def set_localization
SetLocalizationService.new(User.current, request.env['HTTP_ACCEPT_LANGUAGE']).call
# 1. Use completely autheticated user
# 2. Use user with some authenticated stages not compelted.
# In this case user is not considered logged in, but identified.
# It covers localization for extra authentication stages(like :consent, for example)
# 3. Use anonymous instance.
user = RequestStore[:current_user] ||
(session[:authenticated_user_id].present? && User.find_by(id: session[:authenticated_user_id])) ||
User.anonymous
SetLocalizationService.new(user, request.env['HTTP_ACCEPT_LANGUAGE']).call
end

def deny_access(not_found: false)
Expand Down
28 changes: 28 additions & 0 deletions app/controllers/concerns/accounts/authentication_stages.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module Accounts::AuthenticationStages
def successful_authentication(user, reset_stages: true, just_registered: false)
stages = authentication_stages after_activation: just_registered, reset: reset_stages
Expand Down
25 changes: 2 additions & 23 deletions app/controllers/concerns/accounts/user_consent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module Accounts::UserConsent
include ::UserConsentHelper

def consent
if consent_required?
render 'account/consent', locals: { consenting_user: }
if user_consent_required? && consenting_user&.consent_expired?
render 'account/consent'
else
consent_finished
end
Expand All @@ -50,14 +50,6 @@ def confirm_consent
end
end

def consent_required?
# Ensure consent is enabled and a text is provided
return false unless user_consent_required?

# Require the user to consent if he hasn't already
consent_expired?
end

def decline_consent
message = I18n.t('consent.decline_warning_message') + "\n"
message <<
Expand All @@ -71,19 +63,6 @@ def decline_consent
redirect_to authentication_stage_failure_path :consent
end

def consent_expired?
consented_at = consenting_user.try(:consented_at)

# Always if the user has not consented
return true if consented_at.blank?

# Did not expire if no consent_time set, but user has consented at some point
return false if Setting.consent_time.blank?

# Otherwise, expires when consent_time is newer than last consented_at
consented_at < Setting.consent_time
end

def consenting_user
User.find_by id: session[:authenticated_user_id]
end
Expand Down
Loading
Loading