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 delete button to "video details" #1172

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

owi92
Copy link
Member

@owi92 owi92 commented May 29, 2024

This adds a "delete" button to the "Video details" page which will remove that event in Tobira and send a delete request to Opencast. While that operation is pending and when it fails on Opencast side, the event will still be visible on the "My Videos" page marked respectively, but only there and only as long as it is still present in Opencast. Tobira's sync code will pick up if it gets eventually deleted, and then the "pending/ deletion failed" event will be removed completely.

See commits for more technical details.
Should be fine to review commit by commit.

Closes #806

@owi92 owi92 added the changelog:user User facing changes label May 29, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 29, 2024 14:41 Destroyed
@owi92 owi92 marked this pull request as draft May 29, 2024 15:31
@owi92

This comment was marked as outdated.

@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label May 29, 2024

This comment was marked as resolved.

@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label May 29, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 29, 2024 21:13 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 29, 2024 21:16 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 30, 2024 11:04 Destroyed
@owi92 owi92 marked this pull request as ready for review May 30, 2024 11:15
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 30, 2024 14:11 Destroyed
@owi92 owi92 changed the title Deleting videos Add delete button to "video details" May 30, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 May 31, 2024 14:31 Destroyed

This comment was marked as resolved.

@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Jun 3, 2024
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Unfortunately, I found a few larger things that need fixing, plus the usual small stuff of course.

backend/src/http/handlers.rs Outdated Show resolved Hide resolved
backend/src/sync/client.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Show resolved Hide resolved
frontend/src/i18n/locales/en.yaml Outdated Show resolved Hide resolved
frontend/src/routes/manage/Video/index.tsx Outdated Show resolved Hide resolved
frontend/src/ui/Video.tsx Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Jun 6, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 6, 2024 10:59 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 9, 2024 16:08 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 9, 2024 16:16 Destroyed
@owi92 owi92 force-pushed the deleting-videos branch 2 times, most recently from 8a6d81d to 00b6d31 Compare June 9, 2024 16:20
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 9, 2024 16:23 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 9, 2024 22:26 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

All previous comments are resolved, but I found a few new ones. Smaller ones though, I think.

backend/src/http/mod.rs Outdated Show resolved Hide resolved
backend/src/http/mod.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/http/assets.rs Outdated Show resolved Hide resolved
frontend/src/routes/manage/Video/index.tsx Outdated Show resolved Hide resolved
frontend/src/i18n/locales/en.yaml Show resolved Hide resolved
frontend/src/i18n/locales/en.yaml Outdated Show resolved Hide resolved
@LukasKalbertodt LukasKalbertodt added this to the v2.10 milestone Jun 11, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 11, 2024 15:54 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

👍 code looks good. I still need to test this though!

@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 11, 2024 16:17 Destroyed
@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Jun 20, 2024

This comment was marked as resolved.

@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Jun 20, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 20, 2024 10:32 Destroyed
Copy link

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Jun 20, 2024
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Just found out I had these two comments queued.

Comment on lines 348 to 353
.delete_event(&event.opencast_id)
.await
.map_err(|e| {
error!("Failed to send delete request: {}", e);
err::internal!("Failed to communicate with Opencast")
})?;
Copy link
Member

Choose a reason for hiding this comment

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

I just tested this and the resulting shown error is not ideal I think.

image

I think it would be nicer if instead it would say something like "Deleting the video failed. Opencast is currently not available, try again later". I think I would even introduce a new "error kind" OpencastDown or sth like that, as to not use internal server error for this (unauthorized and bad input are also not fitting).

"Failed to delete event, OC returned status: {}",
response.status()
);
Err(err::internal!("Opencast API error: {}", response.status()))
Copy link
Member

Choose a reason for hiding this comment

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

Same as above: not internal error, but sth like "opencast down".

This migration also renames the `events` table
and creates a new view holding all events without the
deletion timestamp. This is done out of convenience as
to avoid having to adjust every query with a check for
that deletion timestamp.
This is necessary in order to make authenticated
http request in graphQL mutations and other api calls.
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Jun 20, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 20, 2024 11:21 Destroyed
The underlying function calls the external OC event API
to request the deletion of a single video and sets the
`tobira_deletion_timestamp` in the video's DB entry.

Unfortunately this API can't tell us if the deletion
succeeded, only that the retraction of the event was started.
That check and the following removal from the DB is done
by inspecting the previously mentioned timestamp (implemented
in the next commit).
"My Videos" will now indicate if a video has been deleted in
Tobira, but not (yet) in Opencast. After the request has been
sent, the deleted video will be marked as "delete pending".
When the event hasn't been removed in sync after a minute,
the deletion in Opencast has probably failed, so it gets marked
accordingly.
@github-actions github-actions bot temporarily deployed to test-deployment-pr1172 June 20, 2024 12:06 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Tested now and everything works as expected!

@LukasKalbertodt LukasKalbertodt merged commit 17dbd08 into elan-ev:master Jun 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:user User facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting videos in Tobira
2 participants