Skip to content

Commit

Permalink
Temporary fix for MultiParagraph fields
Browse files Browse the repository at this point in the history
The Mongo simplification code removes the paragraphs field if it's an
empty array, but there's code in LexEntryModel (generateCustomField)
that does the wrong thing when the paragraphs field is absent. That code
will eventually use the type field to detect MultiParagraphs, but until
the type field is in use everywhere, we still need to keep the
paragraphs field around.


Former-commit-id: 11dba43
  • Loading branch information
rmunn committed Mar 22, 2018
1 parent f84e550 commit 75217dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Api/Model/Shared/Mapper/MongoMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public static function shouldPersist($value) {

public static function shouldKeepKey(string $key) {
// Some keys shouldn't be removed even if empty, at least as long as our code is still making assumptions that these keys exist
return ($key === "guid" || $key === "translation" || $key === "description" || $key === "answers");
return ($key === "guid" || $key === "translation" || $key === "description" || $key === "answers" || $key == "paragraphs");
}

public static function removeEmptyItems(array $array) {
Expand Down

0 comments on commit 75217dd

Please sign in to comment.