From b74f4260ae8367b33d133298a96fed9d1080ef5c Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:14:35 +0300 Subject: Fix rendering conversations when there's a malformed status --- CHANGELOG.md | 4 ++++ .../web/mastodon_api/controllers/mastodon_api_controller.ex | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86c0553d5..9e2010839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [1.1.6] - 2019-11-19 +## Fixed +- Mastodon API: conversations API crashing when one status is malformed + ## [1.1.5] - 2019-11-09 ### Fixed - Polls having different numbers in timelines/notifications/poll api endpoints due to cache desyncronization diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index 863d673ea..a5de1fecd 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -1671,9 +1671,10 @@ def conversations(%{assigns: %{user: user}} = conn, params) do participations = Participation.for_user_with_last_activity_id(user, params) conversations = - Enum.map(participations, fn participation -> - ConversationView.render("participation.json", %{participation: participation, for: user}) - end) + ConversationView.safe_render_many(participations, ConversationView, "participation.json", %{ + as: :participation, + for: user + }) conn |> add_link_headers(:conversations, participations) -- cgit v1.2.3 From df22197755ab026e1b413af09707ec138b593fad Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 5 Nov 2019 23:52:47 +0900 Subject: Check client and token in GET /oauth/authorize --- lib/pleroma/web/oauth/oauth_controller.ex | 18 +++++++++++++++++- test/web/oauth/oauth_controller_test.exs | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex index 81eae2c8b..63a6cc286 100644 --- a/lib/pleroma/web/oauth/oauth_controller.ex +++ b/lib/pleroma/web/oauth/oauth_controller.ex @@ -35,7 +35,7 @@ def authorize(%Plug.Conn{} = conn, %{"authorization" => _} = params) do authorize(conn, Map.merge(params, auth_attrs)) end - def authorize(%Plug.Conn{assigns: %{token: %Token{}}} = conn, params) do + def authorize(%Plug.Conn{assigns: %{token: %Token{}}} = conn, %{"force_login" => _} = params) do if ControllerHelper.truthy_param?(params["force_login"]) do do_authorize(conn, params) else @@ -43,6 +43,22 @@ def authorize(%Plug.Conn{assigns: %{token: %Token{}}} = conn, params) do end end + # Note: the token is set in oauth_plug, but the token and client do not always go together. + # For example, MastodonFE's token is set if user requests with another client, + # after user already authorized to MastodonFE. + # So we have to check client and token. + def authorize( + %Plug.Conn{assigns: %{token: %Token{} = token}} = conn, + %{"client_id" => client_id} = params + ) do + with %Token{} = t <- Repo.get_by(Token, token: token.token) |> Repo.preload(:app), + ^client_id <- t.app.client_id do + handle_existing_authorization(conn, params) + else + _ -> do_authorize(conn, params) + end + end + def authorize(%Plug.Conn{} = conn, params), do: do_authorize(conn, params) defp do_authorize(%Plug.Conn{} = conn, params) do diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index b492c7794..f24647a37 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -468,6 +468,29 @@ test "renders authentication page if user is already authenticated but `force_lo assert html_response(conn, 200) =~ ~s(type="submit") end + test "renders authentication page if user is already authenticated but user request with another client", + %{ + app: app, + conn: conn + } do + token = insert(:oauth_token, app_id: app.id) + + conn = + conn + |> put_session(:oauth_token, token.token) + |> get( + "/oauth/authorize", + %{ + "response_type" => "code", + "client_id" => "another_client_id", + "redirect_uri" => OAuthController.default_redirect_uri(app), + "scope" => "read" + } + ) + + assert html_response(conn, 200) =~ ~s(type="submit") + end + test "with existing authentication and non-OOB `redirect_uri`, redirects to app with `token` and `state` params", %{ app: app, -- cgit v1.2.3 From 3527a03e58eba62fe36366c7b8dd5785c682d264 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:19:12 +0300 Subject: Add a changelog entry for oauth authorize fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e2010839..1427bc347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.1.6] - 2019-11-19 ## Fixed +- Not being able to log into to third party apps when the browser is logged into mastofe - Mastodon API: conversations API crashing when one status is malformed ## [1.1.5] - 2019-11-09 -- cgit v1.2.3 From ff4af8c5ee9e332dfb0491068190143e07186481 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:22:20 +0300 Subject: User: Don't let deactivated users authenticate. --- lib/pleroma/user.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index f0912fb10..f5d3245dc 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -70,6 +70,8 @@ defmodule Pleroma.User do def auth_active?(%User{info: %User.Info{confirmation_pending: true}}), do: !Pleroma.Config.get([:instance, :account_activation_required]) + def auth_active?(%User{info: %User.Info{deactivated: true}}), do: false + def auth_active?(%User{}), do: true def visible_for?(user, for_user \\ nil) -- cgit v1.2.3 From 5b5f855237192499a51652bc91fc02c17ab95c85 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 11 Nov 2019 12:43:46 +0100 Subject: UserEnabledPlug: Don't authenticate unconfirmed users. --- lib/pleroma/plugs/user_enabled_plug.ex | 10 +++++++--- test/plugs/user_enabled_plug_test.exs | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/plugs/user_enabled_plug.ex b/lib/pleroma/plugs/user_enabled_plug.ex index da892c28b..8d102ee5b 100644 --- a/lib/pleroma/plugs/user_enabled_plug.ex +++ b/lib/pleroma/plugs/user_enabled_plug.ex @@ -10,9 +10,13 @@ def init(options) do options end - def call(%{assigns: %{user: %User{info: %{deactivated: true}}}} = conn, _) do - conn - |> assign(:user, nil) + def call(%{assigns: %{user: %User{} = user}} = conn, _) do + if User.auth_active?(user) do + conn + else + conn + |> assign(:user, nil) + end end def call(conn, _) do diff --git a/test/plugs/user_enabled_plug_test.exs b/test/plugs/user_enabled_plug_test.exs index c0fafcab1..3fb7c5316 100644 --- a/test/plugs/user_enabled_plug_test.exs +++ b/test/plugs/user_enabled_plug_test.exs @@ -16,6 +16,23 @@ test "doesn't do anything if the user isn't set", %{conn: conn} do assert ret_conn == conn end + test "with a user that's not confirmed and a config requiring confirmation, it removes that user", + %{conn: conn} do + old = Pleroma.Config.get([:instance, :account_activation_required]) + Pleroma.Config.put([:instance, :account_activation_required], true) + + user = insert(:user, confirmation_pending: true) + + conn = + conn + |> assign(:user, user) + |> UserEnabledPlug.call(%{}) + + assert conn.assigns.user == nil + + Pleroma.Config.put([:instance, :account_activation_required], old) + end + test "with a user that is deactivated, it removes that user", %{conn: conn} do user = insert(:user, info: %{deactivated: true}) -- cgit v1.2.3 From 4079ed3b75e98f8639dc65186914f913982c5c0d Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 15 Nov 2019 14:13:21 +0100 Subject: OAuthPlug, Router: Handle deactivated users in the UserEnabledPlug --- lib/pleroma/plugs/oauth_plug.ex | 2 +- lib/pleroma/web/router.ex | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/plugs/oauth_plug.ex b/lib/pleroma/plugs/oauth_plug.ex index 86bc4aa3a..11a5b7642 100644 --- a/lib/pleroma/plugs/oauth_plug.ex +++ b/lib/pleroma/plugs/oauth_plug.ex @@ -71,7 +71,7 @@ defp fetch_user_and_token(token) do ) # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength - with %Token{user: %{info: %{deactivated: false} = _} = user} = token_record <- Repo.one(query) do + with %Token{user: user} = token_record <- Repo.one(query) do {:ok, user, token_record} end end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index db660f0dc..979dea0aa 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -13,6 +13,7 @@ defmodule Pleroma.Web.Router do pipeline :oauth do plug(:fetch_session) plug(Pleroma.Plugs.OAuthPlug) + plug(Pleroma.Plugs.UserEnabledPlug) end pipeline :api do -- cgit v1.2.3 From 957fb059dfdafcfa3a6bf59c6ec16b038fc0ab2f Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:24:45 +0300 Subject: Add a changelog entry for email confirmation fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1427bc347..f5fa19fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.1.6] - 2019-11-19 ## Fixed - Not being able to log into to third party apps when the browser is logged into mastofe +- Email confirmation not being required even when enabled - Mastodon API: conversations API crashing when one status is malformed ## [1.1.5] - 2019-11-09 -- cgit v1.2.3 From 5386d1f49f2faae0922e6f0d9b4b66cf11bdc946 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:34:44 +0300 Subject: UserEnabledPlug: fix test after backporting We didn't get rid of user info on stable yet --- test/plugs/user_enabled_plug_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugs/user_enabled_plug_test.exs b/test/plugs/user_enabled_plug_test.exs index 3fb7c5316..e85b37ffe 100644 --- a/test/plugs/user_enabled_plug_test.exs +++ b/test/plugs/user_enabled_plug_test.exs @@ -21,7 +21,7 @@ test "with a user that's not confirmed and a config requiring confirmation, it r old = Pleroma.Config.get([:instance, :account_activation_required]) Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, confirmation_pending: true) + user = insert(:user, info: %{confirmation_pending: true}) conn = conn -- cgit v1.2.3 From b24b848057219626209427e77468a0ac3782e033 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:36:23 +0300 Subject: mix.exs: bump version to 1.1.6 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 53b3a961d..0937e42b8 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do def project do [ app: :pleroma, - version: version("1.1.5"), + version: version("1.1.6"), elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), -- cgit v1.2.3 From c2e9c1c8a58e873c979f2fd160bddf003e852e49 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:45:20 +0300 Subject: bundles: bump pleroma-fe to 0eda60eeb49f4fa460fe6f9f6196ddbb014427c7 --- CHANGELOG.md | 10 ++++++++++ priv/static/index.html | 2 +- priv/static/static/js/2.73375b727cef616c59b4.js | Bin 2410 -> 0 bytes priv/static/static/js/2.73375b727cef616c59b4.js.map | Bin 8593 -> 0 bytes priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js | Bin 0 -> 2410 bytes priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js.map | Bin 0 -> 8593 bytes priv/static/static/js/app.105d64a8fcdd6724ccde.js | Bin 997153 -> 0 bytes .../static/js/app.105d64a8fcdd6724ccde.js.map | Bin 1540349 -> 0 bytes priv/static/static/js/app.d20ca27d22d74eb7bce0.js | Bin 0 -> 1007198 bytes .../static/js/app.d20ca27d22d74eb7bce0.js.map | Bin 0 -> 1568281 bytes .../static/js/vendors~app.5c3fab032deb5f2793cb.js | Bin 468536 -> 0 bytes .../js/vendors~app.5c3fab032deb5f2793cb.js.map | Bin 2170622 -> 0 bytes .../static/js/vendors~app.76db8e4cdf29decd5cab.js | Bin 0 -> 468566 bytes .../js/vendors~app.76db8e4cdf29decd5cab.js.map | Bin 0 -> 2170066 bytes priv/static/sw-pleroma.js | Bin 31107 -> 31107 bytes 15 files changed, 11 insertions(+), 1 deletion(-) delete mode 100644 priv/static/static/js/2.73375b727cef616c59b4.js delete mode 100644 priv/static/static/js/2.73375b727cef616c59b4.js.map create mode 100644 priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js create mode 100644 priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js.map delete mode 100644 priv/static/static/js/app.105d64a8fcdd6724ccde.js delete mode 100644 priv/static/static/js/app.105d64a8fcdd6724ccde.js.map create mode 100644 priv/static/static/js/app.d20ca27d22d74eb7bce0.js create mode 100644 priv/static/static/js/app.d20ca27d22d74eb7bce0.js.map delete mode 100644 priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js delete mode 100644 priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js.map create mode 100644 priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js create mode 100644 priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js.map diff --git a/CHANGELOG.md b/CHANGELOG.md index f5fa19fc9..fab4801b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Email confirmation not being required even when enabled - Mastodon API: conversations API crashing when one status is malformed +## Bundled Pleroma-FE Changes +### Added +- About page +- Meme arrows + +### Fixed +- Image modal not closing unless clicked outside of image +- Attachment upload spinner not being centered +- Showing follow counters being 0 when they are actually hidden + ## [1.1.5] - 2019-11-09 ### Fixed - Polls having different numbers in timelines/notifications/poll api endpoints due to cache desyncronization diff --git a/priv/static/index.html b/priv/static/index.html index f1a26cc95..2a6c7b036 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -1 +1 @@ -Pleroma
\ No newline at end of file +Pleroma
\ No newline at end of file diff --git a/priv/static/static/js/2.73375b727cef616c59b4.js b/priv/static/static/js/2.73375b727cef616c59b4.js deleted file mode 100644 index ebfd9acbd..000000000 Binary files a/priv/static/static/js/2.73375b727cef616c59b4.js and /dev/null differ diff --git a/priv/static/static/js/2.73375b727cef616c59b4.js.map b/priv/static/static/js/2.73375b727cef616c59b4.js.map deleted file mode 100644 index d2c864eb3..000000000 Binary files a/priv/static/static/js/2.73375b727cef616c59b4.js.map and /dev/null differ diff --git a/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js b/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js new file mode 100644 index 000000000..910d304d3 Binary files /dev/null and b/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js differ diff --git a/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js.map b/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js.map new file mode 100644 index 000000000..25e514a5b Binary files /dev/null and b/priv/static/static/js/2.c96b30ae9f2d3f46f0ad.js.map differ diff --git a/priv/static/static/js/app.105d64a8fcdd6724ccde.js b/priv/static/static/js/app.105d64a8fcdd6724ccde.js deleted file mode 100644 index 9cb129d22..000000000 Binary files a/priv/static/static/js/app.105d64a8fcdd6724ccde.js and /dev/null differ diff --git a/priv/static/static/js/app.105d64a8fcdd6724ccde.js.map b/priv/static/static/js/app.105d64a8fcdd6724ccde.js.map deleted file mode 100644 index ab2588f48..000000000 Binary files a/priv/static/static/js/app.105d64a8fcdd6724ccde.js.map and /dev/null differ diff --git a/priv/static/static/js/app.d20ca27d22d74eb7bce0.js b/priv/static/static/js/app.d20ca27d22d74eb7bce0.js new file mode 100644 index 000000000..7abf2ec28 Binary files /dev/null and b/priv/static/static/js/app.d20ca27d22d74eb7bce0.js differ diff --git a/priv/static/static/js/app.d20ca27d22d74eb7bce0.js.map b/priv/static/static/js/app.d20ca27d22d74eb7bce0.js.map new file mode 100644 index 000000000..6c96ca5b2 Binary files /dev/null and b/priv/static/static/js/app.d20ca27d22d74eb7bce0.js.map differ diff --git a/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js b/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js deleted file mode 100644 index db0f6a9a3..000000000 Binary files a/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js and /dev/null differ diff --git a/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js.map b/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js.map deleted file mode 100644 index 5e7b10459..000000000 Binary files a/priv/static/static/js/vendors~app.5c3fab032deb5f2793cb.js.map and /dev/null differ diff --git a/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js b/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js new file mode 100644 index 000000000..135bdebb3 Binary files /dev/null and b/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js differ diff --git a/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js.map b/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js.map new file mode 100644 index 000000000..6513c0a0b Binary files /dev/null and b/priv/static/static/js/vendors~app.76db8e4cdf29decd5cab.js.map differ diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js index ec6185afc..276af8173 100644 Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ -- cgit v1.2.3 From 34206e4d7f2f5abe896882874e142374d987c44f Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Nov 2019 19:47:03 +0300 Subject: changelog: fix wrong header levels --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fab4801b4..eac7d7366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,17 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.1.6] - 2019-11-19 -## Fixed +### Fixed - Not being able to log into to third party apps when the browser is logged into mastofe - Email confirmation not being required even when enabled - Mastodon API: conversations API crashing when one status is malformed -## Bundled Pleroma-FE Changes -### Added +### Bundled Pleroma-FE Changes +#### Added - About page - Meme arrows -### Fixed +#### Fixed - Image modal not closing unless clicked outside of image - Attachment upload spinner not being centered - Showing follow counters being 0 when they are actually hidden -- cgit v1.2.3