-
Notifications
You must be signed in to change notification settings - Fork 84
Upgrades to contact messages #4845
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
Open
joemull
wants to merge
17
commits into
master
Choose a base branch
from
b-4138-contact-message-upgrades
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,185
−309
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b3d6a8a
docs #4138 Add to view test docs
joemull 848a8a7
docs #4138 Turn on Django admin docs
joemull 9420fe1
docs #4138 Document sequence fields and email logging
joemull d25bf84
feat #4138 Upgrade and refactor contact system
joemull e4a06d3
fix #4138: Fix failing tests
joemull 1f2098d
feat #4138 Use account uuid not email to match recipient
joemull d564225
feat #4138 Add button to copy link, and other UI improvements
joemull 234328d
feat #4138 Avoid relying on model manager in migration
joemull 14f47f8
feat #4138 Change contact URLs to new press view
joemull 2a6eede
feat #4138 Make data migration more robust
joemull 1c2e0e5
feat #4138 Make variables in included templates more explicit
joemull d8a92f5
feat #4138 Store contact messages as log entries and create UI for them
joemull a59fde6
feat #4138 Document upgraded contact system
joemull 22f9199
feat #4138 Fix rebase bug and update docs
joemull f3c27b3
feat #4138 Changes requested in review
joemull 82f99c7
feat #4138 Add manager migration and fix GFK error in data migration
joemull fdfbd8d
feat #4138 Avoid unforeseen migration errors; optimize; fix date bug
joemull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Contact messages | ||
|
|
||
| Janeway provides a public contact form for journal and press sites. Contact people can be set for each. | ||
|
|
||
| ## Data model | ||
|
|
||
| Contact messages are stored via `LogEntry` objects with `types="Contact Message"`. The `target`, which would otherwise be something like an article for workflow log entries, is the journal or press site that the contact message was submitted to. | ||
|
|
||
| ## Recipient access to contact messages | ||
|
|
||
| The primary way users get contact messages is directly as emails to their inbox outside of Janeway. | ||
|
|
||
| However, they can also access **Contact Messages** via the manager. This view only shows the user messages sent to them, including at the staff level. This may be counter-intuitive in comparison with similar views, because most of the time, an object belonging to journal (like an article, or a task) is viewable by all editors. However, this behavior is needed for privacy, because many users will expect their message to be private to the person they select on the form. At the staff level, staff members cannot see contact messages sent to journal editors, for similar reasons. | ||
|
|
||
| ## What happens on deletion | ||
|
|
||
| When a `ContactPerson` is removed, the contact messages sent to that person should still be viewable, because they are recorded as `LogEntry` objects, where the recipient’s email is saved independently of the `ContactPerson` or `Account`. The message will still appear on **Contact Messages**. | ||
|
|
||
| When an `Account` is removed, the `ContactPerson` is also deleted, but again, the contact messages should still exist. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Sequence fields | ||
|
|
||
| We use several patterns across Janeway to let users set the sequence of things, most commonly with a `PositiveIntegerField`. | ||
|
|
||
| Because we sometimes expose this number to end users in form inputs, it is worth thinking about the usability of the default value. The number 1 is low enough to be easy for end users to manipulate. Zero is sometimes most convenient from a programming perspective, but avoid it if possible, since it can be counter-intuitive for non-programmers. | ||
|
|
||
| ```py | ||
| sequence = models.PositiveIntegerField(default=1) | ||
| ``` | ||
|
|
||
| Of course, it is best if end users do not have to deal with this number at all. User interfaces should use accessible buttons that move things up or down in the sequence. This allows us to write an algorithm to check that multiple things have not been given the same sequence, and it keeps the user from having to recall off-screen information about the order of other items whilst performing an action. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Task and email logs | ||
|
|
||
| Janeway creates a number of logs (`utils.LogEntry`) for actions that happen during the workflow. Many these actions trigger an email to be sent. The logging is thus managed by the email sending process. A log is created created that records the type of action taken in Janeway as well as details of the email. | ||
|
|
||
| ## The notification system | ||
|
|
||
| The notification system, where emails and logs are created, lives in `src/utils`, and uses hooks to provide plugin functionality: | ||
|
|
||
| ``` | ||
| src/utils/notify.py | ||
| src/utils/notify_helpers.py | ||
| src/utils/notify_plugins/notify_email.py | ||
| src/utils/notify_plugins/email_log.py | ||
| src/utils/notify_plugins/notify_slack.py | ||
| ``` | ||
|
|
||
| <!-- | ||
| TODO | ||
| * Document how the notify plugins work, exactly | ||
| * Document when to use functions like send_email_with_body_from_user, etc. | ||
|
|
||
| --> | ||
|
|
||
| ## Non-workflow log entries | ||
|
|
||
| There are email messages stored as log entries that are unrelated to the workflow. Contact messages are the first case of this kind of non-workflow log entry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,3 +65,4 @@ ua-parser==0.16.1 | |
| # See #3736 | ||
| urllib3<2 | ||
| user-agents==2.2.0 | ||
| docutils==0.21.2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.