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

fix: Crowdin proofreader cancelling event is not well triggered - Meeds-io/meeds#2655 #64

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sergeByishimo
Copy link
Contributor

Currently while cancelling points are removed for the translator, but not for the approver but it should.
This pull request intends to make sure that the points are removed for the translator as well by getting
the previous approval user from the database.

…ds-io/meeds#2655

Currently while cancelling points are removed for the translator, but
not for the approver but it should.
This pull request intends to make sure that the points are removed for
the translator as well
@plamarque plamarque requested a review from AzmiTouil January 28, 2025 08:32
Comment on lines +96 to +118
if (trigger.equals(SUGGESTION_DISAPPROVED_TRIGGER)) {
// Retrieve who made that approval from the database

List<RealizationDTO> realizations = realizationService.
findRealizationsByObjectIdAndObjectType(objectId, TRANSLATION);

if ( ! realizations.isEmpty()) {
String approvalUsername = realizations.get(0).getEarnerId();

eventList.add(new Event(APPROVE_SUGGESTION_EVENT_NAME,
approvalUsername,
approvalUsername,
objectId,
TRANSLATION,
getProjectId(payload),
extractSubItem(payload, TRANSLATION, TARGET_LANGUAGE, ID),
extractSubItem(payload, TRANSLATION, PROVIDER) == null,
extractSubItem(payload, TRANSLATION, STRING, FILE, DIRECTORY_ID),
true,
countWords(extractSubItem(payload, TRANSLATION, STRING, TEXT))));
} else {
LOG.warn("No realization found while cancelling translation with id: " + objectId);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • We also need to verify the realization event name to check if it is approveSuggestion. FYI, It might also be suggestionAdded, as both share the same objectId and objectType.
  • There's no need to log a trace when the realization is not found.
  • Please ensure the code is formatted properly.

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.

2 participants