Find recipients for given activity in given timeline

 @api private

 @param timeline_class [Class]    Timeline class
 @param activity       [Activity] Activity instance
 @return [Hash{Object=>Timeline::Route}] Recipients with corresponding Routes
347170
def recipients_for_timeline(timeline_class, activity)
      result = { }

      routes = timeline_class.routes_for_activity(activity.class)
      routes.each do |route|
        route.resolve(activity).each do |recipient|
          recipient_id = timeline_class.recipient_id(recipient)

          # keep only one route per recipient
          if result[recipient_id].nil?
            result[recipient_id] = { :rcpt => recipient, :route => route }
          end
        end
      end

      result.inject({ }) do |memo, (recipient_id, infos)|
        memo[infos[:rcpt]] = infos[:route]
        memo
      end
    end
1149486
def get_threads_where_participant_is_active(self, participant_id):
        
        participations = Participation.objects.\
            filter(participant__id=participant_id).\
            exclude(date_left__lte=now()).\
            distinct().\
            select_related('thread')

        return Thread.objects.\
            filter(id__in=[p.thread.id for p in participations]).\
            distinct()
614403
@Override
    public void getMentions() {
        getDispatcher().invokeLater(new AsyncTask(MENTIONS_TIMELINE, listeners) {
            @Override
            public void invoke(List<TwitterListener> listeners) throws TwitterException {
                ResponseList<Status> statuses = twitter.getMentionsTimeline();
                for (TwitterListener listener : listeners) {
                    try {
                        listener.gotMentions(statuses);
                    } catch (Exception e) { 
                        logger.warn("Exception at getMentions", e);
                    }
                }
            }
        });
    }
963417
public static function createRecipientListRouter(array $recipientLists) : self
    {
        $routerBuilder = self::create( "", 'route');
        $routerBuilder->setObjectToInvoke(new RecipientListRouter($recipientLists));

        return $routerBuilder;
    }
540865
def open_receiver_class
      # Define association for receiver model
      [receivers_class(@@options[:receivers])].flatten.each do |base|
        base.class_eval do
          has_many :deliveries, class_name: 'SimpleNotifications::Delivery', as: :receiver
          has_many :received_notifications, through: :deliveries, source: :simple_notification
        end
      end
    end
267847
public function getRecipients($context = null)
    {
        $recipients = ArrayList::create();

        // if we have a context, use that for returning the recipients
        if ($context && ($context instanceof NotifiedOn || $context->hasMethod('getRecipients'))) 
        {
            $contextRecipients = $context->getRecipients($this->Identifier);
            if ($contextRecipients) {
                $recipients->merge($contextRecipients);
            }
        }

        if ($context instanceof Member) {
            $recipients->push($context);
        } else {
            if ($context instanceof Group) {
                $recipients = $context->Members();
            }
        }

        // otherwise load with a preconfigured list of recipients
        return $recipients;
    }
359348
def _fetch_activities(self):
        
        activities = []
        # Prepare url of the first page
        url = '{0}/organizations/{1}/activity/'.format(
            self.url, self.organization)
        while url:
            # Fetch one page of activities
            try:
                log.debug('Fetching activity data: {0}'.format(url))
                response = requests.get(url, headers=self.headers)
                if not response.ok:
                    log.error(response.text)
                    raise ReportError('Failed to fetch Sentry activities.')
                data = response.json()
                log.data("Response headers:\n{0}".format(
                    pretty(response.headers)))
                log.debug("Fetched {0}.".format(listed(len(data), 'activity')))
                log.data(pretty(data))
                for activity in [Activity(item) for item in data]:
                    # We've reached the last page, older records not relevant
                    if activity.created < self.stats.options.since.date:
                        return activities
                    # Store only relevant activites (before until date)
                    if activity.created < self.stats.options.until.date:
                        log.details("Activity: {0}".format(activity))
                        activities.append(activity)
            except requests.RequestException as error:
                log.debug(error)
                raise ReportError(
                    'Failed to fetch Sentry activities from {0}'.format(url))
            # Check for possible next page
            try:
                url = NEXT_PAGE.search(response.headers['Link']).groups()[0]
            except AttributeError:
                url = None
        return activities
242664
def history_activity(opt = {})
      url = "#{@base_url}/historyactivity"
      if !opt.empty?
        url += "?#{URI.encode_www_form opt}"
      end
      ret = @client.rpc.call_with_json("GET", url, nil)
      ret["items"]
    end
1170764
def recipients(self):
        '''
        '''
        cc = self._cc or []
        bcc = self._bcc or []
        return self._to + cc + bcc
1320364
def get_activity_by_name(self, activity, category_id = None, resurrect = True):
        
        category_id = category_id or 0
        return self.conn.GetActivityByName(activity, category_id, resurrect)
708791
def parse_recipients(header, reference_id=None):
    
    m = _TO_PATTERN.search(header)
    if not m:
        if reference_id and reference_id not in _CABLES_WITHOUT_TO:
            logger.warn('No TO header found in "%s", header: "%s"' % (reference_id, header))
        return []
    to_header = m.group(1)
    return _route_recipient_from_header(to_header, reference_id)
834423
@Override
    public ResponseList<Status> getMentionsTimeline() throws TwitterException {
        return factory.createStatusList(get(conf.getRestBaseURL() + "statuses/mentions_timeline.json"));
    }
1334756
def timeline_entries
      @timeline_entries ||= begin
        result = { }

        self.timelines.each do |(timeline_kind, timeline_class)|
          dir_name = Activr::Utils.kind_for_class(timeline_class)
          dir_path = File.join(Activr.timelines_path, dir_name)

          if !File.directory?(dir_path)
            dir_name = Activr::Utils.kind_for_class(timeline_class, 'timeline')
            dir_path = File.join(Activr.timelines_path, dir_name)
          end

          if File.directory?(dir_path)
            result[timeline_kind] = { }

            Dir["#{dir_path}/*.rb"].sort.inject(result[timeline_kind]) do |memo, file_path|
              base_name = File.basename(file_path, '.rb')

              # skip base class
              if (base_name != "base_timeline_entry")
                klass = "#{timeline_class.name}::#{base_name.camelize}".constantize

                route_kind = if (match_data = base_name.match(/(.+)_timeline_entry$/))
                  match_data[1]
                else
                  base_name
                end

                route = timeline_class.routes.find do |timeline_route|
                  timeline_route.kind == route_kind
                end

                raise "Timeline entry class found for an unspecified timeline route: #{file_path} / routes: #{timeline_class.routes.inspect}" unless route
                memo[route_kind] = klass
              end

              memo
            end
          end
        end

        result
      end
    end
1208930
def activity_show(self, activity_id, **kwargs):
        ""
        api_path = "/api/v2/activities/{activity_id}.json"
        api_path = api_path.format(activity_id=activity_id)
        return self.call(api_path, **kwargs)
659329
def todolist(list_id)
      response = Logan::Client.get "/projects/#{@id}/todolists/#{list_id}.json"
      Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })
    end
1053969
def find_activity(activity_id)
      activity_hash = self.driver.find_activity(activity_id)
      if activity_hash
        # run hook
        self.run_hook(:did_find_activity, activity_hash)

        # unserialize
        Activr::Activity.from_hash(activity_hash)
      else
        nil
      end
    end
79319
def get_conversation_between(self, um_from_user, um_to_user):
        
        messages = self.filter(Q(sender=um_from_user, recipients=um_to_user,
                                 sender_deleted_at__isnull=True) |
                               Q(sender=um_to_user, recipients=um_from_user,
                                 messagerecipient__deleted_at__isnull=True))
        return messages