Related Works count in dashboard sidebar doesn't decrease if a parent work is deleted

Description

Overview

If you post a work that is inspired by another work on the Archive, and that inspiring work is deleted, it will be removed from your Related Works page... but the count in the dashboard will not go down and the RelatedWork object will continue to exist in the database.

Steps to reproduce

  1. First, create a work (the parent work) that will be listed as the inspiration for another work

    1. Log in as User A

    2. Post > New Work

    3. Fill in required information

    4. Press "Post Without Preview"

    5. Note the URL of this work

    6. Log out as User A

  2. Now create a work that will cite the previous as its inspiration

    1. Log in as User B

    2. Post > New Work

    3. Fill in required inform

    4. Check "This work is a remix, a translation, a podfic, or was inspired by another work"

    5. Paste the URL of the parent work in the "URL" field

    6. Press "Post Without Preview"

    7. Hi, username! > My Dashboard

    8. Make note of how many Related Works your dashboard sidebar says you have

    9. Log out

  3. Delete the parent work

    1. Log in as User A

    2. Go to the work you posted

    3. Edit > Delete Work

    4. Confirm that you want to delete said work

What should happen

User B's Related Work count should decrease by 1.

What happens instead

The count does not decrease by 1. It stays the same.

Notes

Work B is (correctly) no longer listed on your Related Works page; it's just the count in the sidebar that is wrong. We should probably make sure we delete the RelatedWork object because it doesn't serve much purpose once the deleted item is gone.

Also note that that the edit page for Work B no longer shows the related work, so it can’t be fixed by the user. A database admin needs to delete the RelatedWork to fix the count.

 

Environment

None

Status

Assignee

Unassigned

Reporter

Sarken

Roadmap

Works

Priority

Low

Affects versions

0.9.252

Fix versions

None

Components

BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9