Esempio n. 1
0
    def _push_notification(self, cancelling_user, activity_manager):
        email_url = self.uri_for('taskqueue-send-email')
        activity_owner = models.User.get_by_username(
            activity_manager.get_event().username)
        #all users signed up for this activity
        participants_list = activity_manager.get_all_companions()
        participants = [activity_owner.name + ' ' + activity_owner.last_name]
        for participant in participants_list:
            participants.append(
                str(participant.user.get().name) + ' ' +
                str(participant.user.get().last_name))

        #To the activity owner
        template_val = {
            "app_name": self.app.config.get('app_name'),
            "owner_name": activity_owner.name + ' ' + activity_owner.last_name,
            "activity": activity_manager.get_event(),
            "cancelling_user_name":
            cancelling_user.name + ' ' + cancelling_user.last_name,
            "complete": activity_manager.status() == Event.COMPLETE,
            "expires_in": minute_format(activity_manager.expires_in()),
            "participants": ','.join(participants)
        }
        notification_manager = NotificationManager.get()
        notification_manager.push_notification(
            activity_owner.email, '[JoinHour.com]Cancellation',
            'emails/join_cancel_notification.txt', **template_val)
Esempio n. 2
0
    def _push_notification(self, activity_owner, user_id, activity_manager):
        interest_owner = models.User.get_by_id(long(user_id))
        participants_list = activity_manager.get_all_companions()
        participants = []
        for participant in participants_list:
            participants.append(
                str(participant.user.get().name) + ' ' +
                str(participant.user.get().last_name))

        #To the activity owner
        template_val = {
            "app_name": self.app.config.get('app_name'),
            "owner_name": interest_owner.name + ' ' + interest_owner.last_name,
            "activity": activity_manager.get_event(),
            "activity_owner_name":
            activity_owner.name + ' ' + activity_owner.last_name,
            "complete": activity_manager.status() == Event.COMPLETE,
            "expires_in": activity_manager.expires_in(),
            "participants": ''.join(participants)
        }
        notification_manager = NotificationManager.get(self)
        notification_manager.push_notification(
            interest_owner.email,
            '[JoinHour.com]Your interest is now an Activity',
            'emails/interest_converted_to_activity.txt', **template_val)
    def _push_notification(self, activity_manager):
        notification_manager = NotificationManager.get(self)
        activity_user = models.User.get_by_username(
            activity_manager.get_event().username)
        interest_details = get_interest_details(
            activity_manager.get_event().key.urlsafe())
        #To the activity owner if the activity is GO (formed OPEN)
        if activity_manager.status() == Event.FORMED_OPEN:
            template_val = notification_manager.get_base_template()
            template_val['interest'] = interest_details
            notification_manager.push_notification2(
                activity_user.email, 'ActiMom.com: Activity Go Notification',
                'emails/activity_formed_and_open_for_owner.txt',
                Notification.GO_NOTIFICATION, activity_manager.get_event(),
                activity_user, True, **template_val)

        #To the activity participants in case the activity is a GO (formed OPEN)
        if activity_manager.status() == Event.FORMED_OPEN:
            for participant in activity_manager.get_all_companions():
                template_val = notification_manager.get_base_template()
                template_val['interest'] = interest_details
                template_val['participant_username'] = participant.user.get(
                ).username
                notification_manager.push_notification2(
                    participant.user.get().email,
                    'ActiMom.com: Activity Go Notification',
                    'emails/activity_formed_and_open_for_participant.txt',
                    Notification.GO_NOTIFICATION, activity_manager.get_event(),
                    participant.user.get(), True, **template_val)
 def _push_notification(self, activity_manager, request):
     #Notification Rule : Notify only the activity owner about the join request
     notification_manager = NotificationManager.get(self)
     activity_user = models.User.get_by_username(
         activity_manager.get_event().username)
     interest_details = get_interest_details(
         activity_manager.get_event().key.urlsafe())
     request_details = get_request_details(request.key.urlsafe(), None)
     template_val = notification_manager.get_base_template()
     template_val['interest'] = interest_details
     template_val['request'] = request_details
     notification_manager.push_notification(
         activity_user.email, '[Actimom.com]Request to join Notification',
         'emails/request_to_join_activity.txt', **template_val)
    def _push_notification(self,category,activity_owner_name,participant,reason_for_cancellation):

        template_val = {
            "app_name": self.app.config.get('app_name'),
            "activity_name": category,
            "activity_owner_name": activity_owner_name,
            "participant_username": participant.name+' '+participant.last_name,
            "reason_for_cancellation":reason_for_cancellation
        }
        notification_manager = NotificationManager.get()
        notification_manager.push_notification(participant.email,
                                               '[JoinHour.com]Activity cancellation notification',
                                               'emails/activity_cancel_notification_for_participant.txt',
                                               **template_val)
Esempio n. 6
0
 def _send_readyness_notification(self, activity):
     notification_manager = NotificationManager.get(self)
     activity_manager = EventManager.get(activity.key.urlsafe())
     interest_details = get_interest_details(
         activity_manager.get_event().key.urlsafe())
     for participant in activity_manager.get_all_companions():
         template_val = notification_manager.get_base_template()
         template_val['interest'] = interest_details
         template_val['participant_username'] = participant.user.get(
         ).username
         notification_manager.push_notification(
             participant.user.get().email,
             'ActiMom.com Notification: Your activity is starting soon!',
             'emails/activity_formed_and_initiated_for_activity_participant.txt',
             **template_val)
    def _notify_interest_owner(self, username, matches):
        user = models.User.get_by_username(username)

        url_object = urlparse(self.request.url)
        if url_object.port is not None:
            url_str = url_object.scheme + '://' + str(
                url_object.hostname) + ':' + str(url_object.port)
        else:
            url_str = url_object.scheme + '://' + str(url_object.hostname)
        template_val = {
            "app_name": self.app.config.get('app_name'),
            "interest_creator_name": user.name + ' ' + user.last_name,
            "matches": matches,
            "url": url_str
        }
        notification_manager = NotificationManager.get()
        notification_manager.push_notification(
            user.email, 'ActiMom.com: Match notification',
            'emails/match_found_notification_for_interest_owner.txt',
            **template_val)