Commit graph

55 commits

Author SHA1 Message Date
Mark Felder c6f783c551 Pleroma.Web.ControllerHelper: fix @spec to resolve dialyzer errors
lib/pleroma/web/admin_api/controllers/user_controller.ex:333:no_return
Function index/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:357:unused_fun
Function maybe_parse_filters/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:366:no_return
Function page_params/1 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:368:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.fetch_integer_param(_params :: any(), :page, 1)

breaks the contract
(map(), String.t(), integer() | nil) :: integer() | nil
2024-01-31 11:01:37 -05:00
Mark Felder 4d20fbc6d9 Pleroma.Web.PleromaAPI.ChatController: fix dialyzer errors with replace_params: false 2024-01-31 10:12:59 -05:00
Mark Felder 81c8592d69 Pleroma.Web.MastodonAPI.AccountController: fix dialyzer errors with replace_params: false 2024-01-30 16:50:00 -05:00
Mark Felder 4fc177eb46 Pleroma.Web.ControllerHelper: dialyzer error
lib/pleroma/web/controller_helper.ex:97:pattern_match
The pattern can never match the type.

Pattern:
nil

Type:
%Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{
    binary() =>
      binary()
      | [binary() | [any()] | %{binary() => _}]
      | %{binary() => binary() | [any()] | %{binary() => _}}
  },
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() =>
      binary()
      | [binary() | [any()] | %{binary() => _}]
      | %{binary() => binary() | [any()] | %{binary() => _}}
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{binary(), binary()}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{binary(), binary()}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}
2024-01-29 16:42:48 -05:00
lain e853cfe7c3 Revert "Merge branch 'copyright-bump' into 'develop'"
This reverts merge request !3825
2023-01-02 20:38:50 +00:00
marcin mikołajczak 10886eeaa2 Bump copyright year
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-01-01 12:13:06 +01:00
Sean King 17aa3644be
Copyright bump for 2022 2022-02-25 23:11:42 -07:00
Alex Gleason ec65b7ae29 Pleroma.Web.Params --> Pleroma.Web.Utils.Params 2021-06-08 12:50:47 -05:00
Alex Gleason 0877b120c3 Pleroma.Web.ControllerHelper.truthy_param?/1 --> Pleroma.Web.Params.truthy_param?/1
Breaks cycle in lib/pleroma/web/api_spec/operations/status_operation.ex
2021-06-08 12:50:47 -05:00
Haelwenn (lanodan) Monnier c4439c630f
Bump Copyright to 2021
grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>;'
2021-01-13 07:49:50 +01:00
lain 7a1cb752dd Pagination: Don't be dos'd by random parameters. 2021-01-12 12:59:50 +01:00
lain e1a547d7d3 ChatMessages: Fix pagination headers.
They used to contain the path parameter `id` as query param,
which would break the link.
2021-01-11 15:30:40 +01:00
Maksim Pechnikov 9853c90abb added paginate links to headers for /chats/:id/messages 2020-09-10 12:39:29 +03:00
Alex Gleason 673e8e3ac1
Force 204 responses to be empty, fixes #2029 2020-08-07 13:02:39 -05:00
lain 1d625c29a0 ControllerHelper: Always return id field. 2020-06-13 13:12:43 +02:00
lain 4b865bba10 Apply suggestion to lib/pleroma/web/controller_helper.ex 2020-06-13 10:37:15 +00:00
lain 5e44e9d698 Apply suggestion to lib/pleroma/web/controller_helper.ex 2020-06-10 18:56:46 +00:00
lain 86fec45f40 ControllerHelper: Fix wrong comparison. 2020-06-10 11:09:45 +02:00
lain b4c50be9df Apply suggestion to lib/pleroma/web/controller_helper.ex 2020-06-10 08:12:29 +00:00
lain be7c322865 Apply suggestion to lib/pleroma/web/controller_helper.ex 2020-06-10 08:02:35 +00:00
lain c4f267b3be Apply suggestion to lib/pleroma/web/controller_helper.ex 2020-06-10 08:02:26 +00:00
lain 063e6b9841 StatusController: Correctly paginate favorites.
Favorites were paginating wrongly, because the pagination headers
where using the id of the id of the `Create` activity, while the
ordering was by the id of the `Like` activity. This isn't easy to
notice in most cases, as they usually have a similar order because
people tend to favorite posts as they come in. This commit adds a
way to give different pagination ids to the pagination helper, so
we can paginate correctly in cases like this.
2020-06-09 10:53:40 +02:00
Egor Kislitsyn b02df1803e
Merge remote-tracking branch 'origin/develop' into activity-pub-use-atoms-as-keys 2020-06-05 23:15:10 +04:00
Haelwenn d74985af23 Merge branch 'features/apc2s-pagination' into 'develop'
Fix AP C2S pagination

Closes #866 and #751

See merge request pleroma/pleroma!2491
2020-06-05 14:52:09 +00:00
Haelwenn 54bae06b4f Create Pleroma.Maps.put_if_present(map, key, value, value_fun // &{:ok, &1})
Unifies all the similar functions to one and simplify some blocks with it.
2020-06-05 14:48:02 +00:00
Egor Kislitsyn 317e2b8d61
Use atoms as keys in ActivityPub.fetch_* functions options 2020-06-04 21:36:26 +04:00
Haelwenn (lanodan) Monnier a43b435c0a
AP C2S: allow limit & order on outbox & read_inbox 2020-05-29 16:14:45 +02:00
Haelwenn (lanodan) Monnier b3b367b894
Bugfix: Reuse Controller.Helper pagination for APC2S 2020-05-29 16:14:45 +02:00
Ivan Tashkinov 8062d590dd [#2456] OpenAPI-related tweaks. Removed support for with_relationships param in GET /api/v1/accounts/search. 2020-05-13 18:56:45 +03:00
Ivan Tashkinov 59b6d5f2aa [#2456] Changed embed_relationships param to with_relationships. 2020-05-13 15:08:07 +03:00
Ivan Tashkinov 63a1a82f38 [#2456] Added support for embed_relationships param, nailed down endpoints which should support it. Fixed :source_mutes relationships subset fetching. 2020-05-12 19:14:35 +03:00
Ivan Tashkinov 14a49a0483 [#2456] Dropped support for embedded pleroma/account/relationship in statuses and notifications. 2020-05-09 18:05:44 +03:00
Ivan Tashkinov d5cdc907e3 Restricted embedding of relationships where applicable (statuses / notifications / accounts rendering).
Added support for :skip_notifications for accounts listing (index.json).
Adjusted tests.
2020-05-01 18:45:24 +03:00
Egor Kislitsyn 2efc00b3cf
Use json_response_and_validate_schema/2 in tests to validate OpenAPI schema 2020-04-27 20:46:52 +04:00
Ivan Tashkinov 2f2bd7fe72 Ability to control the output of account/pleroma/relationship in statuses in order to improve the rendering performance.
See `[:extensions, output_relationships_in_statuses_by_default]` setting and `with_relationships` param.
2020-04-01 19:49:09 +03:00
lain 3bd2829e5c Benchmarks: Add timeline benchmark 2020-03-23 18:56:01 +01:00
Alexander Strizhakov 26e2076659
fix for feed page pagination 2020-03-16 12:33:55 +03:00
Haelwenn (lanodan) Monnier 6da6540036
Bump copyright years of files changed after 2020-01-07
Done via the following command:
git diff fcd5dd259a --stat --name-only | xargs sed -i '/Pleroma Authors/c# Copyright © 2017-2020 Pleroma Authors <https:\/\/pleroma.social\/>'
2020-03-02 06:08:45 +01:00
Maksim Pechnikov b53573a837 add tag feeds 2019-12-18 09:19:37 +03:00
Egor Kislitsyn 36a34c36fe
Extract poll actions from MastodonAPIController to PollController 2019-10-01 11:44:34 +07:00
Egor Kislitsyn 3c5ecb70b4
Add PleromaAPI.AccountController 2019-09-30 19:10:55 +07:00
Egor Kislitsyn 3572cf29b7 Extract timeline actions from MastodonAPIController into TimelineController 2019-09-26 10:53:42 +07:00
Egor Kislitsyn 40b3289c26 Refactor add_link_headers/7 -> add_link_headers/3 2019-09-06 17:08:47 +07:00
lain eee98aaa73 Pleroma API: Add endpoint to get conversation statuses. 2019-08-02 19:53:08 +02:00
Maksim ee4ed87fb4 [#948] /api/v1/account_search added optional parameters (limit, offset, following) 2019-06-14 11:39:57 +00:00
Maksim 799e1f48b5 Refactoring functions for dealing with oauth scopes. 2019-05-08 10:52:13 +00:00
Ivan Tashkinov 6910fb371b Fixed local MastoFE authentication / force_login option. 2019-04-01 17:25:25 +03:00
Ivan Tashkinov cbe09d94d1 Added force_login authentication option (previously applied by default). 2019-04-01 14:46:50 +03:00
Haelwenn (lanodan) Monnier c42d34b2ec
[Credo] fix Credo.Check.Readability.MaxLineLength 2019-03-13 04:26:56 +01:00
Ivan Tashkinov dcf24a3233 [#468] Refactored OAuth scopes' defaults & missing selection handling. 2019-02-17 13:49:14 +03:00