Skip to content

Conversation

@ocielliottc
Copy link
Collaborator

This implements editing public/private, message text, and recipients and the ability for a user to delete kudos they have sent.

@ocielliottc ocielliottc linked an issue Feb 12, 2025 that may be closed by this pull request

if (!savedKudos.getPubliclyVisible()) {
// Private kudos do not need to be approved by another party.
savedKudos.setDateApproved(LocalDate.now());
Copy link
Member

Choose a reason for hiding this comment

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

Previously we didn't require any approved date for non-public kudos, so we didn't set one. I'm guessing something has shifted somewhere in the logic such that we need this date now? If so, then we might need to make a migration to add these dates to existing private kudos.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will have to look to see if anything changed anywhere to see why private kudos weren't being displayed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found the root of the problem.

    private List<KudosResponseDTO> findAllToMember(UUID memberId) {
        UUID currentUserId = currentUserServices.getCurrentUser().getId();

        if (!currentUserId.equals(memberId) &&
            !hasAdministerKudosPermission()) {
            throw new PermissionException("You are not authorized to retrieve the kudos another user has received");
        }

        List<KudosRecipient> kudosRecipients = kudosRecipientRepository.findByMemberId(memberId);

        List<KudosResponseDTO> kudosList = new ArrayList<>();

        kudosRecipients.forEach(kudosRecipient -> {
            UUID kudosId = kudosRecipient.getKudosId();
            Kudos relatedKudos = kudosRepository.findById(kudosId).orElseThrow(() ->
                    new NotFoundException(KUDOS_DOES_NOT_EXIST_MSG.formatted(kudosId)));

            if (relatedKudos.getDateApproved() != null) {
                kudosList.add(constructKudosResponseDTO(relatedKudos));
            }
        });

        return kudosList;
    }

When we retrieve all of the received kudos, we are requiring an approved date. According to git, it's been like this for 3 years. I will undo my date changes and fix this method (and some display stuff too).

Are you sure you want to complete this action? The kudos
will be deleted.
</DialogContentText>
<TextField
Copy link
Member

Choose a reason for hiding this comment

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

Should this text field go away since it's not used? (that I can see)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm all for removing the text field.

@mkimberlin
Copy link
Member

@ocielliottc I think we may also want to "unapprove" (remove the approval date) a public kudos that has the text edited.

@mkimberlin mkimberlin merged commit 8aa3f26 into develop Feb 13, 2025
5 checks passed
@mkimberlin mkimberlin deleted the feature-2870/edit-kudos branch February 13, 2025 15:42
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.

Provide the ability to edit a kudos

2 participants