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

[#1715] Added management command to delete expired contact invitations #787

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

pi-sigma
Copy link
Contributor

Taiga #1715

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Merging #787 (b770433) into develop (380ecd7) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #787      +/-   ##
===========================================
+ Coverage    93.15%   93.17%   +0.01%     
===========================================
  Files          719      721       +2     
  Lines        24982    25027      +45     
===========================================
+ Hits         23273    23318      +45     
  Misses        1709     1709              
Files Coverage Δ
...accounts/management/commands/delete_invitations.py 100.00% <100.00%> (ø)
src/open_inwoner/accounts/models.py 97.13% <100.00%> (ø)
src/open_inwoner/accounts/tests/test_commands.py 100.00% <100.00%> (ø)
src/open_inwoner/conf/base.py 95.62% <100.00%> (ø)
src/open_inwoner/utils/logentry.py 100.00% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pi-sigma pi-sigma marked this pull request as ready for review September 26, 2023 12:30
Comment on lines 27 to 31
TimelineLog.objects.create(
timestamp=now.strftime("%Y-%m-%dT%H:%M:%S"),
extra_data={
"deleted_invitations": invites_info,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a message to extra_data here so this record means something in the admin list view.

Which is why we don't create TimelineLog objects directly but use one of the helpers from open_inwoner/utils/logentry.py that add a bit more information in semi-standardized fields (in this case probably system_action()).

If you want to store more info on it you can add a **kwargs that adds additional fields to the extra_data. In this case the extra info should probably have both the inviter and invitee, or the record would not be that useful. (eg: if a user complains their invites disappeared, can we retrieve anything from just the invitee/recipient and a date?)

You could also choose to log per inviter and set them as the user in the TimelineLog.

src/open_inwoner/accounts/tests/factories.py Outdated Show resolved Hide resolved
src/open_inwoner/conf/base.py Outdated Show resolved Hide resolved
@pi-sigma pi-sigma force-pushed the feature/1715-command-delete-invites branch 2 times, most recently from 7b42015 to 49f0935 Compare September 28, 2023 08:56
@pi-sigma pi-sigma force-pushed the feature/1715-command-delete-invites branch from 49f0935 to 63549f7 Compare September 28, 2023 12:40
@alextreme alextreme merged commit f184f94 into develop Sep 28, 2023
14 checks passed
@alextreme alextreme deleted the feature/1715-command-delete-invites branch September 28, 2023 14:33
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.

4 participants