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

Remove SpecialistDocumentEdition#document_type #849

Merged
merged 19 commits into from
Mar 13, 2017

Conversation

floehopper
Copy link
Contributor

Since this commit all editions have had a document_type value of 'manual' and so the field had become redundant.

Unfortunately the string literal, 'manual', appeared rather a lot throughout the code, so some of the early commits extract these occurrences out into a number of different constants in order to better express their meaning. A couple of these which internal to the app are then gradually refactored away, leaving only ones relating to the Publishing API and Rummager.

For simplicity I've decided not to take the final step of unsetting the document_type field on all existing persisted instances of SpecialistDocumentEdition within this pull request, but I would expect to do it very shortly.

Copy link
Contributor

@chrisroos chrisroos left a comment

Choose a reason for hiding this comment

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

Looks good to me, @floehopper!

@floehopper
Copy link
Contributor Author

@chrisroos: Thanks.

Rebasing against master and force-pushing in preparation for merging.

This makes the code more consistent and more of a standard Rails app.

A nice side effect is that it serves to distinguish the 'manual' strings
from those used in conjunction with
`SpecialistDocumentEdition#document_type`.
I want to remove `SpecialistDocumentEdition#document_type` which is now
always set to 'manual'. In this commit I'm trying to make it clearer
that `ManualIndexableFormatter#type` is not related to
`SpecialistDocumentEdition#document_type`; it's a document type for
use in Rummager and not used *internally* within this app.
I want to remove `SpecialistDocumentEdition#document_type` which is now
always set to 'manual'. In this commit I'm trying to make it clearer
that the 'manual' strings used in `ManualPublishingAPIExporter` are not
related to `SpecialistDocumentEdition#document_type`; in this case
they're the name of the schema and the document type sent to the
Publishing API and are not used *internally* within this app.
I want to remove `SpecialistDocumentEdition#document_type` which is now
always set to 'manual'. In this commit I'm trying to make it clearer
that these 'manual' strings are not directly related to
`SpecialistDocumentEdition#document_type`; in this case they're just
used by `PermissionChecker`.
I want to remove `SpecialistDocumentEdition#document_type` which is now
always set to 'manual'. In this commit I'm trying to make it clearer
which magic strings do actually relate to this attribute.
Since this commit [1] this can only ever be 'manual' and so we can
simplify the code by making this the default value of the Mongoid field
and avoiding specifying it in all the places where it was previously
being set.

[1]: 723ce32
Since this commit [1] all editions are of 'manual' document type, so
these `where` conditions are redundant.

[1]: 723ce32
To keep thing simpler, I'm going to hold off adding a migration to
remove this field from existing persisted instances for the moment.
@floehopper floehopper force-pushed the remove-specialist-document-edition-document-type branch from ea7f8f2 to de67f0d Compare March 13, 2017 13:07
@floehopper floehopper merged commit f2af977 into master Mar 13, 2017
@floehopper floehopper deleted the remove-specialist-document-edition-document-type branch March 13, 2017 13:11
@chrislo chrislo modified the milestone: Legacy Apr 25, 2017
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.

None yet

3 participants