예제 #1
0
    def _apply_changes(self, sender, **kwargs):
        # we are using after_request to avoid spam in case someone changes many contribution times
        if 'av_request_changes' not in g:
            return
        for req in g.av_request_changes:
            identifiers = get_data_identifiers(req)

            if req.state == RequestState.accepted and identifiers['dates'][
                    0] != req.data['identifiers']['dates'][0]:
                notify_rescheduled_request(req)

            if not compare_data_identifiers(
                    identifiers['locations'],
                    req.data['identifiers']['locations']):
                if (not count_capable_contributions(req.event)[0] and req.state
                        in {RequestState.accepted, RequestState.pending}
                        and not is_av_manager(req.created_by_user)):
                    janitor = User.get_system_user()
                    data = dict(req.data,
                                comment=render_plugin_template(
                                    'auto_reject_no_capable_contribs.txt'))
                    req.definition.reject(req, data, janitor)
                elif req.state == RequestState.accepted:
                    notify_relocated_request(req)
            req.data['identifiers'] = identifiers
            flag_modified(req, 'data')
예제 #2
0
 def send(cls, req, data):
     if (req.id is not None and req.state == RequestState.accepted and
             ('webcast' in req.data['services']) != ('webcast' in data['services'])):
         send_webcast_ping.delay()
     super(AVRequest, cls).send(req, data)
     req.data['identifiers'] = get_data_identifiers(req)
     flag_modified(req, 'data')