Esempio n. 1
0
def participant_wavelet_init(wavelet, participant, modified_by, message=None):
    """Initialize the participant in the wavelet"""

    pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id)
    if pwp: return
    pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id, create=True)

    pp = participant_init(wavelet, participant)
    if not pp.notify_initial: return

    email.send_message(pwp, modified_by, wavelet.title, wavelet.wave_id,
                       wavelet.wavelet_id, wavelet.root_blip.blip_id, message)
def notify_participant_deferred(participant, modified_by, title, wave_id, wavelet_id, blip_id, message):
    """Sends a notification to the participant"""

    pp = model.ParticipantPreferences.get_by_pk(participant)
    if not pp or not pp.notify: return

    pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)
    if not pwp or pwp.notify_type == model.NOTIFY_NONE: return

    if pwp.notify_type == model.NOTIFY_ONCE:
        if not pwp.visited: return
        message = templates.NOTIFY_ONCE_TEMPLATE % message
        pwp.visited = False

    email.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message)
    phone.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message)
def notify_participant_deferred(participant, modified_by, title, wave_id,
                                wavelet_id, blip_id, message):
    """Sends a notification to the participant"""

    pp = model.ParticipantPreferences.get_by_pk(participant)
    if not pp or not pp.notify: return

    pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)
    if not pwp or pwp.notify_type == model.NOTIFY_NONE: return

    if pwp.notify_type == model.NOTIFY_ONCE:
        if not pwp.visited: return
        message = templates.NOTIFY_ONCE_TEMPLATE % message
        pwp.visited = False

    email.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id,
                       message)
    phone.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id,
                       message)