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

feat: Add session recordings #8218

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

holloway
Copy link
Contributor

@holloway holloway commented Nov 17, 2024

Replaces #8084

  • Allows a secretariat to add and delete session recordings (youtube urls)

Screenshot from 2024-11-18 11-11-17

Screenshot from 2024-11-18 11-11-37

Comment on lines 2622 to 2623
today = datetime.datetime.now()
initial = {'title': f"Video recording for {session.group.acronym} on {today.strftime('%b-%d-%Y at %H:%M:%S')}"}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Video recording for tools on 2024-10-15 at 18:00:00. We should probably suggest a title of that form - @rjsparks

Done. Do timezones matter? Should it be UTC?

Copy link
Member

@jennifer-richards jennifer-richards Nov 18, 2024

Choose a reason for hiding this comment

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

I don't know what the existing TZ convention (if any) is, but I think UTC is the right choice. I'd probably add "... UTC" to the default name, though it'd mean a break from existing filename convention.

Copy link
Member

Choose a reason for hiding this comment

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

Why today?

The recording is for a working group session and the times should be the times for that session, not the time of the upload of the recording.

We should consider capturing the moment of "upload" (really, setting a URL) as a docevent, but I don't think we're currently doing that when meetecho reports uploads to youtube, so maybe this is a separate issue for improving both.

But yes, we should present in UTC by default - some views offer browser or meeting local time as well - this upload doesn't need to though, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, it now looks like this

Screenshot from 2024-11-19 09-51-01

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the assumption that session.meeting.date is already UTC. Is that correct?

Copy link
Member

Choose a reason for hiding this comment

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

Sadly, I don't think so, it'll be the date in the meeting timezone.

Copy link
Member

@jennifer-richards jennifer-richards Nov 19, 2024

Choose a reason for hiding this comment

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

Meeting.start_datetime() will give you a timezone-aware midnight in the meeting timezone. If you have a Session (which I think you do), then the way to get the formatted start time of that session is:

session.official_timeslotassignment().timeslot.utc_start_time().strftime(...)

Copy link
Member

Choose a reason for hiding this comment

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

Also, this needs a guard against official_timeslotassignment() not existing unless it's guaranteed to exist. It should exist for anything that is on an agenda.

Comment on lines +2612 to +2613
if delete:
delete_recording(pk=delete, session=session)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should think through what a chair would do if they entered the wrong link and wanted to fix it. @rjsparks

I've added a delete button. Is that ok?

Screenshot from 2024-11-18 10-56-26

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the 'Revision' column is that valid for recordings? How would someone update the revision of a recording anyway?

Copy link
Member

Choose a reason for hiding this comment

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

It's valid as long as we're modeling recordings as Document objects.

To date, we have not revised a recording document. Doesn't mean we couldn't (with the current model anyhow). An -01 for youtube would just point to a different URL the same as an -01 for a draft points to a different filename.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thoughts on the delete button? Should it have a confirmation modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to assume we need a confirmation modal.

Copy link
Contributor Author

@holloway holloway Nov 18, 2024

Choose a reason for hiding this comment

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

Done. It looks like this. I did it in plain JS with a <dialog> rather than Bootstrap as we're looking to migrate away from that.

Screenshot from 2024-11-19 13-01-20

Copy link
Member

Choose a reason for hiding this comment

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

I have minor heartburn that we're allowing a Document object to be deleted. It violates an assumption about what Document objects are for, but I suppose we have that problem with these recording documents-that-are-just-external-links already and some future project should migrate them to some other model instead.

I'll request one change and we can move forward with this.

@holloway holloway requested review from rjsparks and jennifer-richards and removed request for rjsparks November 17, 2024 22:10
@holloway holloway requested a review from rjsparks November 18, 2024 05:00
Comment on lines 2594 to 2596
initial = {
'title': f"Video recording for {session.group.acronym} on {session.meeting.date.strftime('%b-%d-%Y at %H:%M:%S')}"
}
Copy link
Member

Choose a reason for hiding this comment

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

To be more concrete about my comments elsewhere, I think something like this is what is needed. The assertion() call is not bulletproof, there'll still be a 500 if this comes up.

Suggested change
initial = {
'title': f"Video recording for {session.group.acronym} on {session.meeting.date.strftime('%b-%d-%Y at %H:%M:%S')}"
}
timeslot = session.official_timeslotassignment()
assertion("timeslot is not None")
initial = {
'title': f"Video recording for {session.group.acronym} on {timeslot.utc_start_time().strftime('%b-%d-%Y at %H:%M:%S')}"
}

Copy link
Member

Choose a reason for hiding this comment

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

Noticed I botched the timeslotassignment.timeslot step - glad you caught it!

</table>
</form>
<dialog id="delete_confirm_dialog">
<p>Really delete <a href="#" id="delete_confirm_link"></a>?</p>
Copy link
Member

Choose a reason for hiding this comment

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

Could we say Really delete the link to instead? We don't want to leave anyone with the impression that this will remove the recording at youtube.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, it looks like this now

Screenshot from 2024-11-20 07-33-26

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 52.38095% with 20 lines in your changes missing coverage. Please review.

Project coverage is 88.90%. Comparing base (c7f6bde) to head (7497306).
Report is 222 commits behind head on main.

Files with missing lines Patch % Lines
ietf/meeting/views.py 55.26% 17 Missing ⚠️
ietf/meeting/utils.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8218      +/-   ##
==========================================
+ Coverage   88.78%   88.90%   +0.11%     
==========================================
  Files         296      303       +7     
  Lines       41320    41322       +2     
==========================================
+ Hits        36687    36738      +51     
+ Misses       4633     4584      -49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@holloway holloway requested a review from rjsparks November 20, 2024 01:37
Copy link
Member

@rjsparks rjsparks left a comment

Choose a reason for hiding this comment

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

I think this will work now (and it seems fine with manual testing). We need CI tests though.

Comment on lines +2604 to +2606
delete = request.POST.get('delete', False)
if delete:
delete_recording(pk=delete, session=session)
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to utilize the form framework here to get back a Document instead of a pk. As written, I think a malicious post could delete an arbitrary document.

'''
document = Document.objects.filter(pk=pk, group=session.group).first()
if document:
document.delete()
Copy link
Member

Choose a reason for hiding this comment

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

This is what caught my eye. This function would be better accepting a Document object rather than a pk, and perhaps should live in the Session model so that the connection to Session is naturally enforced.

@jennifer-richards
Copy link
Member

This is a suggestion following up @rjsparks' comments inline regarding deletion of the Document and the interface for doing so. The inline conversation was long enough I think this might be easier to follow.

I think the "Delete the link to..." action should delete the SessionPresentation that links to the Document rather than the Document itself. This avoids the worry about changing the historical policy about Document lifetimes. It also lets the delete_recording() action restrict itself to the Session rather than using session.group as a proxy and trusting the discretion/awareness of materials managers.

When deleting the SessionPresentation, the Document should have its "recording" state set to "deleted" rather than actually being deleted from the database.

As far as pk vs instances, I don't think the modeling will let us use ModelForm in the way @rjsparks was suggesting. If it can, that'd be better, but SessionPresentation is really just an annotated through model between Document and Session. If this was planned to be a traditional HTML forms interface, the right approach would be a FormSet that could do that magic, but as an endpoint for a JS front end I think we have to roll our own.

@rjsparks
Copy link
Member

This particular view isn't using a js frontend.

@jennifer-richards
Copy link
Member

This particular view isn't using a js frontend.

Ah, I guess I'd mixed it up with work in other PRs. In that case we might want to use a formset

@rjsparks rjsparks marked this pull request as draft November 22, 2024 14:15
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.

3 participants