示例#1
0
    def __AlertEmailParticipants(self, wavelet, who_changed):
        '''
        Send an email out to any other proxy-for participants in the wave
        @param wavelet: the wavelet that the proxy-for participants are
                        subscribed to
        @param who_changed: the friendly name of who changed the wave
        '''
        #Alert other e-mail participants that a new blip has been posted
        sessions = sessionTools.fetch(wavelet.wave_id, wavelet.wavelet_id)

        for userSession in sessions:
            if not userSession.email == self.email and not sessionTools.isPublic(userSession):
                userSettings = settingsTools.get(userSession)
                if not userSettings.unseen_changes and not userSettings.rw_permission == pt_raw.RW['DELETED']:
                    deferred.defer(
                        emailInterface.sendNotificationEmail,
                        sessionCreation.regenerateUser( wavelet.wave_id,
                                                        wavelet.wavelet_id,
                                                        userSession.email   ),
                        wavelet.wave_id,
                        wavelet.wavelet_id,
                        userSession.email,
                        self.email,
                        wavelet.title,
                        who_modified_display=who_changed)
                    
                    settingsTools.markUnseenChanges(session=userSession)
示例#2
0
def updateUsers(event, wavelet):
    '''
    Loops through the users in the wave and sends email if these are the first
    new changes
    @param event: the event that triggered
    @param wavelet: the wavelet where the event triggered
    '''
    blip_id = None
    if event.blip:
        blip_id = event.blip.blip_id
    sessions = sessionTools.fetch(wavelet.wave_id, wavelet.wavelet_id)
    for userSession in sessions:
        if sessionTools.isPublic(userSession):
            continue
        #Dispatch e-mail if these are new changes
        userSettings = settingsTools.get(userSession)
        if userSettings and not userSettings.unseen_changes and not userSettings.rw_permission == pt_raw.RW['DELETED']:
            deferred.defer( emailInterface.sendNotificationEmail,
                            sessionCreation.regenerateUser( wavelet.wave_id,
                                                            wavelet.wavelet_id,
                                                            userSession.email   ),
                            wavelet.wave_id,
                            wavelet.wavelet_id,
                            userSession.email,
                            event.modified_by,
                            wavelet.title)
            settingsTools.markUnseenChanges(session=userSession)

        #Update each users blip unread status
        settingsTools.blipChanges(blip_id, session=userSession)