def set_recipients(self, issue):
     editor = getattr(issue.journal, 'editor', None)
     if editor:
         if user_receive_emails(editor):
             self.recipients = [editor.email, ]
         else:
             logger.info("[IssueBoardMessage.set_recipients] editor (user.pk: %s) does not have a profile or decides to not receive emails." % editor.pk)
     else:
         logger.error("[IssueBoardMessage.set_recipients] Can't prepare a message, issue.journal.editor is None or empty. Issue pk == %s" % issue.pk)
Esempio n. 2
0
 def set_recipients(self, issue):
     editor = getattr(issue.journal, 'editor', None)
     if editor:
         if user_receive_emails(editor):
             self.recipients = [
                 editor.email,
             ]
         else:
             logger.info(
                 "[IssueBoardMessage.set_recipients] editor (user.pk: %s) does not have a profile or decides to not receive emails."
                 % editor.pk)
     else:
         logger.error(
             "[IssueBoardMessage.set_recipients] Can't prepare a message, issue.journal.editor is None or empty. Issue pk == %s"
             % issue.pk)
    def set_bcc_recipients(self, member):
        """ recipients must belong to the same collection as member """
        collections_of_board_member = member.board.issue.journal.collections.all()

        if collections_of_board_member:
            librarians = get_users_by_group_by_collections('Librarian', collections_of_board_member)
        else:
            logger.error("[BoardMembersMessage.set_bcc_recipients] Can't define the collection of member (pk: %s), to filter bcc_recipients" % member.pk)
            return

        if librarians:
            filtered_librarians = [librarian for librarian in librarians if user_receive_emails(librarian)]
            self.bcc_recipients = map(lambda u: u.email, filtered_librarians)
        else:
            logger.error("[BoardMembersMessage.set_bcc_recipients] Can't prepare a message, Can't retrieve a list of Librarian Users.")
Esempio n. 4
0
    def set_bcc_recipients(self, member):
        """ recipients must belong to the same collection as member """
        collections_of_board_member = member.board.issue.journal.collections.all(
        )

        if collections_of_board_member:
            librarians = get_users_by_group_by_collections(
                'Librarian', collections_of_board_member)
        else:
            logger.error(
                "[BoardMembersMessage.set_bcc_recipients] Can't define the collection of member (pk: %s), to filter bcc_recipients"
                % member.pk)
            return

        if librarians:
            filtered_librarians = [
                librarian for librarian in librarians
                if user_receive_emails(librarian)
            ]
            self.bcc_recipients = map(lambda u: u.email, filtered_librarians)
        else:
            logger.error(
                "[BoardMembersMessage.set_bcc_recipients] Can't prepare a message, Can't retrieve a list of Librarian Users."
            )