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

Add server side previews to the application workflow #3725

Merged
merged 9 commits into from
Jan 29, 2024

Conversation

wes-otf
Copy link
Contributor

@wes-otf wes-otf commented Jan 12, 2024

Description

Closes #3545.

This creates the option to require a user to preview their form before submitting it. The requirement is set on a per fund/lab basis, and is a required checkbox when the lab/fund is configured in Wagtail admin global Django configuration option. The preview first saves the application as a draft, then presents the user with a preview of their application. Upon viewing, the user can either edit or submit as seen in the flow diagram below.

Sloppy Flow Diagram:
Preview_Flow

Screenshots:
Screenshot 2024-01-12 at 18 42 15
Screenshot 2024-01-12 at 18 42 37

Test Steps

Testing preview on initial apply

  • Navigate to https://test-apply.hypha.app/
  • Ensure you're logged in
  • Select Apply on any fund in the list
  • Populate some fields (ideally the ones that allow for text formatting)
  • Confirm Preview and submit appears at the bottom of the application
  • Select the Preview and submit button
  • Confirm a preview with the application's rendered fields now appears, with Submit and Edit buttons at the bottom.
  • Confirm selecting Submit successfully submits the submission (can be verified by using the navigation bar to go to Submissions > All submissions.

Testing preview on edit

  • Navigate to https://test-apply.hypha.app/
  • Ensure you're logged in
  • Select Apply on any fund in the list
  • Populate some fields (ideally the ones that allow for text formatting)
  • Select the Save Draft button at the bottom of the page
  • When redirected to the page statingYour application is saved as a draft., select the Continue editing button.
  • Make changes to the application
  • Confirm the Preview and submit button is present at the bottom of the page.
  • Select the Preview and submit button
  • Confirm a preview with the updated application's rendered fields now appears, with Submit and Edit buttons at the bottom.
  • Confirm selecting Submit successfully submits the submission (can be verified by using the navigation bar to go to Submissions > All submissions.

@theskumar
Copy link
Member

Do we really need a configuration option. I would suggest keeping it as default for all the rounds/labs.

One less configuration to care about.

@frjo
Copy link
Member

frjo commented Jan 14, 2024

This look like a nice implementation!

I would also prefer no option to make it more simple.

We can ask the other implementors and if some have really strong opinopn on it we might add a global env var to turn the previews off.

I can not see an organisation that wants previews for some fund/lab but not all.

@wes-otf
Copy link
Contributor Author

wes-otf commented Jan 16, 2024

Thanks @frjo @theskumar, this was great feedback! After chatting today in the maintainers meeting it seems like the path forward is global configurations for the previews rather than per-fund/lab as OTS brought up that some organizations might not want this feature. Will have those changes up soon!

@wes-otf wes-otf changed the title WIP: Add server side previews to the application workflow Add server side previews to the application workflow Jan 18, 2024
@wes-otf wes-otf marked this pull request as ready for review January 18, 2024 19:55
@wes-otf wes-otf added Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter labels Jan 18, 2024
Copy link
Member

@frjo frjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works really well in my testing. One small comment around the new env setting.

There is also an issue for sites that set:

FORCE_LOGIN_FOR_APPLICATION = False

The applicant fill in the submission form as anonymous (not logged in) and click "Preview and submit". They then have the option to click "Submit for review" or "Edit". Both will take them to the login screen without any explanations.

An account is created for them and the e-mail is sent out but we do not communicate this fact to them in Hypha.

If you set:

REQUIRE_PREVIEW = False

You still have the same issue if the applicant click the optional "Preview" button.

How should we handle this?

A simple way would be to make preview only work for logged in users.

@wes-otf
Copy link
Contributor Author

wes-otf commented Jan 19, 2024

@frjo thanks for testing! This is definitely an oversight from me, I'll go back to the drawing board for this one.

A simple way would be to make preview only work for logged in users.

I think this would also negate FORCE_LOGIN_FOR_APPLICATION = False if previewing was a piece of the submission process right? If you clicked "Preview and submit" and were forced to login to preview

@frjo
Copy link
Member

frjo commented Jan 19, 2024

@wes-otf I think the best solution is to only activate previewing for logged in users (regardless if REQUIRE_PREVIEW is set to true or false).

We then document that FORCE_LOGIN_FOR_APPLICATION = False will disable previewing of submissions for non logged in users.

What do you think?

@wes-otf
Copy link
Contributor Author

wes-otf commented Jan 19, 2024

@frjo Yeah I think that is the only answer that really makes sense. All the options I can think of would either be a major overhaul or a potential security vulnerability

@wes-otf
Copy link
Contributor Author

wes-otf commented Jan 19, 2024

This should be all set now!

@wes-otf wes-otf requested a review from frjo January 19, 2024 23:44
@frjo frjo added the Status: Needs testing Tickets that need testing/qa label Jan 24, 2024
@wes-otf wes-otf added Status: Needs user testing 👷 Tasks that should be tested by OTF's user test team and removed Status: Needs testing Tickets that need testing/qa labels Jan 24, 2024
@wes-otf
Copy link
Contributor Author

wes-otf commented Jan 24, 2024

@frjo I just created two labels for user testing vs dev testing. Let me know if you think that makes sense moving forward

@wes-otf wes-otf added Status: Tested - approved for live ✅ and removed Status: Needs user testing 👷 Tasks that should be tested by OTF's user test team labels Jan 29, 2024
@frjo frjo merged commit ad48694 into main Jan 29, 2024
theskumar added a commit that referenced this pull request Jan 30, 2024
* main:
  User with Staff role can approve contracts (#3736)
  Add server side previews to the application workflow (#3725)
  Move cookieconsent settings to generic settings (#3722)
  Remove public "standard_pages" app (#3721)
  Remove public "funds" app (#3720)
  Update github actions. (#3740)
  Remove public "forms" pages app (#3719)
  Remove public "projects" app (#3718)
  Remove "people" app (#3739)
  Remove public "partners" app (#3716)
wes-otf added a commit that referenced this pull request May 7, 2024
## Description

Closes #3545.

This creates the option to require a user to preview their form before
submitting it. The requirement is set on a per fund/lab basis, and is a
~required checkbox when the lab/fund is configured in Wagtail admin~
global Django configuration option. The preview first saves the
application as a draft, then presents the user with a preview of their
application. Upon viewing, the user can either edit or submit as seen in
the flow diagram below.
wes-otf added a commit that referenced this pull request May 8, 2024
## Description

Closes #3545.

This creates the option to require a user to preview their form before
submitting it. The requirement is set on a per fund/lab basis, and is a
~required checkbox when the lab/fund is configured in Wagtail admin~
global Django configuration option. The preview first saves the
application as a draft, then presents the user with a preview of their
application. Upon viewing, the user can either edit or submit as seen in
the flow diagram below.
Vldln pushed a commit to equalitie/hypha that referenced this pull request May 28, 2024
## Description

Closes HyphaApp#3545.

This creates the option to require a user to preview their form before
submitting it. The requirement is set on a per fund/lab basis, and is a
~required checkbox when the lab/fund is configured in Wagtail admin~
global Django configuration option. The preview first saves the
application as a draft, then presents the user with a preview of their
application. Upon viewing, the user can either edit or submit as seen in
the flow diagram below.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Tested - approved for live ✅ Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display a server side preview of the application form before submitting
3 participants