Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: DAH-2876 useRedirect for authenticated pages #2488

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
99e823c
feat: DAH-2876 useRedirect for authenticated pages
cade-exygy Jan 7, 2025
b97e876
fix: translations
cade-exygy Jan 8, 2025
8e6a74b
feat: use token for auth check
cade-exygy Jan 23, 2025
caba50e
feat: HOC withAuthentication
cade-exygy Jan 23, 2025
a086a37
clean: remove unused hook
cade-exygy Jan 23, 2025
1137a56
fix: tests
cade-exygy Jan 31, 2025
81eac08
fix: add back banner
cade-exygy Feb 3, 2025
bbb4c2d
fix: tests
cade-exygy Feb 3, 2025
a9c5089
fix: test
cade-exygy Feb 3, 2025
1231935
fix: DAH-3097 FCFS link color contrast accessibility (#2482)
cliu02 Jan 7, 2025
f490077
feat: DAH-2982 directory page empty state (#2462)
tallulahkay Jan 8, 2025
21318a1
fix: DAH-3118 update scroll behavior (#2477)
tallulahkay Jan 8, 2025
2941219
feat: DAH-3041 remove field error on sign in page (#2471)
tallulahkay Jan 8, 2025
e26bf09
feat: DAH-3014 Listing detail event analytics (#2487)
chadbrokaw Jan 8, 2025
bbe88d7
fix: DAH-2738 hide listing details apply in mobile (#2490)
tallulahkay Jan 8, 2025
3cb0467
fix: DAH-3014 Fix undefined lottery preferences bug (#2491)
chadbrokaw Jan 9, 2025
ae3e002
feat: DAH-3109 auto open on button navigation and highlight on moveme…
tallulahkay Jan 10, 2025
8410de8
feat: DAH-3077 DALP hide lottery prefs section and skip validate hous…
tallulahkay Jan 10, 2025
943241d
feat: DAH-2985 Autofill email for forgot password (#2485)
chadbrokaw Jan 14, 2025
f890d85
feat: DAH-3073 DALP priority data (#2493)
tallulahkay Jan 14, 2025
f7c0ffe
feat: DAH-3088 retrieve DALP loan officers (#2495)
tallulahkay Jan 14, 2025
14803de
feat: DAH-3079 Change terms page for DALP listings (#2499)
chadbrokaw Jan 15, 2025
6e90ce7
fix: DAH-3148 Send Listing Type in GTM (#2494)
chadbrokaw Jan 15, 2025
cc87461
feat: DAH-3122 Log Potential Google Translate API Usage (#2486)
jimlin-sfgov Jan 15, 2025
192faf7
feat: DAH-3075 add dalp text to what to expect (#2496)
tallulahkay Jan 15, 2025
5cf702d
feat: DAH-3103 remove work in sf question (#2497)
tallulahkay Jan 15, 2025
1c3757d
feat: DAH-3157 use new document types for dalp (#2500)
tallulahkay Jan 15, 2025
8b5dd5d
feat: DAH-2987 Reset password api (#2461)
chadbrokaw Jan 16, 2025
66019fd
feat: DAH-3093 Update demographics description in application summary…
cliu02 Jan 16, 2025
f9ea085
fix: DAH-3122 Prevent translation rake tasks from triggering page_vie…
jimlin-sfgov Jan 17, 2025
ee76121
urgent: fix e2e fixture (#2507)
tallulahkay Jan 17, 2025
de24308
fix: DAH-3176 hide directory 1.5 change (#2508)
tallulahkay Jan 21, 2025
68a149f
urgent: add checklist item for PA testing (#2506)
tallulahkay Jan 22, 2025
f41e7b3
fix: DAH-3111 Clear error message on Sign In (#2481)
cliu02 Jan 22, 2025
ae2151d
feat: DAH-3083 remove preferences in DALP application summary (#2492)
cliu02 Jan 22, 2025
3f4f122
fix: DAH-3181 Handle invalid listings when logging translation usage …
jimlin-sfgov Jan 22, 2025
4d60e84
feat: DAH-3087 Remove back link on DALP listings (#2502)
chadbrokaw Jan 23, 2025
76af9f8
fix: DAH-2865 translations fixes (#2473)
tallulahkay Jan 23, 2025
413731c
fix: DAH-2867 make height auto on my accounts dashboard (#2475)
tallulahkay Jan 23, 2025
5d4eb8c
fix: DAH-2868 status formatting (#2474)
tallulahkay Jan 24, 2025
8019dbe
fix: DAH-3158 open sections upon navigation (#2504)
tallulahkay Jan 24, 2025
7dcb7ae
feat: DAH-3110 make enter submit (#2479)
tallulahkay Jan 27, 2025
822c2f1
fix: DAH-3193 change naming (#2518)
tallulahkay Jan 28, 2025
048e88b
feat: DAH-3090 DAH-3076 DALP Qualify Checkbox Conditional Language (#…
tallulahkay Jan 28, 2025
fd3a3ca
fix: DAH-3190 Use translations on confirmation modals (#2519)
chadbrokaw Jan 28, 2025
0c92c8d
feat: DAH-3055 Analytics for log in and log out (#2511)
chadbrokaw Jan 29, 2025
5048264
feat: DAH-3080 DALP for My Applications page (#2509)
cliu02 Jan 29, 2025
db30bc8
fix: DAH-3187 update FCFS how to apply link translations (#2513)
cliu02 Jan 29, 2025
8c83653
feat: DAH-3091 Human Translations 2024-12-02 (#2514)
jimlin-sfgov Jan 29, 2025
4bc7026
feat: DAH-3082 add dalp priority to conf page (#2522)
tallulahkay Jan 30, 2025
4543971
fix: DAH-2866 fix formatting (#2476)
tallulahkay Jan 30, 2025
f3176b6
feat: DAH-3084 confirmation page DALP (#2521)
tallulahkay Jan 31, 2025
8bdbd54
feat: DAH-3074 DALP Application Question (#2530)
jimlin-sfgov Feb 1, 2025
43b0289
urgent: upgdate circle config (#2534)
tallulahkay Feb 3, 2025
e6dbd7b
feat: DAH-3169 default to sf gov listing (#2532)
tallulahkay Feb 4, 2025
492e08d
feat: DAH-3132 Update icon (#2536)
tallulahkay Feb 5, 2025
e7b2173
feat: DAH-3085 DALP confirmation email (#2531)
tallulahkay Feb 5, 2025
bba991f
fix: DAH-3191 fix email address for lottery appeals (#2540)
tallulahkay Feb 5, 2025
950eff2
feat: DAH-3201 Application Summary Edit button should take user to DA…
jimlin-sfgov Feb 6, 2025
60dd7dc
feat: DAH-2826 Auto populate user (#2527)
chadbrokaw Feb 6, 2025
af1e40e
fix: DAH-3207 Use NPM Chromedriver for Protractor (#2544)
jimlin-sfgov Feb 6, 2025
051e29f
fix: test conflicts
cade-exygy Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1
orbs:
ruby: circleci/[email protected]
cypress: cypress-io/[email protected]
browser-tools: circleci/browser-tools@1.2.2
browser-tools: circleci/browser-tools@1.4.4
defaults: &defaults
working_directory: ~/web
docker:
Expand Down Expand Up @@ -98,7 +98,7 @@ commands:
- run:
command: |
./node_modules/protractor/bin/webdriver-manager clean
./node_modules/protractor/bin/webdriver-manager update --versions.chrome 2.41 --versions.standalone 3.141.59
./node_modules/protractor/bin/webdriver-manager update --versions.standalone 4.0.0-alpha-2
./node_modules/protractor/bin/webdriver-manager status
upgrade-bundler:
description: Upgrade bundler
Expand Down
12 changes: 9 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _just one or two sentences_

https://sfgovdt.jira.com/browse/<JIRA TICKET NUMBER>

## Checklist before requesting review
## Before requesting eng review

### Version Control

Expand All @@ -20,16 +20,22 @@ https://sfgovdt.jira.com/browse/<JIRA TICKET NUMBER>
- [ ] all automated code checks pass (linting, tests, coverage, etc.)
- [ ] code irrelevant to the ticket is not modified e.g. changing indentation due to automated formatting
- [ ] if the code changes the UI, it matches the UI design exactly
- [ ] if the changes include human translations, follow the [human translations process](https://sfgovdt.jira.com/l/cp/XS1KpvE4)

### Review instructions

- [ ] instructions specify which environment(s) it applies to
- [ ] instructions work for PA testers
- [ ] instructions have already been performed at least once

### Request review
### Request eng review

- [ ] PR has `needs review` label
- [ ] Use `Housing Eng` group to automatically assign reviewers, and/or assign specific engineers
- [ ] If time sensitive, notify engineers in Slack

## Before merging

### Request product acceptance testing

- [ ] Code change is behind a feature flag
- [ ] If code change is not behind a feature flag, it has been PA tested in the review environment (use `needs product acceptance` label to indicate that the PR is waiting for PA testing)
4 changes: 3 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
listener: bundle exec rake translate:subscribe
# TODO: switch listener task back to `subscribe` after we are done logging translate usage
# listener: bundle exec rake translate:subscribe
listener: bundle exec rake translate:log_usage
release: bundle exec rake db:migrate
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"heroku-postgresql"
],
"scripts": {
"postdeploy": "rake db:migrate"
"postdeploy": "rake db:migrate && rake preload:user"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions app/assets/images/house-circle-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions app/assets/javascripts/account/AccountService.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ AccountService = (
bsLoadingOverlayService,
ShortFormApplicationService,
ShortFormDataService,
ModalService
ModalService,
AnalyticsService
) ->
Service = {}
# userAuth is used as model for inputs in create-account form
Expand Down Expand Up @@ -85,10 +86,17 @@ AccountService = (
# reset userAuth object
angular.copy(Service.userAuthDefaults, Service.userAuth)
if response.signedIn
AnalyticsService.trackEvent('login_succeeded', { origin: 'Application Sign In', user_id: response.id })
Service.setLoggedInUser(response)
Service._reformatDOB()
return true
).catch((response) ->

AnalyticsService.trackEvent("login_failed", {
user_id: null,
origin: 'Application Sign In',
error_reason: response?.reason || undefined,
})
# for errors we manually stop the loading overlay
bsLoadingOverlayService.stop()
return false
Expand Down Expand Up @@ -146,6 +154,7 @@ AccountService = (
# reset the user data immediately, then call signOut
Service.setLoggedInUser({})
ShortFormApplicationService.resetApplicationData() unless opts.preserveAppData
AnalyticsService.trackEvent('logout', {reason: "Angular logout"})
$auth.signOut()
# close any open modal, e.g. "Lottery Results" that may have been opened while
# you were on My Applications
Expand Down Expand Up @@ -322,7 +331,7 @@ AccountService = (

AccountService.$inject = [
'$state', '$auth', '$http', '$translate', '$window', 'bsLoadingOverlayService'
'ShortFormApplicationService', 'ShortFormDataService', 'ModalService'
'ShortFormApplicationService', 'ShortFormDataService', 'ModalService', 'AnalyticsService'
]

angular
Expand Down
12 changes: 10 additions & 2 deletions app/assets/javascripts/config/angularInitialize.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
else if ShortFormApplicationService.isShortFormPage($state.current)
# we don't want to show the beforeunload dialog, because it would allow the applicant to stay on the page after session expiration
$window.removeEventListener('beforeunload', ShortFormApplicationService.onExit)
$state.go('dahlia.listing', {timeout: true, id: ShortFormApplicationService.listing.Id})
if ShortFormApplicationService.listingIsDalp()
$window.location.href = ShortFormApplicationService.localizedSfGovUrl("apply-downpayment-loan-buy-market-rate-home")
else
$state.go('dahlia.listing', {timeout: true, id: ShortFormApplicationService.listing.Id})

$rootScope.$on '$stateChangeStart', (e, toState, toParams, fromState, fromParams) ->
# always start the loading overlay
Expand Down Expand Up @@ -106,7 +109,10 @@
if ShortFormApplicationService.hittingBackFromConfirmation(fromState, toState)
# the redirect will trigger $stateChangeStart again and will popup the confirmation alert
e.preventDefault()
$state.go('dahlia.listing', {id: ShortFormApplicationService.listing.listingID})
if ShortFormApplicationService.listingIsDalp()
$window.location.href = ShortFormApplicationService.localizedSfGovUrl("apply-downpayment-loan-buy-market-rate-home")
else
$state.go('dahlia.listing', {id: ShortFormApplicationService.listing.listingID})

else if (ShortFormApplicationService.isLeavingShortForm(toState, fromState))
content =
Expand Down Expand Up @@ -180,6 +186,8 @@
if !ShortFormApplicationService.authorizedToProceed(toState, fromState, toSection)
e.preventDefault()
if ShortFormApplicationService.listingIsSale()
if (ShortFormApplicationService.listingIsDalp())
return $state.go('dahlia.short-form-application.dalp-screening', toParams)
return $state.go('dahlia.short-form-application.prerequisites', toParams)
return $state.go('dahlia.short-form-application.name', toParams)

Expand Down
21 changes: 17 additions & 4 deletions app/assets/javascripts/config/angularRoutes.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,17 @@
$translate('page_title.listing_application', {listing: listing.Name})
]
})
.state('dahlia.short-form-application.dalp-screening', {
url: '/dalp-screening'
params:
skipConfirm: { squash: true, value: false }
views:
'container@':
templateUrl: 'short-form/templates/layout.html'
controller: 'ShortFormApplicationController'
'[email protected]':
templateUrl: 'short-form/templates/a4a-dalp-screening.html'
})
# Short form: "You" section
.state('dahlia.short-form-application.prerequisites', {
url: '/prerequisites'
Expand All @@ -657,8 +668,10 @@
infoChanged:
squash: true
onEnter: [
'$stateParams', 'ShortFormApplicationService', 'AccountService', 'AutosaveService'
($stateParams, ShortFormApplicationService, AccountService, AutosaveService) ->
'$state', '$stateParams', 'ShortFormApplicationService', 'AccountService', 'AutosaveService'
($state, $stateParams, ShortFormApplicationService, AccountService, AutosaveService) ->
if ShortFormApplicationService.listingIsDalp() && !ShortFormApplicationService.application.answeredDalpScreening
$state.go('dahlia.short-form-application.dalp-screening', {id: $stateParams.id, skipConfirm: true, lang: $stateParams.lang})
# If applicant tries to go to this page on a rental listing, redirect them back to homepage
if !ShortFormApplicationService.listingIsSale()
$state.go('dahlia.welcome')
Expand All @@ -668,8 +681,8 @@
ShortFormApplicationService.infoChanged = $stateParams.infoChanged
]
resolve:
lendingInstitutions: ['LendingInstitutionService', (LendingInstitutionService) ->
LendingInstitutionService.getLendingInstitutions()
lendingInstitutions: ['listing', 'LendingInstitutionService', (listing, LendingInstitutionService) ->
LendingInstitutionService.getLendingInstitutions(listing.Custom_Listing_Type == "Downpayment Assistance Loan Program")
]
})
.state('dahlia.short-form-application.autofill-preview', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ LendingInstitutionService = ($http) ->
Service = {}
Service.lendingInstitutions = {}

Service.getLendingInstitutions = ->
$http.get("/api/v1/short-form/lending_institutions").success((data, status) ->
angular.copy(data, Service.lendingInstitutions)
)
Service.getLendingInstitutions = (listingIsDalp) ->
if listingIsDalp
$http.get("/api/v1/short-form/lending_institutions_dalp").success((data, status) ->
angular.copy(data, Service.lendingInstitutions)
)
else
$http.get("/api/v1/short-form/lending_institutions").success((data, status) ->
angular.copy(data, Service.lendingInstitutions)
)

Service.getLendingAgentName = (agentId) ->
agent = _(Service.lendingInstitutions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ ListingConstantsService = () ->
rightToReturnSunnydale: "Right to Return - Sunnydale"
rightToReturnHuntersView: "Right to Return - Hunters View"
rightToReturnPotrero: "Right to Return - Potrero"
dalpFirstResponder: "DALP First Responders"
dalpEducator: "DALP SFUSD Educators"

# List of preferences that follow the right to return pattern.
Service.rightToReturnPreferences =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ ListingIdentityService = (ListingConstantsService) ->
return false unless listing
listing.Reserved_community_type == ListingConstantsService.RESERVED_TYPES.HABITAT

# Determine if listing is DALP listing that has hard-coded content
Service.isDalpListing = (listing) ->
return false unless listing
listing.Custom_Listing_Type == 'Downpayment Assistance Loan Program'

# Business logic for determining if a listing is open
# `due date` should be a datetime, to include precise hour of deadline
Service.isOpen = (listing) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ShortFormApplicationController = (
AccountService,
AddressValidationService,
AnalyticsService,
FileUploadService,
Idle,
inputMaxLength,
ListingDataService,
Expand Down Expand Up @@ -75,6 +76,8 @@ ShortFormApplicationController = (

$scope.emailRegex = SharedService.emailRegex

$scope.localizedSfGovUrl = ShortFormApplicationService.localizedSfGovUrl

$scope.propertyCardImageURL = ->
if _.isArray($scope.listing.Listing_Images)
return $scope.listing.Listing_Images[0].displayImageURL
Expand Down Expand Up @@ -295,7 +298,40 @@ ShortFormApplicationController = (
$scope.clearEligibilityErrors()
ShortFormNavigationService.goToApplicationPage('dahlia.short-form-welcome.overview')

########## END CUSTOM SCREENING LOGIC ##########
########## END CUSTOM EDUCATOR SCREENING LOGIC ##########

########## BEGIN DALP SCREENING LOGIC ##########

$scope.onChangeDalpEducatorOrFirstResponder = ->
if $scope.application.dalpEducator || $scope.application.dalpFirstResponder
$scope.application.dalpNotEducatorOrFirstResponder = null

$scope.onChangeDalpNoneApply = ->
if $scope.application.dalpNotEducatorOrFirstResponder
$scope.application.dalpEducator = null
$scope.application.dalpFirstResponder = null

$scope.dalpNoOptionSelected = ->
!$scope.application.dalpNotEducatorOrFirstResponder &&
!$scope.application.dalpEducator &&
!$scope.application.dalpFirstResponder

$scope.dalpShowNoOptionSelectedError = ->
$scope.dalpNoOptionSelected() && $scope.form.applicationForm.$submitted

$scope.applicantHasClaimedDalpPriority = ->
ShortFormApplicationService.application.dalpEducator == true || ShortFormApplicationService.application.dalpFirstResponder == true

$scope.afterDalpScreening = ->
ShortFormApplicationService.application.answeredDalpScreening = true
# Clean up DALP proof files
if !ShortFormApplicationService.application.dalpEducator
FileUploadService.deleteFile($scope.listing, { document: ShortFormApplicationService.application.documents['DALP educator proof'] })
if !ShortFormApplicationService.application.dalpFirstResponder
FileUploadService.deleteFile($scope.listing, { document: ShortFormApplicationService.application.documents['DALP first responder proof'] })
ShortFormNavigationService.goToApplicationPage('dahlia.short-form-application.prerequisites')

########## END DALP SCREENING LOGIC ##########

$scope.addressInputInvalid = (identifier = '') ->
return true if $scope.addressValidationError(identifier)
Expand Down Expand Up @@ -661,6 +697,15 @@ ShortFormApplicationController = (
ShortFormNavigationService.goToSection('Preferences')
return

if match == 'householdMatch' && ShortFormApplicationService.listingIsDalp()
$scope.goToNextReservedPageIfAvailable()
return

if match == 'incomeMatch' && ShortFormApplicationService.listingIsDalp()
ShortFormApplicationService.completeSection('Income')
ShortFormNavigationService.goToSection('Review')
return

ShortFormApplicationService.checkHouseholdEligibility($scope.listing)
.then( (response) ->
eligibility = response.data
Expand Down Expand Up @@ -810,6 +855,9 @@ ShortFormApplicationController = (
$scope.listingIsHabitat = ->
ShortFormApplicationService.listingIsHabitat()

$scope.listingIsDalp = ->
ShortFormApplicationService.listingIsDalp()

$scope.onIncomeValueChange = ->
ShortFormApplicationService.invalidateIncomeForm()
return if !ShortFormApplicationService.listingHasPreference('rentBurden') ||
Expand Down Expand Up @@ -950,7 +998,6 @@ ShortFormApplicationController = (
$scope.submitDisabled = false
)
else
AnalyticsService.trackFormError('Application')
$scope.handleErrorState()

$scope.afterSignInWhileApplying = ->
Expand Down Expand Up @@ -1190,6 +1237,7 @@ ShortFormApplicationController.$inject = [
'AccountService',
'AddressValidationService',
'AnalyticsService',
'FileUploadService',
'Idle',
'inputMaxLength',
'ListingDataService',
Expand Down
Loading
Loading