Skip to content

Commit

Permalink
Fixes batch import logic to not copy over the source comment into tar…
Browse files Browse the repository at this point in the history
…get comment.

If an actual target comment is provided, it will be saved properly.

Noticed that the source comment gets systematically copied into the target text unit variant when performing a ThirdPartySync but it applies to all import. This seems to be the behavior since day 1 of the TextUnitBatchImporterService yet it is a bug.
  • Loading branch information
aurambaj committed Jul 12, 2023
1 parent 9abb8c4 commit f6f21a0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ TMTextUnitVariant importTextUnit(
tmTextUnitId,
targetLocaleId,
targetString,
null,
targetComment,
status,
includedInLocalizedFile,
createdDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void importTextUnitsOfLocaleAndAsset(
currentTextUnit.getTmTextUnitId(),
locale.getId(),
textUnitForBatchImport.getContent(),
textUnitForBatchImport.getComment(),
textUnitForBatchImport.getTargetComment(),
textUnitForBatchImport.getStatus(),
textUnitForBatchImport.isIncludedInLocalizedFile(),
importTime,
Expand All @@ -234,11 +234,11 @@ boolean isUpdateNeeded(TextUnitForBatchMatcherImport textUnitForBatchImport) {
currentTextUnit.getStatus(),
DigestUtils.md5Hex(currentTextUnit.getTarget()),
currentTextUnit.isIncludedInLocalizedFile(),
currentTextUnit.getComment(),
currentTextUnit.getTargetComment(),
textUnitForBatchImport.getStatus(),
DigestUtils.md5Hex(textUnitForBatchImport.getContent()),
textUnitForBatchImport.isIncludedInLocalizedFile(),
textUnitForBatchImport.getComment());
textUnitForBatchImport.getTargetComment());
}

List<TextUnitDTO> getTextUnitTDOsForLocaleAndAsset(Locale locale, Asset asset) {
Expand Down Expand Up @@ -360,6 +360,7 @@ List<TextUnitForBatchMatcherImport> skipInvalidAndConvertToTextUnitForBatchImpor
textUnitForBatchImport.setLocale(localeService.findByBcp47Tag(t.getTargetLocale()));
textUnitForBatchImport.setContent(NormalizationUtils.normalize(t.getTarget()));
textUnitForBatchImport.setComment(t.getComment());
textUnitForBatchImport.setTargetComment(t.getTargetComment());
textUnitForBatchImport.setIncludedInLocalizedFile(t.isIncludedInLocalizedFile());
textUnitForBatchImport.setStatus(t.getStatus() == null ? APPROVED : t.getStatus());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class TextUnitForBatchMatcherImport implements TextUnitForBatchMatcher {
String content;
String name;
String comment;
String targetComment;
Long tmTextUnitId;
TextUnitDTO currentTextUnit;
boolean includedInLocalizedFile;
Expand Down Expand Up @@ -70,6 +71,14 @@ public void setComment(String comment) {
this.comment = comment;
}

public String getTargetComment() {
return targetComment;
}

public void setTargetComment(String targetComment) {
this.targetComment = targetComment;
}

@Override
public Long getTmTextUnitId() {
return tmTextUnitId;
Expand Down

0 comments on commit f6f21a0

Please sign in to comment.