diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-06-23 07:02:49 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-06-27 13:15:55 +0000 |
commit | 2f14996d9afedbc4dbd75a518cf191636f926f74 (patch) | |
tree | 454ec62a2a387b620462b585f8c955cc62d61b7e | |
parent | dcdf7b6686fe3732ac8f9a93570dfa8a1412783a (diff) | |
download | pleroma-2f14996d9afedbc4dbd75a518cf191636f926f74.tar.gz |
twitter api: allow setting default_scope
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api_controller.ex | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index 8f5b3c786..65e67396b 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -431,6 +431,19 @@ defmodule Pleroma.Web.TwitterAPI.Controller do user end + user = + if default_scope = params["default_scope"] do + with new_info <- Map.put(user.info, "default_scope", default_scope), + change <- User.info_changeset(user, %{info: new_info}), + {:ok, user} <- User.update_and_set_cache(change) do + user + else + _e -> user + end + else + user + end + with changeset <- User.update_changeset(user, params), {:ok, user} <- User.update_and_set_cache(changeset) do CommonAPI.update(user) |