Commit Graph

53 Commits

Author SHA1 Message Date
Mark Felder 4d20fbc6d9 Pleroma.Web.PleromaAPI.ChatController: fix dialyzer errors with replace_params: false 2024-01-31 10:12:59 -05:00
Mark Felder b709fc4dfe Revert "Pleroma.Web.PleromaAPI.ChatController: Dialyzer error"
This reverts commit 8d64eedbec.
2024-01-30 14:15:05 -05:00
Mark Felder 8d64eedbec Pleroma.Web.PleromaAPI.ChatController: Dialyzer error
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:128:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:last_read_id => _, _ => _},
    _ => _
  },
  <<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
  [
    {:chat,
     %Pleroma.Chat{
       :__meta__ => _,
       :id => _,
       :inserted_at => _,
       :recipient => _,
       :updated_at => _,
       :user => _,
       :user_id => _
     }},
    ...
  ]
)

will never return since the success typing is:
(
  %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() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :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 => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %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() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :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 => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
2024-01-28 15:52:09 -05:00
Mark Felder 456f7cab3e Pleroma.Web.PleromaAPI.ChatController: Dialyzer errors
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:91:pattern_match
The pattern can never match the type.

Pattern:
{:reject, _message}

Type:
nil

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:96:pattern_match
The pattern can never match the type.

Pattern:
{:error, _message}

Type:
nil
2024-01-28 15:52:09 -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
marcin mikołajczak dff435488d Add link headers in ChatController.index2
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2021-12-12 17:43:18 +01:00
Egor Kislitsyn 92ab72dbbb
Update OpenApiSpex dependency 2021-03-05 15:51:29 +04:00
rinpatch d7ad288c84 Chats: Introduce /api/v2/pleroma/chats which implements pagination
Also removes incorrect claim that /api/v1/pleroma/chats supports
pagination and deprecates it.

Closes #2140
2021-02-17 16:03:24 +03: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 e1e7e4d379 Object: Rework how Object.normalize works
Now it defaults to not fetching, and the option is named.
2021-01-04 13:38:31 +01:00
Egor Kislitsyn fb41bd1a85 Hide reactions from muted and blocked users 2020-11-16 22:50:14 +04:00
Egor Kislitsyn ca95cbe0b4
Add `with_muted` param to ChatController.index/2 2020-11-04 16:40:12 +04:00
Egor Kislitsyn be52819a11
Hide chats from muted users 2020-11-02 17:51:54 +04:00
eugenijm 8e41baff40 Add idempotency_key to the chat_message entity. 2020-10-31 05:50:59 +03:00
Alexander Strizhakov 9f4fe5485b
alias alphabetically order 2020-10-13 16:43:59 +03:00
Alexander Strizhakov a6d8cef33e
OAuthScopesPlug module name 2020-10-13 16:43:54 +03:00
lain c95859e45b Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into issue/2115 2020-09-22 17:13:46 +02:00
Haelwenn (lanodan) Monnier 7bf269fe83 Fix MRF reject for ChatMessage 2020-09-17 22:07:54 +03:00
Alex Gleason c41430b23e
Refactor with Chat.for_user_query/1 2020-09-11 14:10:13 -05:00
Maksim Pechnikov 9853c90abb added paginate links to headers for /chats/:id/messages 2020-09-10 12:39:29 +03:00
lain 0b621a834a Chats: Add cascading delete on both referenced users.
Also remove the now-superfluous join in the chat controller,
which was only used to filter out these cases.
2020-08-31 16:48:17 +02:00
lain 78939c1d16 ChatController: Don't die if the recipient is gone. 2020-08-27 12:13:18 +02:00
Ivan Tashkinov 6f5f7af607 [#1973] Fixed accounts rendering in GET /api/v1/pleroma/chats with truish :restrict_unauthenticated.
Made `Pleroma.Web.MastodonAPI.AccountView.render("show.json", _)` demand :for or :force option in order to prevent incorrect rendering of empty map instead of expected user representation with truish :restrict_unauthenticated setting.
2020-07-22 19:06:00 +03:00
lain 3b5282bef2 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms 2020-06-08 11:19:18 +02:00
lain 89b85f6529 ChatController: Remove nonsensical pagination. 2020-06-08 11:09:53 +02:00
lain fe2a5d0614 ChatController: Make last_read_id mandatory. 2020-06-07 20:22:08 +02:00
lain 801e668a97 ChatController: Add `last_read_id` option to mark_as_read. 2020-06-07 15:38:33 +02:00
lain f4cf4ae16e ChatController: Use new oauth scope *:chats. 2020-06-06 16:48:02 +02:00
lain ca0e6e702b ChatMessageReference -> Chat.MessageReference 2020-06-06 11:51:10 +02:00
lain b3407344d3 ChatController: Add function to mark single message as read. 2020-06-03 19:21:23 +02:00
lain 7f5c5b11a5 Chats: Remove `unread` from the db, calculate from unseen messages. 2020-06-03 14:26:50 +02:00
lain 73127cff75 Credo fixes. 2020-06-03 13:17:29 +02:00
lain aa22fce8f4 ChatMessageReference: Introduce and switch in chat controller. 2020-06-03 12:30:12 +02:00
lain 0f0acc740d Chat: Allow posting without content if an attachment is present. 2020-05-13 15:31:28 +02:00
lain c0ea5c60e4 ChatController: Don't return chats for user you've blocked. 2020-05-12 16:43:04 +02:00
lain ec72cba43e Chat Controller: Add basic error handling. 2020-05-12 13:23:09 +02:00
lain b5aa204eb8 ChatController: Support deletion of chat messages. 2020-05-12 13:13:03 +02:00
lain 8d5597ff68 ChatController: Add GET /chats/:id 2020-05-10 13:26:14 +02:00
lain f335e1404a ChatView: Add the last message to the view. 2020-05-10 13:00:01 +02:00
lain 20baa2eaf0 ChatMessages: Add attachments. 2020-05-06 16:12:36 +02:00
lain b04328c3de ChatController: Add mark_as_read 2020-05-04 13:10:36 +02:00
lain 145d35ff70 Apply suggestion to lib/pleroma/web/pleroma_api/controllers/chat_controller.ex 2020-04-29 19:49:03 +00:00
lain ad82a216ff Chat API: Align more to Pleroma/Mastodon API. 2020-04-27 17:48:34 +02:00
lain 66c2eb670b ChatController: Validate parameters. 2020-04-21 18:23:00 +02:00
lain 970b74383b Credo fixes. 2020-04-20 12:29:19 +02:00
lain d45ae64858 ChatController: Use OAuth scopes. 2020-04-17 13:04:46 +02:00
lain f8c3ae7a62 ChatController: Handle pagination. 2020-04-16 18:43:31 +02:00
lain 6ace22b56a Chat: Add views, don't return them in timeline queries. 2020-04-15 18:23:16 +02:00