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

fix: Disallow deleting assets that are used in items #525

Conversation

bartlomiejmarszal
Copy link
Contributor

@bartlomiejmarszal bartlomiejmarszal commented Jan 20, 2025

Missing features

Disallow user from removing assets used in items.

How to test:

  1. Create item with interaction.
  2. Add media and place it in Assets directory
  3. Go to Assets
  4. Delete asset used in item

Screenshot 2025-01-20 at 12 21 22

Add item relation to media on duplicate item, copy item and delete item

Screen.sharing.-.2025-01-22.3_20_18.PM.mp4
  1. Create Asset
  2. Create Item and add asset to that item
  3. Duplicate Item [Asset when deleting should now contain duplicated item]
  4. Copy Item [Asset when deleting should now contain copied item]
  5. Delete Item [Asset when deleting should now not contain deleted item]

Dependencies

oat-sa/generis#1148
https://github.com/oat-sa/tao-core/pull/4180/files

@bartlomiejmarszal bartlomiejmarszal changed the base branch from master to develop January 20, 2025 11:28
@bartlomiejmarszal bartlomiejmarszal requested review from a team, tikhanovichA, KirylHatalski, pnal, Karol-Stelmaczonek and viktar-dzmitryieu-tao and removed request for a team January 20, 2025 11:28
Copy link

github-actions bot commented Jan 20, 2025

Front-end summary Node 18

💯 Total ✅ Passed ⏭️ Skipped ❌ Failed
16 16 0 0

@bartlomiejmarszal bartlomiejmarszal changed the title fix: change confirmation dialog when deleteing assets used by items fix: Disallow deleting assets that are used in items Jan 23, 2025
Copy link
Contributor

@Karol-Stelmaczonek Karol-Stelmaczonek left a comment

Choose a reason for hiding this comment

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

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

Copy link
Contributor

@Karol-Stelmaczonek Karol-Stelmaczonek left a comment

Choose a reason for hiding this comment

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

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

});
foreach ($nestedResources as $nestedResource) {
$resource = $this->getOntology()->getResource($nestedResource['id']);
$property = $this->getOntology()->getProperty('http://www.tao.lu/Ontologies/TAOMedia.rdf#RelatedItem');
Copy link
Contributor

Choose a reason for hiding this comment

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

Cant we use this const ? \oat\taoMediaManager\model\relation\repository\rdf\RdfMediaRelationRepository::ITEM_RELATION_PROPERTY ? Just make it public?

} else {
let itemList = haveItemReferences;
if (itemList.length > overloadLimit) {
itemList = haveItemReferences.slice(0, overloadLimit);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see message saying that there's more items than 15 on this list (and how much), could be handy to make decision what to do next.

Copy link

Version

Target Version 12.44.0
Last version 12.43.1

There are 0 BREAKING CHANGE, 10 features, 15 fixes

@bartlomiejmarszal bartlomiejmarszal merged commit 5bb5d0e into develop Feb 19, 2025
5 checks passed
@bartlomiejmarszal bartlomiejmarszal deleted the fix/ADF-1857/removing-assets-used-in-items-not-possible branch February 19, 2025 15:12
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.

4 participants