-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(projectHistoryLogs): log duplicated submissions TASK-1342 (#5387)
### 📣 Summary Record when submissions are duplicated. Record it just as a regular submission. ### 💭 Notes Add submission information to the request, then process as usual in `ProjectHistoryLogs.create_from_request`. ### 👀 Preview steps 1. ℹ️ have at least 2 accounts and a project. Log in to the first account 2. Give the second account the Manage Project permission 3. add a submission to the project and take note of the id 4. from the terminal, run `curl -X POST -H 'Authorization: Token <account1_token>' kf.kobo.local/api/v2/assets/<asset_uid>/data/<submission_id>/duplicate/` 5. reload the data table to make sure the submission was duplicated 6. go to `api/v2/assets/<asset_uid>/history` 7. 🟢 there should be a new PH log with action=`add-submission` and the usual metadata, plus ``` "submission": { "submitted_by": <account1_username> } ``` 8. from the terminal, run `curl -X POST -H 'Authorization: Token <account2_token>' kf.kobo.local/api/v2/assets/<asset_uid>/data/<submission_id>/duplicate/` (notice this is using account2's token) 9. reload the data table to make sure the submission was duplicated again, with the new submission's "submitted_by" being account2. 10. go to `api/v2/assets/<asset_uid>/history` 11. 🟢 there should be a new PH log with action=`add-submission` and the usual metadata, plus ``` "submission": { "submitted_by": <account2_username> } ```
- Loading branch information
Showing
6 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
65 changes: 65 additions & 0 deletions
65
kobo/apps/audit_log/migrations/0014_add_submission_action.py
This file contains 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,65 @@ | ||
# Generated by Django 4.2.15 on 2024-12-19 19:37 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('audit_log', '0013_alter_auditlog_action'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='auditlog', | ||
name='action', | ||
field=models.CharField( | ||
choices=[ | ||
('add-media', 'Add Media'), | ||
('add-submission', 'Add Submission'), | ||
('allow-anonymous-submissions', 'Allow Anonymous Submissions'), | ||
('archive', 'Archive'), | ||
('auth', 'Auth'), | ||
('clone-permissions', 'Clone Permissions'), | ||
('connect-project', 'Connect Project'), | ||
('create', 'Create'), | ||
('delete', 'Delete'), | ||
('delete-media', 'Delete Media'), | ||
('delete-service', 'Delete Service'), | ||
('deploy', 'Deploy'), | ||
('disable-sharing', 'Disable Sharing'), | ||
( | ||
'disallow-anonymous-submissions', | ||
'Disallow Anonymous Submissions', | ||
), | ||
('disconnect-project', 'Disconnect Project'), | ||
('enable-sharing', 'Enable Sharing'), | ||
('export', 'Export'), | ||
('in-trash', 'In Trash'), | ||
('modify-imported-fields', 'Modify Imported Fields'), | ||
('modify-service', 'Modify Service'), | ||
('modify-sharing', 'Modify Sharing'), | ||
('modify-user-permissions', 'Modify User Permissions'), | ||
('put-back', 'Put Back'), | ||
('redeploy', 'Redeploy'), | ||
('register-service', 'Register Service'), | ||
('remove', 'Remove'), | ||
('replace-form', 'Replace Form'), | ||
('share-form-publicly', 'Share Form Publicly'), | ||
('share-data-publicly', 'Share Data Publicly'), | ||
('unarchive', 'Unarchive'), | ||
('unshare-form-publicly', 'Unshare Form Publicly'), | ||
('unshare-data-publicly', 'Unshare Data Publicly'), | ||
('update', 'Update'), | ||
('update-content', 'Update Content'), | ||
('update-name', 'Update Name'), | ||
('update-settings', 'Update Settings'), | ||
('update-qa', 'Update Qa'), | ||
('transfer', 'Transfer'), | ||
], | ||
db_index=True, | ||
default='delete', | ||
max_length=30, | ||
), | ||
), | ||
] |
This file contains 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 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 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 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