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

chore: remove custom logo #979

Merged
merged 5 commits into from
Jan 8, 2021
Merged

chore: remove custom logo #979

merged 5 commits into from
Jan 8, 2021

Conversation

arshadali172
Copy link
Contributor

Problem

Closes #787

Solution

  • Remove form.customLogo which was no longer being used
  • Remove form.hasheader which was no longer being used
  • Remove form.logo which was no longer being used
  • Create script for deletion of form.customLogo

Notes

  • Once form.customLogo has been deleted, such forms with either default to the config in startPage.logo or if startPage.logo is non-existent (i.e. for all new forms), default to the agency logo.

Tests

  • Create new form on email mode, should have default logo
  • Create new form on storage mode, should have default logo
  • Create new form on duplicate flow, should have default logo
  • Create new form on template flow, should have default logo
  • Edit form to have no logo
  • Edit form to have custom logo

Deploy Notes

  • Script should be run before the code is merged.

Comment on lines +10 to +14
// Check number of forms with customLogo key
db.getCollection('forms').find({ customLogo: { $exists: true } }).count()

// Check number of forms with startPage.logo key
db.getCollection('forms').find({ "startPage.logo.state": { $exists: true } }).count()
Copy link
Contributor

@liangyuanruo liangyuanruo Jan 6, 2021

Choose a reason for hiding this comment

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

can we also check how many unarchived forms have only the customLogo key but not startPage.logo.state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on my queries yesterday:

Total Number of forms: 179888

Forms with startPage.logo.state defined: 139912

Breaks down into:
DEFAULT: 112081
NONE: 8297
CUSTOM: 19534

customLogo may exist for such forms too, but is currently ignored as startPage.logo is defined

Forms with startPage.logo.state undefined: 39977

Breaks down into:
customLogo undefined: 36359 => Currently defaults to agency logo
customLogo defined: 3618 => Currently defaults to customLogo, but once the key is removed, will default to agency logo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liangyuanruo there are a sizeable number of forms (i.e. 36359) with neither startPage.logo.state nor customLogo as new forms are created without either key

Copy link
Contributor

Choose a reason for hiding this comment

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

to clarify, this is because it's possible to have a form without a logo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old Code

  • If startPage.logo.state present, will use state defined therein
  • If startPage.logo.state absent, will use state defined in customLogo. Note that undefined state for customLogo means that the default agency logo is to be shown
  • New forms are created with startPage.logo.state absent and customLogo undefined and hence show the default agency logo

New Code

  • If startPage.logo.state present, will use state defined therein
  • Will ignore customLogo, although customLogo should have been removed from form documents
  • If startPage.logo.state absent, default agency logo will be shown
  • New forms are created with startPage.logo.state absent and hence show the default agency logo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does that make sense @liangyuanruo

Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

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

Always happy to see a PR removing code. Generally LGTM but could I request expanding on the DB script so that we can be 100% sure that the customLogo key is safe to remove?

@arshadali172
Copy link
Contributor Author

Always happy to see a PR removing code. Generally LGTM but could I request expanding on the DB script so that we can be 100% sure that the customLogo key is safe to remove?

how would you suggest I expand it? @liangyuanruo

@liangyuanruo liangyuanruo merged commit a5aa418 into develop Jan 8, 2021
@liangyuanruo liangyuanruo deleted the rm-custom-logo branch January 8, 2021 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove deprecated customLogo from Form schema
2 participants