forked from AkkomaGang/akkoma
rename post
to status
This commit is contained in:
parent
f24087f96e
commit
63dbd87568
4 changed files with 22 additions and 22 deletions
|
@ -202,14 +202,14 @@ def admin_api_update(info, params) do
|
||||||
|
|
||||||
def add_pinnned_activity(info, %Pleroma.Activity{id: id}) do
|
def add_pinnned_activity(info, %Pleroma.Activity{id: id}) do
|
||||||
if id not in info.pinned_activities 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]}
|
params = %{pinned_activities: info.pinned_activities ++ [id]}
|
||||||
|
|
||||||
info
|
info
|
||||||
|> cast(params, [:pinned_activities])
|
|> cast(params, [:pinned_activities])
|
||||||
|> validate_length(:pinned_activities,
|
|> validate_length(:pinned_activities,
|
||||||
max: max_pinned_posts,
|
max: max_pinned_statuses,
|
||||||
message: "You have already pinned the maximum number of toots"
|
message: "You have already pinned the maximum number of statuses"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
change(info)
|
change(info)
|
||||||
|
|
|
@ -601,8 +601,8 @@ test "it can fetch peertube videos" do
|
||||||
assert object
|
assert object
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returned pinned posts" do
|
test "returned pinned statuses" do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 3)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 3)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
|
|
@ -97,9 +97,9 @@ test "favoriting a status twice returns an error" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "pinned posts" do
|
describe "pinned statuses" do
|
||||||
test "pin post" do
|
test "pin status" do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
@ -107,8 +107,8 @@ test "pin post" do
|
||||||
assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
|
assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "max pinned posts" do
|
test "max pinned statuses" do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
@ -122,8 +122,8 @@ test "max pinned posts" do
|
||||||
CommonAPI.pin(activity_two.id, user)
|
CommonAPI.pin(activity_two.id, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "unpin post" do
|
test "unpin status" do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
|
|
@ -1472,9 +1472,9 @@ test "put settings", %{conn: conn} do
|
||||||
assert user.info.settings == %{"programming" => "socks"}
|
assert user.info.settings == %{"programming" => "socks"}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "pinned posts" do
|
describe "pinned statuses" do
|
||||||
test "returns pinned posts", %{conn: conn} do
|
test "returns pinned statuses", %{conn: conn} do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
@ -1492,8 +1492,8 @@ test "returns pinned posts", %{conn: conn} do
|
||||||
assert [%{"id" => ^id_str}] = result
|
assert [%{"id" => ^id_str}] = result
|
||||||
end
|
end
|
||||||
|
|
||||||
test "pin post", %{conn: conn} do
|
test "pin status", %{conn: conn} do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
@ -1514,8 +1514,8 @@ test "pin post", %{conn: conn} do
|
||||||
|> Jason.decode!()
|
|> Jason.decode!()
|
||||||
end
|
end
|
||||||
|
|
||||||
test "unpin post", %{conn: conn} do
|
test "unpin status", %{conn: conn} do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
|
||||||
|
@ -1539,8 +1539,8 @@ test "unpin post", %{conn: conn} do
|
||||||
|> Jason.decode!()
|
|> Jason.decode!()
|
||||||
end
|
end
|
||||||
|
|
||||||
test "max pinned posts", %{conn: conn} do
|
test "max pinned statuses", %{conn: conn} do
|
||||||
Pleroma.Config.put([:instance, :max_pinned_posts], 1)
|
Pleroma.Config.put([:instance, :max_pinned_statuses], 1)
|
||||||
|
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
@ -1558,7 +1558,7 @@ test "max pinned posts", %{conn: conn} do
|
||||||
|
|
||||||
user = User.get_by_ap_id(user.ap_id)
|
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
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/statuses/#{activity_two.id}/pin")
|
|> post("/api/v1/statuses/#{activity_two.id}/pin")
|
||||||
|
|
Loading…
Reference in a new issue