Beispiel #1
0
    def commit(self):
        properties = ('show_progressing_ideas', 'show_tracked_ideas',
                      'show_challenges_ideas', 'domains_choice',
                      'keyword_filter', 'users_filter', 'period_filter')
        if not super(HomeSettingsEditor, self).is_validated(properties):
            return False

        domains = [domain for domain in self.domains if
                   domain.id in self.domains_choice.value]

        # write down the settings into the user's settings
        user = self.user
        home_settings = user.home_settings
        home_settings.show_progressing_ideas = self.show_progressing_ideas.value
        home_settings.show_tracked_ideas = self.show_tracked_ideas.value
        home_settings.show_challenges_ideas = self.show_challenges_ideas.value
        home_settings.domains = domains
        home_settings.keyword_filter = self.keyword_filter.value
        home_settings.period_filter = self.period_filter.value

        users_filter = [UserRepository().get_by_email(email.strip()) for email
                        in self.users_filter.value.split(',') if email.strip()]

        for followed in set(users_filter) - set(
                [u for u in home_settings.users_filter]):
            mail_notification.send('mail-followed-user-notify.html',
                                   to=followed, comment_author=user)
            # add entry in timeline
            user.add_timeline_user(followed)

        home_settings.users_filter = users_filter

        return True
Beispiel #2
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # PROGRES a7
    for author in idea.authors:
        mail_notification.send('mail-idea-deployed.html', to=author, idea=idea)
    _report_state_changed(from_user, idea, new_state)

    notify(u'%s → %s' % (_(state), _(new_state)))
Beispiel #3
0
 def send_moderation_mail(self, from_user):
     mail_notification.send('mail-moderation.html',
                            to=None,
                            moderation_user=from_user.email,
                            moderation_user_firstname=from_user.firstname,
                            moderation_user_lastname=from_user.lastname,
                            idea=self.comment.idea,
                            comment=self.comment.content,
                            delivery_priority=mail_notification.DeliveryPriority.Low)
Beispiel #4
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # PROGRES a2
    for author in idea.authors:
        mail_notification.send('mail-idea-published.html', to=author, idea=idea)

    # SIGNAL d2
    mail_notification.send('mail-idea-submitted-for-di.html', to=idea.submitted_by, idea=idea)

    notify(u'%s → %s' % (_(state), _(new_state)))
Beispiel #5
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # SIGNAL f1
    for author in idea.authors:
        mail_notification.send('mail-idea-submitted-for-authors.html', to=author, idea=idea)

    # PROGRES a1
    mail_notification.send('mail-idea-submitted-for-ci.html', to=idea.submitted_by, idea=idea)

    notify(_(u'Idea completed'))
Beispiel #6
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # SIGNAL f1
    for author in idea.authors:
        mail_notification.send('mail-idea-submitted-for-authors.html', to=author, idea=idea)

    # PROGRES a1
    mail_notification.send('mail-idea-submitted-for-ci.html', to=idea.submitted_by, idea=idea)

    notify(_(u'Your idea has been sent to your innovation facilitator'))
 def send_moderation_mail(self, from_user):
     mail_notification.send(
         'mail-moderation.html',
         to=None,
         moderation_user=from_user.email,
         moderation_user_firstname=from_user.firstname,
         moderation_user_lastname=from_user.lastname,
         idea=self.comment.idea,
         comment=self.comment.content,
         delivery_priority=mail_notification.DeliveryPriority.Low)
Beispiel #8
0
    def _send_email(self, suggestion):
        user = suggestion.user

        mail_notification.send('mail-suggest.html',
                               to=None,
                               suggestion_label=_(suggestion.domain.label),
                               suggestion_user=user.email,
                               suggestion_user_firstname=user.firstname,
                               suggestion_user_lastname=user.lastname,
                               suggestion_content=suggestion.content,
                               delivery_priority=mail_notification.DeliveryPriority.Low)
    def _send_email(self, suggestion):
        user = suggestion.user

        mail_notification.send(
            'mail-suggest.html',
            to=None,
            suggestion_label=_(suggestion.domain.label),
            suggestion_user=user.email,
            suggestion_user_firstname=user.firstname,
            suggestion_user_lastname=user.lastname,
            suggestion_content=suggestion.content,
            delivery_priority=mail_notification.DeliveryPriority.Low)
Beispiel #10
0
def _report_state_changed(from_user, idea, new_state):
    from eureka.domain.models import EventType, StateData
    new_state_data = StateData.get_by(label=new_state)

    # send the state change event
    event_users = set(user for user in (idea.tracked_by + idea.authors) if user.uid != from_user.uid)
    for user in event_users:
        user.add_event(EventType.StateChanged, idea)

    # send the state change email
    comment = _(new_state_data.step.label).lower()
    mail_users = set(user for user in idea.tracked_by if user.uid != from_user.uid)
    for user in mail_users:
        mail_notification.send('mail-event-state-changed.html', to=user, comment=comment, idea=idea,
                               delivery_priority=mail_notification.DeliveryPriority.Low)
    def commit(self):
        properties = ('show_progressing_ideas', 'show_tracked_ideas',
                      'show_challenges_ideas', 'domains_choice',
                      'keyword_filter', 'users_filter', 'period_filter')
        if not super(HomeSettingsEditor, self).is_validated(properties):
            return False

        domains = [
            domain for domain in self.domains
            if domain.id in self.domains_choice.value
        ]

        # write down the settings into the user's settings
        user = self.user
        home_settings = user.home_settings
        home_settings.show_progressing_ideas = self.show_progressing_ideas.value
        home_settings.show_tracked_ideas = self.show_tracked_ideas.value
        home_settings.show_challenges_ideas = self.show_challenges_ideas.value
        home_settings.domains = domains
        home_settings.keyword_filter = self.keyword_filter.value
        home_settings.period_filter = self.period_filter.value

        users_filter = [
            UserRepository().get_by_email(email.strip())
            for email in self.users_filter.value.split(',') if email.strip()
        ]

        for followed in set(users_filter) - set(
            [u for u in home_settings.users_filter]):
            mail_notification.send('mail-followed-user-notify.html',
                                   to=followed,
                                   comment_author=user)
            # add entry in timeline
            user.add_timeline_user(followed)

        home_settings.users_filter = users_filter

        return True
Beispiel #12
0
    def replace_developer(self):
        if not super(DIEditor, self).commit((), ('successor', )):
            return False

        # prepare the content of the confirmation email
        assigned_ideas = IdeaRepository().get_assigned_to_developer(self.user)
        comment = '\n'.join(
            _('%(title)s: %(url)s') %
            dict(title=idea.title, url=self.idea_url(idea))
            for idea in assigned_ideas)

        # transfer the DI responsibilities to the new user
        new_developer = self.user_repository.get_by_uid(self.successor())
        self.user.transfer_responsibilities(RoleType.Developer, new_developer)

        # send the confirmation email
        mail_notification.send('mail-developer-replaced.html',
                               to=new_developer,
                               previous_di=self.user,
                               comment=comment)

        flashmessage.set_flash(_(u'Expert replaced'))

        return True
Beispiel #13
0
    def replace_developer(self):
        if not super(DIEditor, self).commit((), ('successor',)):
            return False

        # prepare the content of the confirmation email
        assigned_ideas = IdeaRepository().get_assigned_to_developer(self.user)
        comment = '\n'.join(_('%(title)s: %(url)s') % dict(title=idea.title,
                                                           url=self.idea_url(
                                                               idea))
                            for idea in assigned_ideas)

        # transfer the DI responsibilities to the new user
        new_developer = self.user_repository.get_by_uid(self.successor())
        self.user.transfer_responsibilities(RoleType.Developer, new_developer)

        # send the confirmation email
        mail_notification.send('mail-developer-replaced.html',
                               to=new_developer,
                               previous_di=self.user,
                               comment=comment)

        flashmessage.set_flash(_(u'Expert replaced'))

        return True
Beispiel #14
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # RENVOI Ips2
    mail_notification.send('mail-idea-forward-for-dsig-di.html', to=idea.submitted_by, comment=comment, idea=idea)

    notify(u'%s → %s' % (_(state), _(new_state)))
Beispiel #15
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # REFUS a1-7
    for author in idea.authors:
        mail_notification.send('mail-idea-refused-by-ips.html', to=author, comment=comment, idea=idea)

    notify(u'%s → %s' % (_(state), _(new_state)))
Beispiel #16
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # INFO a2
    for author in idea.authors:
        mail_notification.send('mail-idea-needs-info-di.html', to=author, comment=comment, idea=idea)

    notify(u'%s → %s' % (_(state), _(new_state)))
Beispiel #17
0
def send_notifications(from_user, idea, state, event, new_state, context, comment, notify, **kw):
    # RENVOI d2
    mail_notification.send('mail-idea-forward-for-di.html', to=idea.submitted_by, idea=idea, previous_di=kw['previous_di'])

    notify(u'%s → %s' % (_(state), _(new_state)))