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

Announcement type is removed without removing related files #10060

Open
jonasraoni opened this issue Jun 15, 2024 · 12 comments · May be fixed by #10064 or pkp/ojs#4318
Open

Announcement type is removed without removing related files #10060

jonasraoni opened this issue Jun 15, 2024 · 12 comments · May be fixed by #10064 or pkp/ojs#4318
Assignees
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users.
Milestone

Comments

@jonasraoni
Copy link
Contributor

jonasraoni commented Jun 15, 2024

Describe the bug
After the introduction of foreign keys, the assignment type is removed, but the related images are not.

PRs

What application are you using?
OJS 3.4

@jonasraoni
Copy link
Contributor Author

@bozana could you please review this one too? The fixes are on the first 2 commits, the last one is mostly about typing/formatting.

@bozana
Copy link
Collaborator

bozana commented Jun 19, 2024

Hi @jonasraoni, here I should wait for you to take a look at nullable that we mentioned in the dev call, or?

@jonasraoni
Copy link
Contributor Author

Hi! I think you can proceed with the review, most of the updates here are not related to the issue.

Then, I'll create a generic issue to handle the removal of entities that have dependents. The current solution is to block the operation, until the user clears all the dependencies manually... We can offer more options (clear/re-assign the dependencies to another record) to simplify the maintenance.

@bozana
Copy link
Collaborator

bozana commented Jun 20, 2024

@jonasraoni, a question before I finish the review:
Isn't it so that the announcement title should always exist? -- I see it is nullable in the json schema, but it is a required field in the form. It seems logical to me that the title needs to be there, no? Also the datePosted?
The same for announcement type name?

@bozana
Copy link
Collaborator

bozana commented Jun 20, 2024

Ah, and why do we delete announcements when deleting an announcement type? Shouldn't the type_id just be set to null?
In the Announcement migration we say:
$table->foreign('type_id')->references('type_id')->on('announcement_types')->onDelete('set null');

Thus, I would think we shouldn't do anything else when deleting an announcement type?

@jonasraoni
Copy link
Contributor Author

Hi! I didn't dig so deep, I just applied some fixes/updates, but I agree with everything.

  • Cascading/set null: I've created another issue to check if there are other cases: Inspect cascading rules to avoid unexpected side-effects #10096
    But as the database was already fixed, I'll do the update in this PR 👌
  • title/datePosted: Yeah, the nullable validation together with the required sounds odd. There are other cases in the codebase (see the category.json). I'll inspect what the nullable is doing and address the issue here as well.

@bozana
Copy link
Collaborator

bozana commented Jun 20, 2024

Thanks @jonasraoni, that all sounds good!

@jonasraoni
Copy link
Contributor Author

@bozana FYI, the nullable is required. That's how it works:

  • required: Forces the user to fill at least the main locale of a multilingual field.
  • nullable: Allows the user to leave the remaining locales empty, when it's not present, the user has to fill all locales with something.

@bozana
Copy link
Collaborator

bozana commented Jun 21, 2024

@jonasraoni, let me know when another review round can be done... Thanks!!!

jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jun 25, 2024
jonasraoni added a commit to jonasraoni/ojs that referenced this issue Jun 25, 2024
@jonasraoni
Copy link
Contributor Author

@bozana, I think I've addressed all comments, please take a look when you get some free time.

jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 1, 2024
jonasraoni added a commit to jonasraoni/ojs that referenced this issue Jul 1, 2024
@jonasraoni
Copy link
Contributor Author

@bozana I almost forgot about this PR, I've updated the getDatePosted() to return null, which was the last comment that I saw.

Regarding the nullable, just to confirm, most of the entities would not fail because we have a lot of non-used code. Very few entities are using the Repository::validate($object), most of them are relying on the Form validation.

@bozana
Copy link
Collaborator

bozana commented Jul 2, 2024

Hi @jonasraoni, please go ahead and merge. Let me know if I need to take a look at something when you port it to other branches -- e.g. if you do more changes for the main branch...
Thanks!

@asmecher asmecher modified the milestones: 3.4.0-6, 3.4.0-7 Jul 19, 2024
@asmecher asmecher modified the milestones: 3.4.0-7, 3.4.0-8 Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users.
Projects
None yet
3 participants