Beispiel #1
0
    def email_watchers(self, request, thread_type, post):
        from misago.acl.builder import acl
        from misago.acl.exceptions import ACLError403, ACLError404
        from misago.models import ThreadRead, WatchedThread

        notified = []
        for watch in WatchedThread.objects.filter(thread=self).filter(last_read__gte=self.previous_last.date):
            user = watch.user
            if user.pk != request.user.pk:
                try:
                    user_acl = acl(request, user)
                    user_acl.forums.allow_forum_view(self.forum)
                    user_acl.threads.allow_thread_view(user, self)
                    user_acl.threads.allow_post_view(user, self, post)
                    if not user.is_ignoring(request.user):
                        if watch.email:
                            user.email_user(
                                            request,
                                            '%s_reply_notification' % thread_type,
                                            _('New reply in thread "%(thread)s"') % {'thread': self.name},
                                            {'author': request.user, 'post': post, 'thread': self}
                                            )
                        notified.append(user)
                except (ACLError403, ACLError404):
                    pass
        return notified
Beispiel #2
0
    def email_watchers(self, request, thread_type, post):
        from misago.acl.builder import acl
        from misago.acl.exceptions import ACLError403, ACLError404
        from misago.models import ThreadRead, WatchedThread

        notified = []
        for watch in WatchedThread.objects.filter(thread=self).filter(last_read__gte=self.previous_last.date):
            user = watch.user
            if user.pk != request.user.pk:
                try:
                    user_acl = acl(request, user)
                    user_acl.forums.allow_forum_view(self.forum)
                    user_acl.threads.allow_thread_view(user, self)
                    user_acl.threads.allow_post_view(user, self, post)
                    if not user.is_ignoring(request.user):
                        if watch.email:
                            user.email_user(
                                            request,
                                            '%s_reply_notification' % thread_type,
                                            _('New reply in thread "%(thread)s"') % {'thread': self.name},
                                            {'author': request.user, 'post': post, 'thread': self}
                                            )
                        notified.append(user)
                except (ACLError403, ACLError404):
                    pass
        return notified
Beispiel #3
0
    def process_request(self, request):
        request.acl = acl(request.user)

        if (request.user.is_authenticated() and
            (request.acl.team or request.user.is_god()) != request.user.is_team):
            request.user.is_team = (request.acl.team or request.user.is_god())
            request.user.save(force_update=True)

        if request.session.team != request.user.is_team:
            request.session.team = request.user.is_team
            request.session.save()
Beispiel #4
0
    def process_request(self, request):
        request.acl = acl(request, request.user)

        if (request.user.is_authenticated()
                and (request.acl.team
                     or request.user.is_god()) != request.user.is_team):
            request.user.is_team = (request.acl.team or request.user.is_god())
            request.user.save(force_update=True)

        if request.session.team != request.user.is_team:
            request.session.team = request.user.is_team
            request.session.save()
Beispiel #5
0
 def notify_mentioned(self, request, thread_type, users):
     from misago.acl.builder import acl
     from misago.acl.exceptions import ACLError403, ACLError404
     
     mentioned = self.mentions.all()
     for slug, user in users.items():
         if user.pk != request.user.pk and user not in mentioned:
             self.mentions.add(user)
             try:                    
                 acl = acl(request, user)
                 acl.forums.allow_forum_view(self.forum)
                 acl.threads.allow_thread_view(user, self.thread)
                 acl.threads.allow_post_view(user, self.thread, self)
                 if not user.is_ignoring(request.user):
                     alert = user.alert(ugettext_lazy("%(username)s has mentioned you in his reply in thread %(thread)s").message)
                     alert.profile('username', request.user)
                     alert.post('thread', thread_type, self.thread, self)
                     alert.save_all()
             except (ACLError403, ACLError404):
                 pass
Beispiel #6
0
    def notify_mentioned(self, request, thread_type, users):
        from misago.acl.builder import acl
        from misago.acl.exceptions import ACLError403, ACLError404

        mentioned = self.mentions.all()
        for slug, user in users.items():
            if user.pk != request.user.pk and user not in mentioned:
                self.mentions.add(user)
                try:
                    acl = acl(request, user)
                    acl.forums.allow_forum_view(self.forum)
                    acl.threads.allow_thread_view(user, self.thread)
                    acl.threads.allow_post_view(user, self.thread, self)
                    if not user.is_ignoring(request.user):
                        alert = user.alert(
                            ugettext_lazy(
                                "%(username)s has mentioned you in his reply in thread %(thread)s"
                            ).message)
                        alert.profile('username', request.user)
                        alert.post('thread', thread_type, self.thread, self)
                        alert.save_all()
                except (ACLError403, ACLError404):
                    pass
Beispiel #7
0
 def acl(self, request):
     return acl(request, self)
Beispiel #8
0
 def acl(self):
     return acl(self)
Beispiel #9
0
 def acl(self):
     return acl(self)
Beispiel #10
0
 def acl(self, request):
     return acl(request, self)