-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this 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.
8a6d81d
to
00b6d31
Compare
There was a problem hiding this 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.
There was a problem hiding this 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!
This comment was marked as resolved.
This comment was marked as resolved.
This pull request has conflicts ☹ |
There was a problem hiding this 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.
backend/src/api/model/event.rs
Outdated
.delete_event(&event.opencast_id) | ||
.await | ||
.map_err(|e| { | ||
error!("Failed to send delete request: {}", e); | ||
err::internal!("Failed to communicate with Opencast") | ||
})?; |
There was a problem hiding this comment.
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.
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).
backend/src/api/model/event.rs
Outdated
"Failed to delete event, OC returned status: {}", | ||
response.status() | ||
); | ||
Err(err::internal!("Opencast API error: {}", response.status())) |
There was a problem hiding this comment.
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.
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.
There was a problem hiding this 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!
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