Skip to content

Conversation

@joemull
Copy link
Member

@joemull joemull commented Jul 8, 2025

Closes #4138.
Closes #1720.

Please also review and merge docs PR: https://github.com/openlibhums/memory-alpha/pull/155.

Notes

  • Closes the linked issues
  • Connects the contact person and contact message models to account, so that we do not have names and emails outside of the Account object
  • Renames the contact person and contact message models to make them easier to read and work with
  • Removes stored client IPs to comply with GDPR
  • Adds the Django auto-documentation views, which are helpful when searching for template tags and filters, and which show you view and url pairs
  • Documents a few things
  • Tests for the contact manager and the press and journal contact pages

Screenshots for contact system

Screenshot from 2025-07-21 17-32-46 Screenshot from 2025-07-21 17-33-10 Screenshot from 2025-07-21 17-33-20 Screenshot from 2025-07-21 17-33-46 Screenshot from 2025-07-21 17-34-03 Screenshot from 2025-07-21 17-34-14

Screenshots for admin docs feature

I enabled this in the process of doing this work. It is enormously helpful to view a comprehensive list of things in Janeway sometimes.

Screenshot from 2025-07-21 17-35-02 Screenshot from 2025-07-21 17-35-18 Screenshot from 2025-07-21 17-40-34

@joemull joemull self-assigned this Jul 8, 2025
@joemull joemull changed the base branch from master to a11y-1.9 July 15, 2025 10:15
@joemull joemull force-pushed the b-4138-contact-message-upgrades branch from a7107c2 to 138ecfc Compare July 15, 2025 10:16
@joemull joemull force-pushed the a11y-1.9 branch 2 times, most recently from c457b14 to 53750df Compare July 16, 2025 13:06
Base automatically changed from a11y-1.9 to master July 16, 2025 13:28
@joemull joemull force-pushed the b-4138-contact-message-upgrades branch 3 times, most recently from 70f5a95 to e7c4f6c Compare July 21, 2025 16:46
@joemull joemull marked this pull request as ready for review July 21, 2025 16:46
@joemull joemull requested a review from ajrbyers July 21, 2025 16:54
@joemull joemull assigned ajrbyers and unassigned joemull Jul 21, 2025
Copy link
Member

@ajrbyers ajrbyers left a comment

Choose a reason for hiding this comment

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

I've added a few comments inline for you to go over, however, I have a fundamental question about this implementation. We have a contact form to obscure email addresses from being scraped. If we require a user to create a URL with the users email address in it we may be defeating this purpose. I think the account UUID field is the least painful option here. The Contacts page could present contact link that a user could simply copy and paste so they don't have to form it themselves?

Open to thoughts on this.

@ajrbyers ajrbyers assigned joemull and unassigned ajrbyers Jul 22, 2025
@joemull
Copy link
Member Author

joemull commented Sep 30, 2025

I've added a few comments inline for you to go over, however, I have a fundamental question about this implementation. We have a contact form to obscure email addresses from being scraped. If we require a user to create a URL with the users email address in it we may be defeating this purpose. I think the account UUID field is the least painful option here. The Contacts page could present contact link that a user could simply copy and paste so they don't have to form it themselves?

Open to thoughts on this.

All good suggestions, thanks! Updated with some changes:

  • Used uuid as suggested
  • Added link copy button as suggested
  • Went ahead and standardised other buttons and confirm delete behavior for consistency
  • Fixed other display issues
  • Updated migration to fix bug, and tested with OLH data

@joemull joemull requested a review from ajrbyers September 30, 2025 14:35
@joemull joemull assigned ajrbyers and unassigned joemull Sep 30, 2025
@joemull
Copy link
Member Author

joemull commented Oct 1, 2025

Note: Going to rebase this as there are conflicts keeping the CI job from running.

@joemull joemull assigned joemull and unassigned ajrbyers Oct 1, 2025
@joemull joemull force-pushed the b-4138-contact-message-upgrades branch from 4fe988c to 311b196 Compare October 1, 2025 13:35
@joemull
Copy link
Member Author

joemull commented Oct 1, 2025

One other thing to be aware of in review: the migration in this PR wipes the client IP data on contact messages, for GDPR purposes. This is what we want, right?

@joemull joemull assigned ajrbyers and unassigned joemull Oct 2, 2025
@joemull joemull force-pushed the b-4138-contact-message-upgrades branch from 27d1754 to a59fde6 Compare December 5, 2025 11:04
@joemull joemull removed their assignment Dec 8, 2025
@joemull joemull requested a review from mauromsl December 8, 2025 10:01
@joemull
Copy link
Member Author

joemull commented Dec 8, 2025

@mauromsl This is now ready for another review. I had to rebase to get CI to run. The new commits are the last three, starting after 1c2e0e5.

Copy link
Member

@mauromsl mauromsl left a comment

Choose a reason for hiding this comment

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

a few comments inline around the complexity of email comparisons and related data migrations.

label=_("Who would you like to contact?"),
)
sender = forms.EmailField(
max_length=200,
Copy link
Member

Choose a reason for hiding this comment

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

we probably want a constant to keep Logentry.actor_email and this in sync.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't work out what you mean. In sync in what way?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant the max_length, by using a constant, so that if one changes, the other does too. (since we copy from one to the other)

Comment on lines 80 to 90
matching_accounts = Account.objects.filter(
models.Q(username__iexact=email) | models.Q(email__iexact=email),
)
if matching_accounts.exists():
account = matching_accounts.first()
else:
normalized_email = normalize_email(email)
account = Account.objects.create(
email=normalized_email,
username=normalized_email,
)
Copy link
Member

Choose a reason for hiding this comment

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

as above, consider querying against email.lower() and handle potential IntegrityError on Account.objects.create()

@mauromsl mauromsl assigned joemull and unassigned mauromsl Dec 10, 2025
@joemull joemull requested a review from mauromsl December 12, 2025 13:44
@joemull joemull assigned mauromsl and unassigned joemull Dec 12, 2025
@joemull
Copy link
Member Author

joemull commented Dec 12, 2025

@mauromsl I've made some changes and responded above with some questions and comments. Remember to hit the "Load more" under hidden conversations to see the main one.

label=_("Who would you like to contact?"),
)
sender = forms.EmailField(
max_length=200,
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant the max_length, by using a constant, so that if one changes, the other does too. (since we copy from one to the other)

Copy link
Member

@mauromsl mauromsl left a comment

Choose a reason for hiding this comment

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

replied to comments, we are nearly there

@mauromsl mauromsl assigned joemull and unassigned mauromsl Dec 18, 2025
@joemull
Copy link
Member Author

joemull commented Dec 18, 2025

OK @mauromsl, I've addressed your comments. I've also tested it with a larger database and optimized the db access in the migration so it's quicker. There was also a bug with log entry dates because auto_now_add can't be manually overridden, so I made another change to that model.

@joemull joemull requested a review from mauromsl December 18, 2025 16:47
@joemull joemull assigned mauromsl and unassigned joemull Dec 18, 2025
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.

Let referring link specify which contact to select in contact form Press shouldn't use contact view from journal

5 participants