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

Propagate delete companion #278

Merged
merged 5 commits into from
Dec 19, 2024
Merged

Conversation

binh-dam-ibigroup
Copy link
Collaborator

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • [na] The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR addresses #271 (comment).

When a user deletes their account, they are removed as primary traveler on trips saved by others,
and they are invalidated as companions and observers on trips saved by others.

Copy link
Contributor

@br648 br648 left a comment

Choose a reason for hiding this comment

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

LGTM.


// If a dependent user, remove self as the primary traveler in trips created by other users.
// TODO: Should we alert the user who created the trip of the deletion?
Persistence.monitoredTrips
Copy link
Contributor

Choose a reason for hiding this comment

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

There is probably a case here for just deleting the trip if the primary traveler is no longer travelling. Perhaps that would start to complicate things though?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good observation. Could preventing tracking if a companion is set but no primary traveler is defined be a better way to handle that?

Choose a reason for hiding this comment

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

I think deleting the trip makes sense if there is no primary traveler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created issue #282 to track that.


/**
* Remove the specified user as observer from the specified trip.
* @return true if one or more related users gor invalidated, false otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit. are not gor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! 528d8bb

@br648 br648 assigned binh-dam-ibigroup and unassigned br648 Dec 12, 2024
Copy link

@josh-willis-arcadis josh-willis-arcadis left a comment

Choose a reason for hiding this comment

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

LGTM. Just one tiny nit

.getFiltered(Filters.eq("companion.email", email))
.forEach(trip -> removeCompanion(this, trip));

// If a companion user, invalidate relationship in trips where they are companions and observers.

Choose a reason for hiding this comment

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

nit. this comment is a duplicate of the comment above.


// If a dependent user, remove self as the primary traveler in trips created by other users.
// TODO: Should we alert the user who created the trip of the deletion?
Persistence.monitoredTrips

Choose a reason for hiding this comment

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

I think deleting the trip makes sense if there is no primary traveler.

.forEach(trip -> removeCompanion(this, trip));

// If a companion user, invalidate relationship in trips where they are companions and observers.
// TODO: Should we alert the user who created the trip of the deletion?

Choose a reason for hiding this comment

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

I don't think it would hurt to notify the creator of the trip.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created issue #283 to track that. The dilemma is to choose between #282 and #283.

@binh-dam-ibigroup binh-dam-ibigroup merged commit cd9e2ee into dev Dec 19, 2024
2 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the propagate-delete-companion branch December 19, 2024 21:23
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.

3 participants