Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2037 lines
70 KiB

require "rails_helper"
RSpec.describe UsersController, type: :request do
let(:user) { create(:user) }
let(:other_user) { create(:user) }
let(:headers) { { "Accept" => "text/html" } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:new_name) { "new test name" }
let(:new_email) { "new@example.com" }
let(:params) { { id: user.id, user: { name: new_name } } }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
before do
allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer)
allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client)
allow(notify_client).to receive(:send_email).and_return(true)
end
context "when user is not signed in" do
describe "#show" do
it "does not let you see user details" do
get "/users/#{user.id}", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "#edit" do
it "does not let you edit user details" do
get "/users/#{user.id}/edit", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "#password" do
it "does not let you edit user passwords" do
get "/account/edit/password", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "#patch" do
it "does not let you update user details" do
patch "/lettings-logs/#{user.id}", params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "change password" do
context "when updating a user password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: "something_else" }
}
end
before do
sign_in user
put "/account", headers:, params:
end
it "renders the user change password view" do
expect(page).to have_css("h1", class: "govuk-heading-l", text: "Change your password")
end
it "shows an error on the same page if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_css("h1", class: "govuk-heading-l", text: "Change your password")
expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_content("passwords you entered do not match")
end
end
end
describe "title link" do
CLDC-3116 Create homepage (#2113) * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break * CLDC-2593 Add upcoming deadlines section (#2119) * Add upcoming deadlines section * Update the content to use the correct dates * Update content * lint * typos * CLDC-2252 Add homepage task section (#2115) * feat: wip add lettings, sales and schemes sections with correct text, counts, links and colouring * feat: add flex styling to match designs * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * feat: update breakpoints for responsive layout changes * lint: use hash lookup where possible * lint: erblinting * feat: improve formatting * Reuse govuk grid * Revert "Reuse govuk grid" This reverts commit 8c71f5d9edf261802a8a86e07c13552f51283668. * feat: test home page data boxes * refactor: lint * refactor: lint * feat: test link behaviour is correct in all user scenarios * refactor: lint * feat: update tests * feat: combine task, resources, deadlines sections --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com> * CLDC-2255 Add homepage notifications (#2131) * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: default p tag around sanitized page content * feat: add active scope * feat: use newest active unread/unauthenticated notification and update start page * feat: add tests of notification behaviour and routing and refactor * refactor: lint * feat: update Gemfile.lock * feat: add timestamps to readmark table * feat: update gemfile.lock * refactor: lint * feat: test notifications page doesn't show notifications and code simplification * feat: move notification helper methods to notifications_helper.rb --------- Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * feat: clear all no-status filters on in progress links * CLDC-2590 Add about this service section (#2124) * Add about core section * Move about core to the correct spot on start page * Update content * Add some margins --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com>
10 months ago
it "routes user to the home page" do
sign_in user
get "/", headers:, params: {}
CLDC-3116 Create homepage (#2113) * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break * CLDC-2593 Add upcoming deadlines section (#2119) * Add upcoming deadlines section * Update the content to use the correct dates * Update content * lint * typos * CLDC-2252 Add homepage task section (#2115) * feat: wip add lettings, sales and schemes sections with correct text, counts, links and colouring * feat: add flex styling to match designs * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * feat: update breakpoints for responsive layout changes * lint: use hash lookup where possible * lint: erblinting * feat: improve formatting * Reuse govuk grid * Revert "Reuse govuk grid" This reverts commit 8c71f5d9edf261802a8a86e07c13552f51283668. * feat: test home page data boxes * refactor: lint * refactor: lint * feat: test link behaviour is correct in all user scenarios * refactor: lint * feat: update tests * feat: combine task, resources, deadlines sections --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com> * CLDC-2255 Add homepage notifications (#2131) * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: default p tag around sanitized page content * feat: add active scope * feat: use newest active unread/unauthenticated notification and update start page * feat: add tests of notification behaviour and routing and refactor * refactor: lint * feat: update Gemfile.lock * feat: add timestamps to readmark table * feat: update gemfile.lock * refactor: lint * feat: test notifications page doesn't show notifications and code simplification * feat: move notification helper methods to notifications_helper.rb --------- Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * feat: clear all no-status filters on in progress links * CLDC-2590 Add about this service section (#2124) * Add about core section * Move about core to the correct spot on start page * Update content * Add some margins --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com>
10 months ago
expect(path).to eq("/")
expect(page).to have_content("Welcome back")
3 years ago
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
describe "#deactivate" do
it "does not let you see deactivate page" do
get "/users/#{user.id}/deactivate", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "#reactivate" do
it "does not let you see reactivate page" do
get "/users/#{user.id}/reactivate", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end
describe "#resend_invite" do
it "does not allow resending activation emails" do
get deactivate_user_path(user.id), headers: headers, params: {}
expect(response).to redirect_to(new_user_session_path)
end
end
end
context "when user is signed in as a data provider" do
describe "#show" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}", headers:, params: {}
end
it "show the user details" do
expect(page).to have_content("Your account")
end
it "allows changing name, email and password" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).to have_link("Change", text: "password")
expect(page).not_to have_link("Change", text: "role")
expect(page).not_to have_link("Change", text: "if data protection officer")
expect(page).not_to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "does not allow deactivating the user" do
expect(page).not_to have_link("Deactivate user", href: "/users/#{user.id}/deactivate")
end
it "does not allow resending invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when user is deactivated" do
before do
user.update!(active: false)
get "/users/#{user.id}", headers:, params: {}
end
it "does not allow reactivating the user" do
expect(page).not_to have_link("Reactivate user", href: "/users/#{user.id}/reactivate")
end
it "does not allow resending invitation emails" do
expect(page).not_to have_link("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
context "when the user does not have a role because they are a data protection officer only" do
let(:user) { create(:user, role: nil) }
before do
sign_in user
get "/users/#{user.id}", headers:, params: {}
end
it "shows their details" do
expect(response).to have_http_status(:ok)
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}", headers:, params: {}
end
context "when the user is part of the same organisation" do
let(:other_user) { create(:user, organisation: user.organisation) }
it "shows their details" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("#{other_user.name}’s account")
end
it "does not have edit links" do
expect(page).not_to have_link("Change", text: "name")
expect(page).not_to have_link("Change", text: "email address")
expect(page).not_to have_link("Change", text: "telephone number")
expect(page).not_to have_link("Change", text: "password")
expect(page).not_to have_link("Change", text: "role")
expect(page).not_to have_link("Change", text: "if data protection officer")
expect(page).not_to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "does not allow deactivating the user" do
expect(page).not_to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
context "when user is deactivated" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}", headers:, params: {}
end
it "does not allow reactivating the user" do
expect(page).not_to have_link("Reactivate user", href: "/users/#{other_user.id}/reactivate")
end
it "does not allow resending invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
context "when the user is not part of the same organisation" do
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
it "shows the 404 view" do
expect(page).to have_content("Page not found")
end
end
end
end
describe "#edit" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}/edit", headers:, params: {}
end
it "show the edit personal details page" do
expect(page).to have_content("Change your personal details")
end
it "has fields for name and email" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).not_to have_field("user[role]")
expect(page).not_to have_field("user[is_dpo]")
expect(page).not_to have_field("user[is_key_contact]")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}/edit", headers:, params: {}
end
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
end
end
describe "#edit_password" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/account/edit/password", headers:, params: {}
end
it "shows the edit password page" do
expect(page).to have_content("Change your password")
end
it "shows the password requirements hint" do
expect(page).to have_css("#user-password-hint")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}/edit", headers:, params: {}
end
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
end
end
describe "#update" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "updates the user" do
user.reload
expect(user.name).to eq(new_name)
end
it "tracks who updated the record" do
user.reload
whodunnit_actor = user.versions.last.actor
expect(whodunnit_actor).to be_a(User)
expect(whodunnit_actor.id).to eq(user.id)
end
context "when user changes email, dpo, key_contact" do
let(:params) { { id: user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
it "allows changing email but not dpo or key_contact" do
user.reload
expect(user.unconfirmed_email).to eq(new_email)
expect(user.is_data_protection_officer?).to be false
expect(user.is_key_contact?).to be false
end
end
end
context "when the update fails to persist" do
before do
sign_in user
allow(User).to receive(:find_by).and_return(user)
allow(user).to receive(:update).and_return(false)
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "show an error" do
expect(response).to have_http_status(:unprocessable_entity)
end
end
context "when the current user does not match the user ID" do
let(:params) { { id: other_user.id, user: { name: new_name } } }
before do
sign_in user
3 years ago
patch "/users/#{other_user.id}", headers:, params:
end
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
end
context "when we update the user password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: "something_else" }
}
end
before do
sign_in user
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
end
describe "#create" do
let(:params) do
{
"user": {
name: "new user",
email: "new_user@example.com",
role: "data_coordinator",
},
}
end
3 years ago
let(:request) { post "/users/", headers:, params: }
before do
sign_in user
end
it "does not invite a new user" do
expect { request }.not_to change(User, :count)
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
end
context "when user is signed in as a data coordinator" do
let(:user) { create(:user, :data_coordinator, email: "coordinator@example.com", organisation: create(:organisation, :without_dpc)) }
let!(:other_user) { create(:user, organisation: user.organisation, name: "filter name", email: "filter@example.com") }
describe "#index" do
before do
sign_in user
end
context "when there are no url params" do
before do
get "/users", headers:, params: {}
end
it "redirects to the organisation user path" do
follow_redirect!
expect(path).to match("/organisations/#{user.organisation.id}/users")
end
it "does not show the download csv link" do
expect(page).not_to have_link("Download (CSV)", href: "/users.csv")
end
it "shows a search bar" do
follow_redirect!
expect(page).to have_field("search", type: "search")
end
end
context "when a search parameter is passed" do
let!(:other_user_2) { create(:user, organisation: user.organisation, name: "joe", email: "other@example.com") }
let!(:other_user_3) { create(:user, name: "User 5", organisation: user.organisation, email: "joe@example.com") }
let!(:other_org_user) { create(:user, name: "User 4", email: "joe@otherexample.com") }
before do
get "/organisations/#{user.organisation.id}/users?search=#{search_param}"
end
context "when our search string matches case" do
let(:search_param) { "filter" }
it "returns only matching results" do
expect(page).not_to have_content(user.name)
expect(page).to have_content(other_user.name)
end
it "updates the table caption" do
expect(page).to have_content("1 user matching search")
end
end
context "when we need case insensitive search" do
let(:search_param) { "Filter" }
it "returns only matching results" do
expect(page).not_to have_content(user.name)
expect(page).to have_content(other_user.name)
end
end
context "when our search term matches an email" do
let(:search_param) { "other@example.com" }
it "returns only matching result within the same organisation" do
expect(page).not_to have_content(user.name)
expect(page).to have_content(other_user_2.name)
expect(page).not_to have_content(other_user.name)
expect(page).not_to have_content(other_user_3.name)
expect(page).not_to have_content(other_org_user.name)
end
context "when our search term matches an email and a name" do
let(:search_param) { "joe" }
it "returns any results including joe within the same organisation" do
expect(page).to have_content(other_user_2.name)
expect(page).to have_content(other_user_3.name)
expect(page).not_to have_content(other_user.name)
expect(page).not_to have_content(other_org_user.name)
expect(page).not_to have_content(user.name)
end
it "updates the table caption" do
expect(page).to have_content("2 users matching search")
end
end
end
end
context "when filtering" do
context "with status filter" do
let!(:active_user) { create(:user, name: "active name", active: true, organisation: user.organisation, last_sign_in_at: Time.zone.now) }
let!(:deactivated_user) { create(:user, active: false, name: "deactivated name", organisation: user.organisation, last_sign_in_at: Time.zone.now) }
let!(:unconfirmed_user) { create(:user, last_sign_in_at: nil, name: "unconfirmed name", organisation: user.organisation) }
it "shows users for multiple selected statuses" do
get "/users?status[]=active&status[]=deactivated", headers:, params: {}
follow_redirect!
expect(page).to have_link(active_user.name)
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered active users" do
get "/users?status[]=active", headers:, params: {}
follow_redirect!
expect(page).to have_link(active_user.name)
expect(page).not_to have_link(deactivated_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered deactivated users" do
get "/users?status[]=deactivated", headers:, params: {}
follow_redirect!
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered unconfirmed users" do
get "/users?status[]=unconfirmed", headers:, params: {}
follow_redirect!
expect(page).to have_link(unconfirmed_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(deactivated_user.name)
end
it "does not reset the filters" do
get "/users?status[]=deactivated", headers:, params: {}
follow_redirect!
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
get "/users", headers:, params: {}
follow_redirect!
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
end
end
end
describe "CSV download" do
let(:headers) { { "Accept" => "text/csv" } }
let(:user) { create(:user) }
before do
sign_in user
get "/users", headers:, params: {}
end
it "returns 401 unauthorized" do
expect(response).to have_http_status(:unauthorized)
end
end
describe "#show" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}", headers:, params: {}
end
it "show the user details" do
expect(page).to have_content("Your account")
end
it "allows changing name, email, password, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "does not allow deactivating the user" do
expect(page).not_to have_link("Deactivate user", href: "/users/#{user.id}/deactivate")
end
context "when user is deactivated" do
before do
user.update!(active: false)
get "/users/#{user.id}", headers:, params: {}
end
it "does not allow reactivating the user" do
expect(page).not_to have_link("Reactivate user", href: "/users/#{user.id}/reactivate")
end
it "does not allow resending invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}", headers:, params: {}
end
context "when the user is part of the same organisation as the current user" do
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("#{other_user.name}’s account")
end
it "allows changing name, email, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).not_to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "allows deactivating the user" do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
it "does not allow you to resend invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when user is deactivated" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}", headers:, params: {}
end
it "shows if user is not active" do
expect(page).to have_content("Deactivated")
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "allows reactivating the user" do
expect(page).to have_link("Reactivate user", href: "/users/#{other_user.id}/reactivate")
end
it "does not allow you to resend invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
it "shows the 404 view" do
expect(page).to have_content("Page not found")
end
end
end
end
describe "#edit" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}/edit", headers:, params: {}
end
it "show the edit personal details page" do
expect(page).to have_content("Change your personal details")
end
it "has fields for name, email, role, dpo and key contact" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).to have_field("user[role]")
end
it "does not allow setting the role to `support`" do
expect(page).not_to have_field("user-role-support-field")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}/edit", headers:, params: {}
end
context "when the user is part of the same organisation as the current user" do
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("Change #{other_user.name}’s personal details")
end
it "has fields for name, email, role, dpo and key contact" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).to have_field("user[role]")
end
end
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
end
end
end
describe "#edit_password" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/account/edit/password", headers:, params: {}
end
it "shows the edit password page" do
expect(page).to have_content("Change your password")
end
it "shows the password requirements hint" do
expect(page).to have_css("#user-password-hint")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
end
it "there is no route" do
expect {
3 years ago
get "/users/#{other_user.id}/password/edit", headers:, params: {}
}.to raise_error(ActionController::RoutingError)
end
end
end
describe "#update" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "updates the user" do
user.reload
expect(user.name).to eq(new_name)
end
it "tracks who updated the record" do
user.reload
whodunnit_actor = user.versions.last.actor
expect(whodunnit_actor).to be_a(User)
expect(whodunnit_actor.id).to eq(user.id)
end
context "when user changes email and dpo" do
let(:params) { { id: user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
it "allows changing email and dpo" do
user.reload
expect(user.unconfirmed_email).to eq(new_email)
expect(user.is_data_protection_officer?).to be true
expect(user.is_key_contact?).to be true
end
end
context "when we update the user password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: "something_else" }
}
end
before do
sign_in user
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
end
context "when the user is part of the same organisation as the current user" do
it "updates the user" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.name }.from(other_user.name).to(new_name)
end
it "tracks who updated the record" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.versions.last.actor&.id }.from(nil).to(user.id)
end
context "when user changes email, dpo, key_contact" do
let(:params) { { id: other_user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
it "allows changing email, dpo, key_contact" do
patch "/users/#{other_user.id}", headers: headers, params: params
other_user.reload
expect(other_user.unconfirmed_email).to eq(new_email)
expect(other_user.is_data_protection_officer?).to be true
expect(other_user.is_key_contact?).to be true
end
end
it "does not bypass sign in for the coordinator" do
patch "/users/#{other_user.id}", headers: headers, params: params
follow_redirect!
expect(page).to have_content("#{other_user.reload.name}’s account")
expect(page).to have_content(other_user.reload.email.to_s)
end
context "when the data coordinator tries to update the user’s password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: new_name, name: "new name" }
}
end
it "does not update the password" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.not_to change(other_user, :encrypted_password)
end
it "does update other values" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.name }.from("filter name").to("new name")
end
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when the data coordinator edits the user" do
let(:params) do
{
id: other_user.id, user: { active: value }
}
end
context "and tries to deactivate the user" do
let(:value) { false }
it "marks user as deactivated" do
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.active }.from(true).to(false)
end
end
context "and tries to activate deactivated user" do
let(:value) { true }
before do
other_user.update!(active: false)
end
it "marks user as active" do
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.active }.from(false).to(true)
end
end
end
end
context "when the current user does not match the user ID" do
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
let(:params) { { id: other_user.id, user: { name: new_name } } }
before do
sign_in user
3 years ago
patch "/users/#{other_user.id}", headers:, params:
end
it "returns not found 404" do
expect(response).to have_http_status(:not_found)
end
end
end
end
context "when the update fails to persist" do
before do
sign_in user
allow(User).to receive(:find_by).and_return(user)
allow(user).to receive(:update).and_return(false)
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "show an error" do
expect(response).to have_http_status(:unprocessable_entity)
end
end
context "when updating telephone numbers" do
let(:params) do
{
"user": {
phone:,
},
}
end
before do
sign_in user
patch "/users/#{user.id}", headers:, params:
end
context "when telephone number is not given" do
let(:phone) { "" }
it "validates telephone number" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.blank"))
end
end
context "when telephone number is not numeric" do
let(:phone) { "randomstring" }
it "validates telephone number" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is shorter than 11 digits" do
let(:phone) { "123" }
it "validates telephone number" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is in correct format" do
let(:phone) { "012345678919" }
it "validates telephone number" do
expect(page).not_to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is in correct format and includes +" do
let(:phone) { "+12345678919" }
it "validates telephone number" do
expect(page).not_to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
end
end
describe "#create" do
let(:user) { create(:user, :data_coordinator) }
let(:params) do
{
"user": {
name: "new user ",
email: "new_user@example.com",
role: "data_coordinator",
phone: "12345678910",
},
}
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let(:personalisation) do
{
name: "new user",
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
email: params[:user][:email],
organisation: user.organisation.name,
link: include("/account/confirmation?confirmation_token="),
}
end
3 years ago
let(:request) { post "/users/", headers:, params: }
before do
sign_in user
end
it "invites a new user" do
expect { request }.to change(User, :count).by(1)
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "sends an invitation email" do
expect(notify_client).to receive(:send_email).with(email_address: params[:user][:email], template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:).once
request
end
it "creates a new scheme for user organisation with valid params" do
request
expect(User.last.name).to eq("new user")
expect(User.last.email).to eq("new_user@example.com")
expect(User.last.role).to eq("data_coordinator")
end
it "redirects back to organisation users page" do
request
expect(response).to redirect_to("/organisations/#{user.organisation.id}/users")
end
context "when the email is already taken" do
before do
create(:user, email: "new_user@example.com")
end
it "shows an error" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.email.taken"))
end
end
context "when trying to assign support role" do
let(:params) do
{
"user": {
name: "new user",
email: "new_user@example.com",
role: "support",
},
}
end
it "shows an error" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.role.invalid"))
end
end
context "when validating the required fields" do
let(:params) do
{
"user": {
name: "",
email: "",
role: "",
},
}
end
it "shows an error" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.name.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.blank"))
end
end
context "when validating telephone numbers" do
let(:params) do
{
"user": {
phone:,
},
}
end
context "when telephone number is not numeric" do
let(:phone) { "randomstring" }
it "validates telephone number" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is shorter than 11 digits" do
let(:phone) { "123" }
it "validates telephone number" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is in correct format" do
let(:phone) { "012345678919" }
it "validates telephone number" do
request
expect(page).not_to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
context "when telephone number is in correct format and includes +" do
let(:phone) { "+12345678919" }
it "validates telephone number" do
request
expect(page).not_to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.invalid"))
end
end
end
end
describe "#new" do
before do
sign_in user
end
it "cannot assign support role to the new user" do
get "/users/new"
expect(page).not_to have_field("user-role-support-field")
end
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
describe "#deactivate" do
before do
sign_in user
end
context "when the current user matches the user ID" do
before do
get "/users/#{user.id}/deactivate", headers:, params: {}
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "redirects user to user page" do
expect(response).to redirect_to("/users/#{user.id}")
end
end
context "when the current user does not match the user ID" do
before do
get "/users/#{other_user.id}/deactivate", headers:, params: {}
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "shows deactivation page with deactivate and cancel buttons for the user" do
expect(path).to include("/users/#{other_user.id}/deactivate")
expect(page).to have_content(other_user.name)
expect(page).to have_content("Are you sure you want to deactivate this user?")
expect(page).to have_button("I’m sure – deactivate this user")
expect(page).to have_link("No – I’ve changed my mind", href: "/users/#{other_user.id}")
end
end
end
describe "#reactivate" do
before do
sign_in user
end
context "when the current user does not match the user ID" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}/reactivate", headers:, params: {}
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "shows reactivation page with reactivate and cancel buttons for the user" do
expect(path).to include("/users/#{other_user.id}/reactivate")
expect(page).to have_content(other_user.name)
expect(page).to have_content("Are you sure you want to reactivate this user?")
expect(page).to have_button("I’m sure – reactivate this user")
expect(page).to have_link("No – I’ve changed my mind", href: "/users/#{other_user.id}")
end
end
end
end
context "when user is signed in as a support user" do
let(:user) { create(:user, :support, organisation: create(:organisation, :without_dpc)) }
let(:other_user) { create(:user, organisation: user.organisation, last_sign_in_at: Time.zone.now) }
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
end
describe "#index" do
let!(:other_user) { create(:user, organisation: user.organisation, name: "User 2", email: "other@example.com") }
let!(:inactive_user) { create(:user, organisation: user.organisation, active: false, name: "User 3", email: "inactive@example.com") }
let!(:other_org_user) { create(:user, name: "User 4", email: "otherorg@otherexample.com", organisation: create(:organisation, :without_dpc)) }
before do
sign_in user
get "/users", headers:, params: {}
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "shows all users" do
expect(page).to have_content(user.name)
expect(page).to have_content(other_user.name)
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(inactive_user.name)
expect(page).to have_content(other_org_user.name)
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "shows last logged in as deactivated for inactive users" do
expect(page).to have_content("Deactivated")
end
it "shows the pagination count" do
CLDC-3014 Add schemes and locations csv download functionality (#2083) * feat: add schemes and locations download links and pages * feat: update current path helper * feat: update tests for different user visibility levels * feat: update search caption tests * refactor: lint tests * refactor: lint tests * git: revert unintentional inclusion * feat: update tests * refactor: lint * feat: DRY up routing * refactor: lint * feat: add csv confirmation view * feat: add scheme csv service * feat: rename * feat: update csv service * feat: update csv service * feat: update controller and rename view * feat: update view * refactor: lint * feat: show correct headers in csv * feat: add locations and combined csv behaviour * feat: remove redundant user instance variable * feat: add scheme csv service spec * feat: add scheme email csv job tests * feat: update filters in spec * refactor: move scheme_email_csv_job_spec.rb * feat: update spec * refactor: remove blank line * feat: add nowrap to all download links * feat: update org schemes controller with org schemes (and rename for clarity) * feat: update link indentation and spec * feat: only include location LA name, and rename to location_local_authority * feat: update seed locations with westminster local authorities to avoid similar confusion to some that arose in PO review * feat: display multiple active periods on a single line * feat: display multiple active periods on a single line * feat: update line spacing in search captions * feat: replace 2/3 with full column in download page * feat: move scheme alphabeticising into manager * feat: update tests now search/filterless copy has changed * refactor: lint * refactor: lint * refactor: lint * feat: add filter alphabeticising test * feat: correct spacing
11 months ago
expect(page).to have_content("4 total users")
end
it "shows the download csv link" do
expect(page).to have_link("Download (CSV)", href: "/users.csv")
end
it "shows a search bar" do
expect(page).to have_field("search", type: "search")
end
context "when a search parameter is passed" do
before do
get "/users?search=#{search_param}"
end
context "when our search term matches a name" do
context "when our search string matches case" do
let(:search_param) { "Danny" }
it "returns only matching results" do
expect(page).to have_content(user.name)
expect(page).not_to have_content(other_user.name)
expect(page).not_to have_content(inactive_user.name)
expect(page).not_to have_content(other_org_user.name)
end
it "updates the table caption" do
expect(page).to have_content("1 user matching search")
end
it "includes the search term in the CSV download link" do
expect(page).to have_link("Download (CSV)", href: "/users.csv?search=#{search_param}")
end
end
context "when we need case insensitive search" do
let(:search_param) { "danny" }
it "returns only matching results" do
expect(page).to have_content(user.name)
expect(page).not_to have_content(other_user.name)
expect(page).not_to have_content(inactive_user.name)
expect(page).not_to have_content(other_org_user.name)
end
end
context "when our search term matches an email" do
let(:search_param) { "otherorg@otherexample.com" }
it "returns only matching result" do
expect(page).not_to have_content(user.name)
expect(page).not_to have_content(other_user.name)
expect(page).not_to have_content(inactive_user.name)
expect(page).to have_content(other_org_user.name)
end
end
context "when our search term matches an email and a name" do
let!(:other_user) { create(:user, organisation: user.organisation, name: "joe", email: "other@example.com") }
let!(:other_org_user) { create(:user, name: "User 4", email: "joe@otherexample.com", organisation: create(:organisation, :without_dpc)) }
let(:search_param) { "joe" }
it "returns any results including joe" do
expect(page).to have_content(other_user.name)
expect(page).not_to have_content(inactive_user.name)
expect(page).to have_content(other_org_user.name)
expect(page).not_to have_content(user.name)
end
it "updates the table caption" do
expect(page).to have_content("2 users matching search")
end
end
end
end
context "when filtering" do
context "with status filter" do
let!(:active_user) { create(:user, name: "active name", active: true, last_sign_in_at: Time.zone.now) }
let!(:deactivated_user) { create(:user, active: false, name: "deactivated name", last_sign_in_at: Time.zone.now) }
let!(:unconfirmed_user) { create(:user, last_sign_in_at: nil, name: "unconfirmed name") }
it "shows users for multiple selected statuses" do
get "/users?status[]=active&status[]=deactivated", headers:, params: {}
expect(page).to have_link(active_user.name)
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered active users" do
get "/users?status[]=active", headers:, params: {}
expect(page).to have_link(active_user.name)
expect(page).not_to have_link(deactivated_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered deactivated users" do
get "/users?status[]=deactivated", headers:, params: {}
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
it "shows filtered unconfirmed users" do
get "/users?status[]=unconfirmed", headers:, params: {}
expect(page).to have_link(unconfirmed_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(deactivated_user.name)
end
it "does not reset the filters" do
get "/users?status[]=deactivated", headers:, params: {}
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
get "/users", headers:, params: {}
expect(page).to have_link(deactivated_user.name)
expect(page).not_to have_link(active_user.name)
expect(page).not_to have_link(unconfirmed_user.name)
end
end
end
end
describe "CSV download" do
let(:headers) { { "Accept" => "text/csv" } }
let(:user) { create(:user, :support) }
before do
create_list(:user, 25)
sign_in user
end
context "when there is no search param" do
before do
get "/users", headers:, params: {}
end
let(:byte_order_mark) { "\uFEFF" }
it "downloads a CSV file with headers" do
csv = CSV.parse(response.body)
expect(csv.first.to_csv).to eq(
"#{byte_order_mark}id,email,name,organisation_name,role,old_user_id,is_dpo,is_key_contact,active,sign_in_count,last_sign_in_at\n",
)
end
it "downloads all users" do
csv = CSV.parse(response.body)
expect(csv.count).to eq(User.all.count + 1) # +1 for the headers
end
it "downloads organisation names rather than ids" do
csv = CSV.parse(response.body)
expect(csv.second[3]).to eq(user.organisation.name.to_s)
end
end
context "when there is a search param" do
before do
create(:user, name: "Unusual name")
get "/users?search=unusual", headers:, params: {}
end
it "downloads only the matching records" do
csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
end
end
end
describe "#show" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}", headers:, params: {}
end
it "show the user details" do
expect(page).to have_content("Your account")
end
it "allows changing name, email, password, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "does not allow deactivating the user" do
expect(page).not_to have_link("Deactivate user", href: "/users/#{user.id}/deactivate")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}", headers:, params: {}
end
context "when the user is part of the same organisation as the current user" do
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("#{other_user.name}’s account")
end
it "allows changing name, email, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).not_to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "does not show option to resend confirmation email" do
expect(page).not_to have_button("Resend invite link")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "allows deactivating the user" do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
context "when user never logged in" do
before do
other_user.update!(last_sign_in_at: nil)
get "/users/#{other_user.id}", headers:, params: {}
end
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("#{other_user.name}’s account")
end
it "allows changing name, email, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).not_to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
it "allows deactivating the user" do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
it "allows you to resend invitation emails" do
expect(page).to have_button("Resend invite link")
end
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when user is deactivated" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}", headers:, params: {}
end
it "shows if user is not active" do
expect(page).to have_content("Deactivated")
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "allows reactivating the user" do
expect(page).to have_link("Reactivate user", href: "/users/#{other_user.id}/reactivate")
end
end
end
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("#{other_user.name}’s account")
end
it "allows changing name, email, role, dpo and key contact" do
expect(page).to have_link("Change", text: "name")
expect(page).to have_link("Change", text: "email address")
expect(page).to have_link("Change", text: "telephone number")
expect(page).not_to have_link("Change", text: "password")
expect(page).to have_link("Change", text: "role")
expect(page).to have_link("Change", text: "if data protection officer")
expect(page).to have_link("Change", text: "if a key contact")
end
end
end
end
describe "#edit" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/users/#{user.id}/edit", headers:, params: {}
end
it "show the edit personal details page" do
expect(page).to have_content("Change your personal details")
end
it "has fields for name, email, role, dpo and key contact" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).to have_field("user[role]")
expect(page).to have_field("user[phone]")
end
it "allows setting the role to `support`" do
expect(page).to have_field("user-role-support-field")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
3 years ago
get "/users/#{other_user.id}/edit", headers:, params: {}
end
context "when the user is part of the same organisation as the current user" do
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("Change #{other_user.name}’s personal details")
end
it "has fields for name, email, role, dpo and key contact" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).to have_field("user[role]")
end
end
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
it "returns 200" do
expect(response).to have_http_status(:ok)
end
it "shows the user details page" do
expect(page).to have_content("Change #{other_user.name}’s personal details")
end
it "has fields for name, email, role, dpo and key contact" do
expect(page).to have_field("user[name]")
expect(page).to have_field("user[email]")
expect(page).to have_field("user[role]")
end
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when trying to edit deactivated user" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}/edit", headers:, params: {}
end
it "redirects to user details page" do
expect(response).to redirect_to("/users/#{other_user.id}")
follow_redirect!
expect(page).not_to have_link("Change")
end
end
end
end
describe "#edit_password" do
context "when the current user matches the user ID" do
before do
sign_in user
3 years ago
get "/account/edit/password", headers:, params: {}
end
it "shows the edit password page" do
expect(page).to have_content("Change your password")
end
it "shows the password requirements hint" do
expect(page).to have_css("#user-password-hint")
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
end
it "there is no route" do
expect {
3 years ago
get "/users/#{other_user.id}/password/edit", headers:, params: {}
}.to raise_error(ActionController::RoutingError)
end
end
end
describe "#update" do
context "when the current user matches the user ID" do
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let(:request) { patch "/users/#{user.id}", headers:, params: }
before do
sign_in user
end
it "updates the user" do
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
request
user.reload
expect(user.name).to eq(new_name)
end
it "tracks who updated the record" do
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
request
user.reload
whodunnit_actor = user.versions.last.actor
expect(whodunnit_actor).to be_a(User)
expect(whodunnit_actor.id).to eq(user.id)
end
context "when user changes email, dpo and key contact", :aggregate_failures do
let(:params) { { id: user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let(:personalisation) do
{
name: params[:user][:name],
email: new_email,
organisation: user.organisation.name,
link: include("/account/confirmation?confirmation_token="),
}
end
before do
user.legacy_users.destroy_all
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "shows flash notice" do
patch("/users/#{other_user.id}", headers:, params:)
expect(flash[:notice]).to eq("An email has been sent to #{new_email} to confirm this change.")
end
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "sends new flow emails" do
expect(notify_client).to receive(:send_email).with(
email_address: other_user.email,
template_id: User::FOR_OLD_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID,
personalisation: {
new_email:,
old_email: other_user.email,
},
).once
expect(notify_client).to receive(:send_email).with(
email_address: new_email,
template_id: User::FOR_NEW_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID,
personalisation: {
new_email:,
old_email: other_user.email,
link: include("/account/confirmation?confirmation_token="),
},
).once
expect(notify_client).not_to receive(:send_email)
patch "/users/#{other_user.id}", headers:, params:
Cldc 1226 deactivate users (#624) * CLDC-1195: remove access keys * 🤏 content fixes (#539) * Remove ?? * Set hhmemb to totadult and tchild sum if hhmemb is not given (#540) * Set hhmemb to totadult and tchild sum if hhmemb is not given Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * lint * update method * calculate hhmemb from details provided Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> * Fix condition affects question (illness type) * map tshortfall value (#543) * Make case log status rely on subsection status so they can't get out of sync * Fix complete case log fixture * Fix Reason preference reason and lettings allocation answer option import * don't route to hbrentshortfall if hb is 7 (#544) * Age known believe import fixes (#545) * amend fixture to make test fail * fix failing test * lint fixes * Enable dynamically dependent answer options * Refactor ecstat age check * Dry depends on evaluation * Derive major repairs for import * Add white other * Set major repair date * Majorrepairs will never match * Rubocop * Cldc 1149 radio buttons filter (#548) * radio button * radio button again * rubocop versioning issue fixed * linux and darwin * Fix Gemfile * rubocop * erb lint Co-authored-by: baarkerlounger <db@slothlife.xyz> * Set tshortfall to 0 if it should exists but is not provided (#550) * Set tshortfall to 0 if it should exists but is not provided * check if tshortfall is overridden * Save correct la if postcode is invalid (#551) * Allow illness type to be refused (#553) * Radio button on log filter is now preset to "All" (#552) * Radio button on log filter is now preset to "All" * lint fixes * removed instance @ variable * CLDC-744-joint-tenancy-validation (#549) * add joint tenancy validation * fix validation and spec * improvements * updates * lint fixes * fix typo * change message displayed on hhmemb page * Add docs dir to dockerignore and cfignore (#555) * Add files via upload (#554) Adding Delta Discovery file * Improve DB seeding (#556) * Improve DB seeding * Don't seed LA Rent Ranges in test * Add navigation items helper * Fix specs and linters * Works but helper is hard to test * add check to prevent error on hhmemb if joint is nil (#560) * add failing spec * add check to prevent error on hhmemb if joint is nil * Refactor for testability * Spec nav bar highlighting from user perspective * CLDC-1218: Fix hbrentshortfall import (#558) * Infer hbrentshortfall not known if tshortfall not provided and overridden * Reorder import * Referral can be internal for homeless (#561) * Set case log ID offset at export (#562) * Make tshortfall optional based on hidden tshortfall_known question (#563) * Make tshortfall optional based on hidden tshortfall_known question * Add test for optional * Add test for JSON derived and dependent on false options * Test routing * Fix optionality * Inactive users (#564) * Allow users to be marked as inactive * Import inactive users * add missing field to seeded user for dev env * Map joint tenancy field (#565) * Use rake task to send onboarding emails (#566) * Use rake task to send onboarding emails * Wrap host lookup so it's easily stubbable * Rake task can be called outside the rails environment so need to pass host in * Not part of the usual app flow so contain to rake task * Including routes helper in a rake task is a rabbit hole * Use ENV var rather than param for host * Sort case log index table by most recent by default (#567) * Add sheltered accom field (#568) * Remove needs type question until we support supported housing logs (#569) * Fix routing for tshortfall (#571) * Fix routing for tshortfall * HB 7 and 8 don't exist in 22/23 anymore * Add visiblly hidden change link text for details known questions * Fix repeated use of Password in error summary (and use smart quotes) * Make logs link less ambiguous * Cldc 1217 retirement soft validation (#570) * Interruption screen refactor * Add test for retirement_age_for_person Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> * Rubocop * update 22-23 form * fix failures * lint fixes * remove whitespace * remove commented code * make spec file use translations instead of content * update content * lint fixes * fix typo * fix question wording * fix failing spec * add full stop Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> * Hide inactive users and allow support users to view all users (#576) * Hide inactive users and allow support users to view all users * Enable support users to invite users to any organisation * Add pagination to user views * Update config/locales/devise.en.yml Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> * remove letting_in_sheltered_accomodation field (#577) * remove letting_in_sheltered_accomodation field This field is now duplicated by the shelteredaccom field * lint fixes * fix all failing specs * Generisize pagination links * CLDC-1101: Case log filter by organisation (#522) * Rename org filter * Ensure filters work when ID is passed * UI init * Lint * Fix filter nesting * Reduce width * Set checked status of filters correctly * Test filter presence * Add filter test * Rubocop * Tweak styles for autocomplete within filter Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1224: Tenancy type and tenancy length (#578) * Fix value mapping for tenancy type 22/23 * Update secure helper * Null safe * Spec update * Update mandatory * Use helper * Remove joint tenancy hitn text and add don't know option (#579) * Export improvements (#581) * improved export - set start point for reference * remove completed status from exports * Added exception handling to export * Improved tests, replaced rescue block with Sentry Co-authored-by: Kat <katrina@madetech.com> * Update logs table column heading to say ‘Status’, not ‘Completed’ * Show ‘Data protection officer’ and/or ‘Key contact’ tags in users table * Update heading, label and hint text for user details * Fix organisation filter (#582) * Filter values correctly * Remove filter value if hidden * Return empty string rather than nil for accessible autocomplete * Additional test for accessible automcomplete defaulting * Add status tag helper * Add missing ‘or’ divider on joint tenancy question * Use dash not hyphen in answer options * CLDC-1118: Implement data export structure (CDS) (#587) Co-authored-by: Dushan Despotovic <dushan@madetech.com> * CLDC-1217: Retirement soft validation (#586) * Don't trigger soft validation if tenant prefers not to say * Update gender content * Fix spec description * Enable support users to download user details (#589) * Enable support users to download user details * Download all users * Rubocop * Preload organisations to remove n+1 queries * Confirmable (#580) * Confirmable * Remove obsolete rake task * Skip confirmation for inactive users * Send beta onboarding template if migrated from Softwire * Default controller * Use correct link * Redirect confirmation to set password * Confirm account within 3 days * Only redirect to set password if not previously set * Rubocop * Confirm factory bot users * Set password condition * Changing email requires reconfirming * No need to explicitly trigger email, devise does that for us now * Remove flash banner * Mock notify * Mock in the right spec * Test redirect and text * User is confirmable * Rubocop * Redirect to url so we don't bypass authenticity token * Update content * Add test for resend invite flow * Update link to resend confirmation email * Rename password reset resend confirmation partial * Expired link error page * Remove resend confirmation link * Update seed * Expory contact * Time zone Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * Attempt at fixing S3 error when saving Zip file (#590) * Enable better other field validation labels * Removing gaps caused by empty exports (#591) * Add Sentry instrumentation (#593) * Avoid NoMethodError when Sentry is not initialised * Instrument collection_start_year * Removes Sentry custom instrumentation * test for user being in dev env not being asked for 2fa * code for user being in dev env not being asked for 2fa * pulled out of support person context, this should work for any user in dev env * rubocop * matching wording * only support user atm need 2fa, so making this explicit * Perf (#592) * Memoize start year * Reset * Recalculate rather than reset * Fix heisenspec (order independent array comparison) (#596) * Redirect confirmed users to sign in * Add support for CSV export (#598) * Cldc 1102 admin organisations page (#557) * Get all organisations in controller * Display organisations data in the table * Route to logs for specific organisation * add tests * update spec * lint fixes * set up failing test for organisation logs page * fix failing test * write test for organisations support user page * Update a organisation page test and lint * added pagination test with next and previous links and total count for support user * test for pagination in organisations title * Added "Organisations" to to organisations page title * add pagination test for organisations page 2, remove second before block * Add the remaining pagination tests * Redirect when accessing organisation logs by non support user * Test for displaying logs for specific organisation * Add test for org name * Add a failing log filter test for specific org * Extract filter methods into a helper * Allow logs filtering for specific org * Fix test, support user was creating an extra org, remove orgs filter for specific org * Remove redundant test, lint * Reuse primary navigation component and add sub navigation for support users * allow support users edit or and add sub navigation to about this org * allow support users to access the edit org page * only allow to edit existing editable fields * display correct values in the organisations table * allow support user to update org * user table component for organisations table * use guard clause for organisation logs page * remove create a new lettings log from organisation logs * Move case logs filter from helpers to modules * lint erb * yarn lint * bring back if statement in logs controller * update modules import * let! * test for links first in the org cotroller spec * interpolate number of orgs * conditionally render sub navigation Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: Dushan Despotovic <dushan@madetech.com> Co-authored-by: JG <moarpheus@gmail.com> * Bump nokogiri from 1.13.5 to 1.13.6 (#601) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.5 to 1.13.6. - [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.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * CLDC-1124: User search (#600) * Add search by name for users Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Search is now non case sensitive * Made search work for data co-ordinators Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Refactored to scope * Added search by email Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP Commit - added test for if search term matches a name and an email address simultaneously. Also changed search result caption for organisations to display "Matches X of Y users" * Rubocop * Preload org * Linting * Refactor filtered_users into module * Only adjust query param if searched * Add data coordinator tests * Add table caption spec * Dupe attribute * Refactor into Search ViewComponent * Rubocop * Unit test user scopes Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Use dedicated styles for each navigation component * Use dedicated styles for each navigation component * Use simpler markup for table captions * Use table component for logs list * Correct markup for user and organisation tables * Email allowlist (#603) * Email allowlist * Set rails master key in deploy pipelines * CLDC-1258: Handle invalid void date during import (#604) * Now we raise an exception if a non-existing organisation is referenced by a case log * The void date is not imported if it is after the tenancy start date * make organisations list page default view for support user login (#605) * Use seperate components for primary and sub navigation * Add LA org mapping * Rubocop * User search fixes (#607) * Update query message * Add clear search link * Set input value * Use gem component * Move to list partial pattern * Partial path * Update spec * Rubocop * Unit test filter module * Rubocop * Add search result to page title if searched * Add missing horizontal rule * Use form_group attributes for search input Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> * CLDC-1225: At import updates relationship to child when a person is under 16 (#609) * Organisation search (#610) * Add search to organisations * Fix title * Spec page title * Don't seed org in test * Handles unicode characters in postcode (#612) * CSV download only includes users in search result * Updates exported fields based on May 25th feedback (#613) * Cldc 1223 pregnancy soft validations (#602) * update hard validation limits for pregnancy age, remove hard validation if there are no females at all * Add soft validations for pregnancy * make the error message consistent * Only check the values for the members with details known in the household * Show interruption screen when resident details are updated * Route back to check answers after an interruption screen and back to previous page if no is selected on the interruption screen Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * update validation messages * fix a test * fix a typo Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * Avoid variable number of columns during CSV export (#614) * CLDC-1277: no route matches bug (#615) * don't display the save and go to the next incomplete section button if it errors 🤷‍♀️ * use 2022/23c fixture for in the test * Allow support users and data coordinators to toggle active users * Add a link to deactivate page * add deactivate page * Show if user is deactivated and fix form * Show deactivated user in the user list * Show reactivate user link for deactivated users * add reactivate user page * Refactor * remove unused method, route and lint * fix routes * Only allow active users to log in * Add flash banner for successful toggle, fix styles * FIx more styling * prevent editing deactivated user * lint * reset confirmed_at, password and sign in count when deactivated. Send reactivation email if user has previously logged in * Use dash not hyphen in confirmation page button and links * Content: Deactivate/reactivate account, not the user * Send confirmation email to both, old and new email addresses * Add possessive gem for names formatting * Use hidden input field for active value * lint * Only send beta onboarding emails if the user hasn't previously logged in * Don't clear the password for deactivated user * refactor sending confirmation emails Co-authored-by: kiddhustle <kiddhustle@wiardweb.com> Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com> Co-authored-by: baarkerlounger <db@slothlife.xyz> Co-authored-by: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Co-authored-by: Ted <tedbooton@gmail.com> Co-authored-by: Dushan <dushan@madetech.com> Co-authored-by: Dushan <47317567+dushan-madetech@users.noreply.github.com> Co-authored-by: Ted-U <92022120+Ted-U@users.noreply.github.com> Co-authored-by: sona-mhclg <77793209+sona-mhclg@users.noreply.github.com> Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com> Co-authored-by: Stéphane Meny <smeny@users.noreply.github.com> Co-authored-by: JG <moarpheus@gmail.com> Co-authored-by: J G <7750475+moarpheus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ted <ted.booton@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when user has never confirmed email address" do
let(:old_email) { "old@test.com" }
let(:new_email) { "new@test.com" }
let(:other_user) { create(:user, organisation: user.organisation, email: old_email, confirmed_at: nil) }
before do
other_user.legacy_users.destroy_all
end
it "shows flash notice" do
patch("/users/#{other_user.id}", headers:, params:)
expect(flash[:notice]).to eq("An email has been sent to #{new_email} to confirm this change.")
end
it "sends new flow emails" do
expect(notify_client).to receive(:send_email).with(
email_address: new_email,
template_id: User::RECONFIRMABLE_TEMPLATE_ID,
personalisation: {
name: new_name,
email: new_email,
organisation: other_user.organisation.name,
link: include("/account/confirmation?confirmation_token="),
},
).once
expect(notify_client).to receive(:send_email).with(
email_address: old_email,
template_id: User::FOR_OLD_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID,
personalisation: {
new_email:,
old_email:,
},
).once
expect(notify_client).not_to receive(:send_email)
patch "/users/#{other_user.id}", headers:, params:
end
end
end
context "when we update the user password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: "something_else" }
}
end
before do
sign_in user
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector(".govuk-error-summary__title")
end
end
end
context "when the current user does not match the user ID" do
before do
sign_in user
end
context "when the user is part of the same organisation as the current user" do
it "updates the user" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.name }.from(other_user.name).to(new_name)
end
it "tracks who updated the record" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.versions.last.actor&.id }.from(nil).to(user.id)
end
context "when user changes email, dpo, key_contact" do
let(:params) { { id: other_user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
it "allows changing email, dpo, key_contact" do
patch "/users/#{other_user.id}", headers: headers, params: params
other_user.reload
expect(other_user.unconfirmed_email).to eq(new_email)
expect(other_user.is_data_protection_officer?).to be true
expect(other_user.is_key_contact?).to be true
end
end
it "does not bypass sign in for the support user" do
patch "/users/#{other_user.id}", headers: headers, params: params
follow_redirect!
expect(page).to have_content("#{other_user.reload.name}’s account")
expect(page).to have_content(other_user.reload.email.to_s)
end
context "when the support user tries to update the user’s password" do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: new_name, name: "new name" }
}
end
it "does not update the password" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.not_to change(other_user, :encrypted_password)
end
it "does update other values" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.name }.from("Danny Rojas").to("new name")
end
end
end
context "when the current user does not match the user ID" do
context "when the user is not part of the same organisation as the current user" do
let(:other_user) { create(:user) }
let(:params) { { id: other_user.id, user: { name: new_name } } }
before do
sign_in user
end
it "updates the user" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.name }.from(other_user.name).to(new_name)
end
it "tracks who updated the record" do
3 years ago
expect { patch "/users/#{other_user.id}", headers:, params: }
.to change { other_user.reload.versions.last.actor&.id }.from(nil).to(user.id)
end
context "when user changes email, dpo, key_contact" do
let(:params) { { id: other_user.id, user: { name: new_name, email: new_email, is_dpo: "true", is_key_contact: "true" } } }
it "allows changing email, dpo, key_contact" do
patch "/users/#{other_user.id}", headers: headers, params: params
other_user.reload
expect(other_user.unconfirmed_email).to eq(new_email)
expect(other_user.is_data_protection_officer?).to be true
expect(other_user.is_key_contact?).to be true
end
end
it "does not bypass sign in for the support user" do
patch "/users/#{other_user.id}", headers: headers, params: params
follow_redirect!
expect(page).to have_content("#{other_user.reload.name}’s account")
expect(page).to have_content(other_user.reload.email.to_s)
end
context "when the support user tries to update the user’s password", :aggregate_failures do
let(:params) do
{
id: user.id, user: { password: new_name, password_confirmation: new_name, name: "new name", email: new_email }
}
end
let(:personalisation) do
{
name: params[:user][:name],
email: new_email,
organisation: other_user.organisation.name,
link: include("/account/confirmation?confirmation_token="),
}
end
before do
other_user.legacy_users.destroy_all
end
it "shows flash notice" do
patch("/users/#{other_user.id}", headers:, params:)
expect(flash[:notice]).to eq("An email has been sent to #{new_email} to confirm this change.")
end
it "sends new flow emails" do
expect(notify_client).to receive(:send_email).with(
email_address: other_user.email,
template_id: User::FOR_OLD_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID,
personalisation: {
new_email:,
old_email: other_user.email,
},
).once
expect(notify_client).to receive(:send_email).with(
email_address: new_email,
template_id: User::FOR_NEW_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID,
personalisation: {
new_email:,
old_email: other_user.email,
link: include("/account/confirmation?confirmation_token="),
},
).once
expect(notify_client).not_to receive(:send_email)
patch "/users/#{other_user.id}", headers:, params:
end
end
end
end
end
context "when the update fails to persist" do
before do
sign_in user
allow(User).to receive(:find_by).and_return(user)
allow(user).to receive(:update).and_return(false)
3 years ago
patch "/users/#{user.id}", headers:, params:
end
it "show an error" do
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
describe "#create" do
let(:organisation) { create(:organisation, :without_dpc) }
let(:email) { "new_user@example.com" }
let(:params) do
{
"user": {
name: "new user",
email:,
role: "data_coordinator",
phone: "12345612456",
organisation_id: organisation.id,
},
}
end
3 years ago
let(:request) { post "/users/", headers:, params: }
before do
sign_in user
end
it "invites a new user" do
expect { request }.to change(User, :count).by(1)
end
it "adds the user to the correct organisation" do
request
expect(User.find_by(email:).organisation).to eq(organisation)
end
it "redirects back to users page" do
request
expect(response).to redirect_to("/users")
end
context "when validations fail" do
let(:params) do
{
"user": {
name: "",
email: "",
role: "",
phone: "",
organisation_id: nil,
},
}
end
before do
create(:user, email: "new_user@example.com")
end
it "shows an error messages for all failed validations" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.name.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.organisation_id.blank"))
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.phone.blank"))
end
end
context "when the email is already taken" do
before do
create(:user, email: "new_user@example.com")
end
it "shows an error" do
request
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.email.taken"))
end
end
context "when trying to assign support role" do
let(:params) do
{
"user": {
name: "new user",
email: "new_user@example.com",
role: "support",
},
}
end
it "creates a new support user" do
expect(User.last.role).to eq("support")
end
end
end
describe "#new" do
before do
sign_in user
create(:organisation, name: "other org")
end
context "when support user" do
it "can assign support role to the new user" do
get "/users/new"
expect(page).to have_field("user-role-support-field")
end
it "can assign organisation to the new user" do
get "/users/new"
expect(page).to have_field("user-organisation-id-field")
end
it "has all organisation names in the dropdown" do
get "/users/new"
expect(page).to have_select("user-organisation-id-field", with_options: Organisation.pluck(:name))
end
context "when organisation id is present in params and there are multiple organisations in the database" do
it "has only specific organisation name in the dropdown" do
get "/users/new", params: { organisation_id: user.organisation.id }
expect(page).to have_select("user-organisation-id-field", options: [user.organisation.name])
end
end
end
end
end
describe "title link" do
before do
sign_in user
end
CLDC-3116 Create homepage (#2113) * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break * CLDC-2593 Add upcoming deadlines section (#2119) * Add upcoming deadlines section * Update the content to use the correct dates * Update content * lint * typos * CLDC-2252 Add homepage task section (#2115) * feat: wip add lettings, sales and schemes sections with correct text, counts, links and colouring * feat: add flex styling to match designs * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * feat: update breakpoints for responsive layout changes * lint: use hash lookup where possible * lint: erblinting * feat: improve formatting * Reuse govuk grid * Revert "Reuse govuk grid" This reverts commit 8c71f5d9edf261802a8a86e07c13552f51283668. * feat: test home page data boxes * refactor: lint * refactor: lint * feat: test link behaviour is correct in all user scenarios * refactor: lint * feat: update tests * feat: combine task, resources, deadlines sections --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com> * CLDC-2255 Add homepage notifications (#2131) * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: default p tag around sanitized page content * feat: add active scope * feat: use newest active unread/unauthenticated notification and update start page * feat: add tests of notification behaviour and routing and refactor * refactor: lint * feat: update Gemfile.lock * feat: add timestamps to readmark table * feat: update gemfile.lock * refactor: lint * feat: test notifications page doesn't show notifications and code simplification * feat: move notification helper methods to notifications_helper.rb --------- Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * feat: clear all no-status filters on in progress links * CLDC-2590 Add about this service section (#2124) * Add about core section * Move about core to the correct spot on start page * Update content * Add some margins --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com>
10 months ago
it "routes user to the home page" do
get "/", headers:, params: {}
CLDC-3116 Create homepage (#2113) * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break * CLDC-2593 Add upcoming deadlines section (#2119) * Add upcoming deadlines section * Update the content to use the correct dates * Update content * lint * typos * CLDC-2252 Add homepage task section (#2115) * feat: wip add lettings, sales and schemes sections with correct text, counts, links and colouring * feat: add flex styling to match designs * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * feat: update breakpoints for responsive layout changes * lint: use hash lookup where possible * lint: erblinting * feat: improve formatting * Reuse govuk grid * Revert "Reuse govuk grid" This reverts commit 8c71f5d9edf261802a8a86e07c13552f51283668. * feat: test home page data boxes * refactor: lint * refactor: lint * feat: test link behaviour is correct in all user scenarios * refactor: lint * feat: update tests * feat: combine task, resources, deadlines sections --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com> * CLDC-2255 Add homepage notifications (#2131) * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: default p tag around sanitized page content * feat: add active scope * feat: use newest active unread/unauthenticated notification and update start page * feat: add tests of notification behaviour and routing and refactor * refactor: lint * feat: update Gemfile.lock * feat: add timestamps to readmark table * feat: update gemfile.lock * refactor: lint * feat: test notifications page doesn't show notifications and code simplification * feat: move notification helper methods to notifications_helper.rb --------- Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * feat: clear all no-status filters on in progress links * CLDC-2590 Add about this service section (#2124) * Add about core section * Move about core to the correct spot on start page * Update content * Add some margins --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com>
10 months ago
expect(path).to eq("/")
expect(page).to have_content("Welcome back")
3 years ago
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end
end