def _activities_statuses(self):
        if not self.show_microblog:
            raise StopIteration()
        container = PLONESOCIAL.microblog
        # show_microblog yet no container can happen on microblog uninstall
        if not container:
            raise StopIteration()

        # filter on users OR context, not both
        if self.users:
            # support plonesocial.network integration
            activities = container.user_values(self.users,
                                               limit=self.count,
                                               tag=self.tag)
        elif self.microblog_context:
            # support collective.local integration
            activities = container.context_values(self.microblog_context,
                                                  limit=self.count,
                                                  tag=self.tag)
        else:
            # default implementation
            activities = container.values(limit=self.count, tag=self.tag)

        # For a reply IStatusActivity we render the parent post and then
        # all the replies are inside that. So, here we filter out reply who's
        # parent post we already rendered.
        seen_thread_ids = []
        for activity in activities:
            if (activity.thread_id and activity.thread_id in seen_thread_ids) \
                    or activity.id in seen_thread_ids:
                continue

            if IStatusActivityReply.providedBy(activity):
                seen_thread_ids.append(activity.thread_id)
            else:
                seen_thread_ids.append(activity.id)

            yield activity
    def _activities_statuses(self):
        if not self.show_microblog:
            raise StopIteration()
        container = PLONESOCIAL.microblog
        # show_microblog yet no container can happen on microblog uninstall
        if not container:
            raise StopIteration()

        # filter on users OR context, not both
        if self.users:
            # support plonesocial.network integration
            activities = container.user_values(self.users,
                                               limit=self.count,
                                               tag=self.tag)
        elif self.microblog_context:
            # support collective.local integration
            activities = container.context_values(self.microblog_context,
                                                  limit=self.count,
                                                  tag=self.tag)
        else:
            # default implementation
            activities = container.values(limit=self.count, tag=self.tag)

        # For a reply IStatusActivity we render the parent post and then
        # all the replies are inside that. So, here we filter out reply who's
        # parent post we already rendered.
        seen_thread_ids = []
        for activity in activities:
            if (activity.thread_id and activity.thread_id in seen_thread_ids) \
                    or activity.id in seen_thread_ids:
                continue

            if IStatusActivityReply.providedBy(activity):
                seen_thread_ids.append(activity.thread_id)
            else:
                seen_thread_ids.append(activity.id)

            yield activity
Ejemplo n.º 3
0
 def replies(self):
     container = PLONESOCIAL.microblog
     for reply in container.thread_values(self.id):
         if IStatusActivityReply.providedBy(reply):
             yield reply
Ejemplo n.º 4
0
 def replies(self):
     container = PLONESOCIAL.microblog
     for reply in container.thread_values(self.id):
         if IStatusActivityReply.providedBy(reply):
             yield reply