rename `post` to `status`

This commit is contained in:
Egor Kislitsyn 2019-01-08 15:25:50 +07:00
parent f24087f96e
commit 63dbd87568
4 changed files with 22 additions and 22 deletions

View File

@ -202,14 +202,14 @@ def admin_api_update(info, params) do
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)

View File

@ -601,8 +601,8 @@ test "it can fetch peertube videos" do
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!!!"})

View File

@ -97,9 +97,9 @@ test "favoriting a status twice returns an error" do
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!!!"})
@ -107,8 +107,8 @@ test "pin post" do
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!!!"})
@ -122,8 +122,8 @@ test "max pinned posts" do
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!!!"})

View File

@ -1472,9 +1472,9 @@ test "put settings", %{conn: conn} do
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!!!"})
@ -1492,8 +1492,8 @@ test "returns pinned posts", %{conn: conn} do
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!!!"})
@ -1514,8 +1514,8 @@ test "pin post", %{conn: conn} do
|> 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!!!"})
@ -1539,8 +1539,8 @@ test "unpin post", %{conn: conn} do
|> 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)
@ -1558,7 +1558,7 @@ test "max pinned posts", %{conn: conn} do
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")