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

Add more mod actions (always set status, depublish attachments) #865

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pajowu
Copy link
Member

@pajowu pajowu commented Oct 8, 2024

  • 🚸 Always allow mods to change request status
  • ✨ Allow mods to depublish attachments

@pajowu pajowu requested review from krmax44 and stefanw October 8, 2024 16:11
@pajowu pajowu changed the title Add more mod actions (always set status, depublish attachments" Add more mod actions (always set status, depublish attachments) Oct 8, 2024
@pajowu pajowu force-pushed the pajowu/more_mod_actions branch from 33e3574 to 9f9e612 Compare October 9, 2024 12:34
@pajowu
Copy link
Member Author

pajowu commented Oct 9, 2024

The publish_document task exists early if the document is still pending (not changing the public value of the document). This could lead to some weird behaviour if the document is not yet fully processed, but depublished in the meantime. I'm not sure what the best solution here is. Should we change the task to retry later or just accept it, as this should hopefully not happen?

@pajowu pajowu force-pushed the pajowu/more_mod_actions branch from 9f9e612 to bbc28f1 Compare October 9, 2024 12:38
pajowu added 2 commits October 9, 2024 14:43
Click fires before the value is changed, which leads to weird behaviour
@pajowu pajowu force-pushed the pajowu/more_mod_actions branch from bbc28f1 to 632f900 Compare October 9, 2024 12:43
@krmax44
Copy link
Member

krmax44 commented Oct 10, 2024

The publish_document task exists early if the document is still pending (not changing the public value of the document). This could lead to some weird behaviour if the document is not yet fully processed, but depublished in the meantime. I'm not sure what the best solution here is. Should we change the task to retry later or just accept it, as this should hopefully not happen?

Not quite sure if I understand correctly. The publish_document task checks if the document is currently processing: https://github.com/okfde/django-filingcabinet/blob/3b1dc92d89da48af9851e37a22ac1310922b9c73/src/filingcabinet/tasks.py#L49-L50

@pajowu
Copy link
Member Author

pajowu commented Oct 10, 2024

Yes exactly. In this case, the tasks just does nothing. If someone creates a document from an attachment and then shortly after that depublishes the attachment (while the document is still processing), the approved-field of the attachment would be set to False, but the document would not be set to private. This would lead to a public document for a non-public attachment

@krmax44
Copy link
Member

krmax44 commented Oct 10, 2024

Ah, I see. Maybe we could use Celery's task linking to run the publishing/depublishing task after the processing task (if a processing task exists)?

@stefanw
Copy link
Member

stefanw commented Nov 22, 2024

Task linking could be an option, would be the first of that in the code base. Another option could be a signal from filingcabinet like document_processed or document_published (or both). Request or attachment code could listen and then decide to reverse a publication if the possibly associated attachment (or the request?!) is not public. But this could be also an excellent source of confusion if actions can be undone by some unrelated code bits.

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.

3 participants