-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/uppsf 5230 fix unrolling live blog packages in content unroller (#40
) * Made article unroller default * Renamed Article and Internal Article unrollers to Default and Default internal * Added content package test
- Loading branch information
Showing
15 changed files
with
908 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package content | ||
|
||
import "github.com/Financial-Times/go-logger/v2" | ||
|
||
type DefaultInternalUnroller DefaultUnroller | ||
|
||
func NewDefaultInternalUnroller(r Reader, log *logger.UPPLogger, apiHost string) *DefaultInternalUnroller { | ||
return (*DefaultInternalUnroller)(NewDefaultUnroller(r, log, apiHost)) | ||
} | ||
|
||
func (u *DefaultInternalUnroller) Unroll(req UnrollEvent) (Content, error) { | ||
if !validateInternalDefaultContent(req.c) { | ||
return req.c, ErrValidating | ||
} | ||
|
||
cc := req.c.clone() | ||
expLeadImages, foundImages := unrollLeadImages(cc, u.reader, u.log, req.tid, req.uuid) | ||
if foundImages { | ||
cc[leadImages] = expLeadImages | ||
} | ||
|
||
dynContents, foundDyn := unrollDynamicContent(cc, u.log, req.tid, req.uuid, u.reader.GetInternal) | ||
if foundDyn { | ||
cc[embeds] = dynContents | ||
} | ||
|
||
return cc, nil | ||
} | ||
|
||
func validateInternalDefaultContent(content Content) bool { | ||
_, hasLeadImages := content[leadImages] | ||
_, hasBody := content[bodyXMLField] | ||
|
||
return hasLeadImages || hasBody | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.