From 86f05e0683d309b1e25526d73d84a96a282da33f Mon Sep 17 00:00:00 2001 From: sino Date: Sun, 15 Oct 2023 20:13:08 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=96=E3=83=AB=E3=82=BD=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A3=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/timeline_controller.ex | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 1d4e734a4..bb18fc745 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -1,6 +1,7 @@ # Pleroma: A lightweight social networking server # Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# メモ:タイムライン取得系です defmodule Pleroma.Web.MastodonAPI.TimelineController do use Pleroma.Web, :controller @@ -176,7 +177,7 @@ def bubble(%{assigns: %{user: user}} = conn, params) do Logger.debug("TimelineController.bubble: fetching activities") - activities = + activities_from_bubble = params |> Map.put(:type, ["Create"]) |> Map.put(:blocking_user, user) @@ -187,6 +188,35 @@ def bubble(%{assigns: %{user: user}} = conn, params) do Logger.debug("TimelineController.bubble: rendering") + #ここからホーム取得の追加 + followed_hashtags = + user + |> User.followed_hashtags() + |> Enum.map(& &1.id) + + params = + params + |> Map.put(:type, ["Create", "Announce"]) + |> Map.put(:blocking_user, user) + |> Map.put(:muting_user, user) + |> Map.put(:reply_filtering_user, user) + |> Map.put(:announce_filtering_user, user) + |> Map.put(:user, user) + |> Map.put(:local_only, params[:local]) + |> Map.put(:followed_hashtags, followed_hashtags) + |> Map.delete(:local) + + %{nickname: nickname} = user + Logger.debug("TimelineController.home: #{nickname} - fetching activities") + + activities_from_user_following = + [user.ap_id | User.following(user)] + |> ActivityPub.fetch_activities(params) + |> Enum.reverse() + + #取得結果を結合 + activities = activities_from_bubble ++ activities_from_user_following + conn |> add_link_headers(activities) |> render("index.json",