mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-12 23:27:22 +00:00
VC/Vidyo: Adapt to new objects
This commit is contained in:
parent
7e44e85156
commit
56e80e499b
@ -14,6 +14,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Indico; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from indico.core.plugins import IndicoPluginBlueprint
|
||||
|
||||
from indico_vc_vidyo.controllers import RHVidyoRoomOwner
|
||||
|
||||
@ -16,9 +16,6 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
from dateutil import rrule
|
||||
|
||||
from flask_script import Manager
|
||||
from terminaltables import AsciiTable
|
||||
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Indico; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import transaction
|
||||
from flask import flash, jsonify, session
|
||||
|
||||
|
||||
@ -154,8 +154,8 @@ class VidyoPlugin(VCPluginMixin, IndicoPlugin):
|
||||
defined in Vidyo plugin's settings, in that order.
|
||||
|
||||
:param vc_room: VCRoom -- The VC room from which to create the Vidyo
|
||||
room
|
||||
:param event: Conference -- The event to the Vidyo room will be attached
|
||||
room
|
||||
:param event: Event -- The event to the Vidyo room will be attached
|
||||
"""
|
||||
client = AdminClient(self.settings)
|
||||
owner = retrieve_principal(vc_room.data['owner'], allow_groups=False, legacy=False)
|
||||
|
||||
@ -39,8 +39,8 @@ def find_old_vidyo_rooms(max_room_event_age):
|
||||
recently_used = (db.session.query(VCRoom.id)
|
||||
.filter(VCRoom.type == 'vidyo',
|
||||
Event.end_dt > (now_utc() - timedelta(days=max_room_event_age)))
|
||||
.join(VCRoomEventAssociation)
|
||||
.join(Event)
|
||||
.join(VCRoom.events)
|
||||
.join(VCRoomEventAssociation.event_new)
|
||||
.group_by(VCRoom.id))
|
||||
|
||||
# non-deleted rooms with no recent associations
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{% macro render_make_me_owner(event, vc_room, event_vc_room, extra_classes='') %}
|
||||
{% if session.user != vc_room.vidyo_extension.owned_by_user and event.as_event.can_manage(session.user) %}
|
||||
{% if session.user != vc_room.vidyo_extension.owned_by_user and event.can_manage(session.user) %}
|
||||
<a class="i-button highlight arrow {{ extra_classes }}" data-toggle="dropdown"></a>
|
||||
<ul class="dropdown" data-level="level1">
|
||||
<li>
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
{% elif event_vc_room.link_type.name == 'event' %}
|
||||
{% trans %}the whole event{% endtrans %}
|
||||
{% elif event_vc_room.link_type.name == 'contribution' %}
|
||||
{% trans %}Contribution{% endtrans %}: {{ obj.getTitle() }}
|
||||
{% trans %}Contribution{% endtrans %}: {{ obj.title }}
|
||||
{% elif event_vc_room.link_type.name == 'block' %}
|
||||
{% trans %}Session{% endtrans %}: {{ obj.getFullTitle() }}
|
||||
{% trans %}Session{% endtrans %}: {{ obj.full_title }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% if vc_room.data.room_pin %}
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
|
||||
{% block buttons %}
|
||||
{{ render_join_button(vc_room, extra_classes="icon-play") }}
|
||||
{{ render_make_me_owner(event_vc_room.event, vc_room, event_vc_room) }}
|
||||
{{ render_make_me_owner(event_vc_room.event_new, vc_room, event_vc_room) }}
|
||||
{% endblock %}
|
||||
|
||||
@ -24,19 +24,6 @@ from indico.modules.vc.models.vc_rooms import VCRoom, VCRoomEventAssociation, VC
|
||||
from indico_vc_vidyo.models.vidyo_extensions import VidyoExtension
|
||||
|
||||
|
||||
class DummyEvent(object):
|
||||
def __init__(self, id_, title, end_date):
|
||||
self.id = id_
|
||||
self.title = title
|
||||
self.end_date = end_date
|
||||
|
||||
def getEndDate(self):
|
||||
return self.end_date
|
||||
|
||||
def getId(self):
|
||||
return self.id
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def create_dummy_room(db, dummy_avatar):
|
||||
"""Returns a callable which lets you create dummy Vidyo room occurrences"""
|
||||
@ -66,11 +53,12 @@ def test_room_cleanup(create_event, create_dummy_room, dummy_avatar, freeze_time
|
||||
"""Test that 'old' Vidyo rooms are correctly detected"""
|
||||
freeze_time(datetime(2015, 2, 1))
|
||||
|
||||
events = {}
|
||||
for id_, (evt_name, end_date) in enumerate((('Event one', datetime(2012, 1, 1, tzinfo=utc)),
|
||||
('Event two', datetime(2013, 1, 1, tzinfo=utc)),
|
||||
('Event three', datetime(2014, 1, 1, tzinfo=utc)),
|
||||
('Event four', datetime(2015, 1, 1, tzinfo=utc))), start=1):
|
||||
create_event(id_, title=evt_name, end_dt=end_date, start_dt=end_date)
|
||||
events[id_] = create_event(id_, title=evt_name, end_dt=end_date, start_dt=end_date)
|
||||
|
||||
for id_, (vidyo_id, extension, evt_ids) in enumerate(((1234, 5678, (1, 2, 3, 4)),
|
||||
(1235, 5679, (1, 2)),
|
||||
@ -81,7 +69,7 @@ def test_room_cleanup(create_event, create_dummy_room, dummy_avatar, freeze_time
|
||||
'vidyo_id': vidyo_id
|
||||
})
|
||||
for evt_id in evt_ids:
|
||||
VCRoomEventAssociation(vc_room=room, event_id=evt_id, link_type=VCRoomLinkType.event)
|
||||
VCRoomEventAssociation(vc_room=room, linked_event=events[evt_id])
|
||||
db.session.flush()
|
||||
|
||||
from indico_vc_vidyo.task import find_old_vidyo_rooms
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user