def add_pinnned_activity(info, %Pleroma.Activity{id: id}) do
if id not in info.pinned_activities do
- max_pinned_posts = Pleroma.Config.get([:instance, :max_pinned_posts], 0)
+ max_pinned_statuses = Pleroma.Config.get([:instance, :max_pinned_statuses], 0)
params = %{pinned_activities: info.pinned_activities ++ [id]}
info
|> cast(params, [:pinned_activities])
|> validate_length(:pinned_activities,
- max: max_pinned_posts,
- message: "You have already pinned the maximum number of toots"
+ max: max_pinned_statuses,
+ message: "You have already pinned the maximum number of statuses"
)
else
change(info)
assert object
end
- test "returned pinned posts" do
- Pleroma.Config.put([:instance, :max_pinned_posts], 3)
+ test "returned pinned statuses" do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 3)
user = insert(:user)
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
end
end
- describe "pinned posts" do
- test "pin post" do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ describe "pinned statuses" do
+ test "pin status" do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
end
- test "max pinned posts" do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ test "max pinned statuses" do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
CommonAPI.pin(activity_two.id, user)
end
- test "unpin post" do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ test "unpin status" do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
assert user.info.settings == %{"programming" => "socks"}
end
- describe "pinned posts" do
- test "returns pinned posts", %{conn: conn} do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ describe "pinned statuses" do
+ test "returns pinned statuses", %{conn: conn} do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
assert [%{"id" => ^id_str}] = result
end
- test "pin post", %{conn: conn} do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ test "pin status", %{conn: conn} do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|> Jason.decode!()
end
- test "unpin post", %{conn: conn} do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ test "unpin status", %{conn: conn} do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|> Jason.decode!()
end
- test "max pinned posts", %{conn: conn} do
- Pleroma.Config.put([:instance, :max_pinned_posts], 1)
+ test "max pinned statuses", %{conn: conn} do
+ Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
user = insert(:user)
user = User.get_by_ap_id(user.ap_id)
- assert %{"error" => "You have already pinned the maximum number of toots"} =
+ assert %{"error" => "You have already pinned the maximum number of statuses"} =
conn
|> assign(:user, user)
|> post("/api/v1/statuses/#{activity_two.id}/pin")