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 subscriptions #2261

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Fix subscriptions #2261

merged 1 commit into from
Sep 5, 2024

Conversation

Fosol
Copy link
Collaborator

@Fosol Fosol commented Sep 5, 2024

Fixing various issues related to subscriptions through a distribution list.

@Fosol Fosol added bug Something isn't working subscriber PR contains changes towards the subscriber application, editor labels Sep 5, 2024
@Fosol Fosol self-assigned this Sep 5, 2024
</Col>
<Col flex="2">
<p>
If this user is currently subscribed through a distribution list, you will need to
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just a warning as the code will take a lot longer to write.

@@ -192,3 +178,39 @@ export const MyProducts: React.FC = () => {
</styled.MyProducts>
);
};

const modalBody = (active: ISelectedProduct) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed text based on status. This all got messy due to distribution lists.

this.IsSubscribed = subscription?.IsSubscribed ?? false;
}
else if (entity.Product.ProductType == Entities.ProductType.EveningOverview)
{
var subscription = entity.User.AVOverviewSubscriptionsManyToMany
.FirstOrDefault(s => s.UserId == entity.UserId &&
(int)s.TemplateType == entity.Product!.TargetProductId);
.FirstOrDefault(s => s.IsSubscribed && (int)s.TemplateType == entity.Product!.TargetProductId);
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 don't love this, but since a user can be subscribed through a distribution list it's currently necessary.

@@ -109,15 +110,13 @@ public UserProductModel(Entities.UserProduct entity) : base(entity)
else if (entity.Product.ProductType == Entities.ProductType.Notification)
{
var subscription = entity.User.NotificationSubscriptionsManyToMany
.FirstOrDefault(s => s.UserId == entity.UserId &&
s.NotificationId == entity.Product!.TargetProductId);
.FirstOrDefault(s => s.IsSubscribed && s.NotificationId == entity.Product!.TargetProductId);
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 don't love this, but since a user can be subscribed through a distribution list it's currently necessary.

@Fosol Fosol merged commit 460d46f into bcgov:dev Sep 5, 2024
3 checks passed
@Fosol Fosol deleted the dist branch September 5, 2024 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working editor subscriber PR contains changes towards the subscriber application,
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant