aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoman Chvanikov <roman@Romans-MacBook-Pro-2.local>2019-06-05 02:45:21 +0300
committerRoman Chvanikov <roman@Romans-MacBook-Pro-2.local>2019-06-05 02:45:21 +0300
commitb1b1a270e8f17b76d08771ca1e4025b1d227da05 (patch)
tree41a5896012a3f55f3de31f7ec97dc397ba02cd62 /lib
parentf6036ce3b9649902ce1c2af819616ad25f0caef1 (diff)
parent5188add534a1532ef323a0fec3503f8e96dfe762 (diff)
downloadpleroma-b1b1a270e8f17b76d08771ca1e4025b1d227da05.tar.gz
Fix conflict
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/conversation/participation.ex1
-rw-r--r--lib/pleroma/emoji.ex14
-rw-r--r--lib/pleroma/user/info.ex7
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex49
-rw-r--r--lib/pleroma/web/activity_pub/mrf.ex6
-rw-r--r--lib/pleroma/web/activity_pub/mrf/subchain_policy.ex40
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex3
-rw-r--r--lib/pleroma/web/common_api/common_api.ex17
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex22
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex13
-rw-r--r--lib/pleroma/web/nodeinfo/nodeinfo_controller.ex2
-rw-r--r--lib/pleroma/web/streamer.ex25
-rw-r--r--lib/pleroma/web/templates/layout/app.html.eex44
-rw-r--r--lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex16
-rw-r--r--lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex4
-rw-r--r--lib/pleroma/web/templates/o_auth/o_auth/show.html.eex34
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api_controller.ex10
-rw-r--r--lib/pleroma/web/twitter_api/views/user_view.ex3
18 files changed, 240 insertions, 70 deletions
diff --git a/lib/pleroma/conversation/participation.ex b/lib/pleroma/conversation/participation.ex
index 2a11f9069..2c13c4b40 100644
--- a/lib/pleroma/conversation/participation.ex
+++ b/lib/pleroma/conversation/participation.ex
@@ -79,5 +79,6 @@ defmodule Pleroma.Conversation.Participation do
| last_activity_id: activity_id
}
end)
+ |> Enum.filter(& &1.last_activity_id)
end
end
diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex
index 7d12eff7f..de7fcc1ce 100644
--- a/lib/pleroma/emoji.ex
+++ b/lib/pleroma/emoji.ex
@@ -97,10 +97,22 @@ defmodule Pleroma.Emoji do
# There was some other error
Logger.error("Could not access the custom emoji directory #{emoji_dir_path}: #{e}")
- {:ok, packs} ->
+ {:ok, results} ->
+ grouped = Enum.group_by(results, &File.dir?/1)
+ packs = grouped[true] || []
+ files = grouped[false] || []
+
# Print the packs we've found
Logger.info("Found emoji packs: #{Enum.join(packs, ", ")}")
+ if not Enum.empty?(files) do
+ Logger.warn(
+ "Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{
+ Enum.join(files, ", ")
+ }"
+ )
+ end
+
emojis =
Enum.flat_map(
packs,
diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex
index 36bae61a4..afdbe6033 100644
--- a/lib/pleroma/user/info.ex
+++ b/lib/pleroma/user/info.ex
@@ -46,6 +46,7 @@ defmodule Pleroma.User.Info do
field(:email_notifications, :map, default: %{"digest" => false})
field(:mascot, :map, default: nil)
field(:emoji, {:array, :map}, default: [])
+ field(:pleroma_settings_store, :map, default: %{})
field(:notification_settings, :map,
default: %{
@@ -56,6 +57,8 @@ defmodule Pleroma.User.Info do
}
)
+ field(:skip_thread_containment, :boolean, default: false)
+
# Found in the wild
# ap_id -> Where is this used?
# bio -> Where is this used?
@@ -244,7 +247,9 @@ defmodule Pleroma.User.Info do
:hide_followers,
:hide_favorites,
:background,
- :show_role
+ :show_role,
+ :skip_thread_containment,
+ :pleroma_settings_store
])
end
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 45feae25a..c0e3d1478 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -4,6 +4,7 @@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
alias Pleroma.Activity
+ alias Pleroma.Config
alias Pleroma.Conversation
alias Pleroma.Notification
alias Pleroma.Object
@@ -73,7 +74,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
defp check_remote_limit(%{"object" => %{"content" => content}}) when not is_nil(content) do
- limit = Pleroma.Config.get([:instance, :remote_limit])
+ limit = Config.get([:instance, :remote_limit])
String.length(content) <= limit
end
@@ -411,8 +412,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
def block(blocker, blocked, activity_id \\ nil, local \\ true) do
- outgoing_blocks = Pleroma.Config.get([:activitypub, :outgoing_blocks])
- unfollow_blocked = Pleroma.Config.get([:activitypub, :unfollow_blocked])
+ outgoing_blocks = Config.get([:activitypub, :outgoing_blocks])
+ unfollow_blocked = Config.get([:activitypub, :unfollow_blocked])
if unfollow_blocked do
follow_activity = fetch_latest_follow(blocker, blocked)
@@ -557,14 +558,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp restrict_visibility(query, %{visibility: visibility})
when visibility in @valid_visibilities do
- query =
- from(
- a in query,
- where:
- fragment("activity_visibility(?, ?, ?) = ?", a.actor, a.recipients, a.data, ^visibility)
- )
-
- query
+ from(
+ a in query,
+ where:
+ fragment("activity_visibility(?, ?, ?) = ?", a.actor, a.recipients, a.data, ^visibility)
+ )
end
defp restrict_visibility(_query, %{visibility: visibility})
@@ -574,17 +572,24 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp restrict_visibility(query, _visibility), do: query
- defp restrict_thread_visibility(query, %{"user" => %User{ap_id: ap_id}}) do
- query =
- from(
- a in query,
- where: fragment("thread_visibility(?, (?)->>'id') = true", ^ap_id, a.data)
- )
+ defp restrict_thread_visibility(query, _, %{skip_thread_containment: true} = _),
+ do: query
- query
+ defp restrict_thread_visibility(
+ query,
+ %{"user" => %User{info: %{skip_thread_containment: true}}},
+ _
+ ),
+ do: query
+
+ defp restrict_thread_visibility(query, %{"user" => %User{ap_id: ap_id}}, _) do
+ from(
+ a in query,
+ where: fragment("thread_visibility(?, (?)->>'id') = true", ^ap_id, a.data)
+ )
end
- defp restrict_thread_visibility(query, _), do: query
+ defp restrict_thread_visibility(query, _, _), do: query
def fetch_user_activities(user, reading_user, params \\ %{}) do
params =
@@ -863,6 +868,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
def fetch_activities_query(recipients, opts \\ %{}) do
base_query = from(activity in Activity)
+ config = %{
+ skip_thread_containment: Config.get([:instance, :skip_thread_containment])
+ }
+
base_query
|> maybe_preload_objects(opts)
|> maybe_preload_bookmarks(opts)
@@ -882,7 +891,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|> restrict_muted(opts)
|> restrict_media(opts)
|> restrict_visibility(opts)
- |> restrict_thread_visibility(opts)
+ |> restrict_thread_visibility(opts, config)
|> restrict_replies(opts)
|> restrict_reblogs(opts)
|> restrict_pinned(opts)
diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex
index 3bf7955f3..10ceef715 100644
--- a/lib/pleroma/web/activity_pub/mrf.ex
+++ b/lib/pleroma/web/activity_pub/mrf.ex
@@ -5,8 +5,8 @@
defmodule Pleroma.Web.ActivityPub.MRF do
@callback filter(Map.t()) :: {:ok | :reject, Map.t()}
- def filter(object) do
- get_policies()
+ def filter(policies, %{} = object) do
+ policies
|> Enum.reduce({:ok, object}, fn
policy, {:ok, object} ->
policy.filter(object)
@@ -16,6 +16,8 @@ defmodule Pleroma.Web.ActivityPub.MRF do
end)
end
+ def filter(%{} = object), do: get_policies() |> filter(object)
+
def get_policies do
Pleroma.Config.get([:instance, :rewrite_policy], []) |> get_policies()
end
diff --git a/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex
new file mode 100644
index 000000000..765704389
--- /dev/null
+++ b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex
@@ -0,0 +1,40 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicy do
+ alias Pleroma.Config
+ alias Pleroma.Web.ActivityPub.MRF
+
+ require Logger
+
+ @behaviour MRF
+
+ defp lookup_subchain(actor) do
+ with matches <- Config.get([:mrf_subchain, :match_actor]),
+ {match, subchain} <- Enum.find(matches, fn {k, _v} -> String.match?(actor, k) end) do
+ {:ok, match, subchain}
+ else
+ _e -> {:error, :notfound}
+ end
+ end
+
+ @impl true
+ def filter(%{"actor" => actor} = message) do
+ with {:ok, match, subchain} <- lookup_subchain(actor) do
+ Logger.debug(
+ "[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{
+ inspect(subchain)
+ }"
+ )
+
+ subchain
+ |> MRF.filter(message)
+ else
+ _e -> {:ok, message}
+ end
+ end
+
+ @impl true
+ def filter(message), do: {:ok, message}
+end
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index b292d7d8d..faae7e747 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -794,10 +794,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
query =
from(
[activity, object: object] in Activity.with_preloaded_object(Activity),
+ where: fragment("(?)->>'type' = 'Create'", activity.data),
where: fragment("(?)->>'actor' = ?", activity.data, ^actor),
where:
fragment(
- "(?)->'inReplyTo' = ?",
+ "(?)->>'inReplyTo' = ?",
object.data,
^to_string(id)
),
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 5212d5ce5..ad3c03c55 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -132,13 +132,16 @@ defmodule Pleroma.Web.CommonAPI do
Enum.map(choices, fn index ->
answer_data = make_answer_data(user, object, Enum.at(options, index)["name"])
- ActivityPub.create(%{
- to: answer_data["to"],
- actor: user,
- context: object.data["context"],
- object: answer_data,
- additional: %{"cc" => answer_data["cc"]}
- })
+ {:ok, activity} =
+ ActivityPub.create(%{
+ to: answer_data["to"],
+ actor: user,
+ context: object.data["context"],
+ object: answer_data,
+ additional: %{"cc" => answer_data["cc"]}
+ })
+
+ activity
end)
object = Object.get_cached_by_ap_id(object.data["id"])
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index dfd05271a..d825555c6 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -117,13 +117,24 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> Enum.dedup()
info_params =
- [:no_rich_text, :locked, :hide_followers, :hide_follows, :hide_favorites, :show_role]
+ [
+ :no_rich_text,
+ :locked,
+ :hide_followers,
+ :hide_follows,
+ :hide_favorites,
+ :show_role,
+ :skip_thread_containment
+ ]
|> Enum.reduce(%{}, fn key, acc ->
add_if_present(acc, params, to_string(key), key, fn value ->
{:ok, ControllerHelper.truthy_param?(value)}
end)
end)
|> add_if_present(params, "default_scope", :default_scope)
+ |> add_if_present(params, "pleroma_settings_store", :pleroma_settings_store, fn value ->
+ {:ok, Map.merge(user.info.pleroma_settings_store, value)}
+ end)
|> add_if_present(params, "header", :banner, fn value ->
with %Plug.Upload{} <- value,
{:ok, object} <- ActivityPub.upload(value, type: :banner) do
@@ -143,7 +154,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
CommonAPI.update(user)
end
- json(conn, AccountView.render("account.json", %{user: user, for: user}))
+ json(
+ conn,
+ AccountView.render("account.json", %{user: user, for: user, with_pleroma_settings: true})
+ )
else
_e ->
conn
@@ -153,7 +167,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def verify_credentials(%{assigns: %{user: user}} = conn, _) do
- account = AccountView.render("account.json", %{user: user, for: user})
+ account =
+ AccountView.render("account.json", %{user: user, for: user, with_pleroma_settings: true})
+
json(conn, account)
end
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index b82d3319b..b91726b45 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -124,12 +124,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
hide_followers: user.info.hide_followers,
hide_follows: user.info.hide_follows,
hide_favorites: user.info.hide_favorites,
- relationship: relationship
+ relationship: relationship,
+ skip_thread_containment: user.info.skip_thread_containment
}
}
|> maybe_put_role(user, opts[:for])
|> maybe_put_settings(user, opts[:for], user_info)
|> maybe_put_notification_settings(user, opts[:for])
+ |> maybe_put_settings_store(user, opts[:for], opts)
end
defp username_from_nickname(string) when is_binary(string) do
@@ -152,6 +154,15 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
defp maybe_put_settings(data, _, _, _), do: data
+ defp maybe_put_settings_store(data, %User{info: info, id: id}, %User{id: id}, %{
+ with_pleroma_settings: true
+ }) do
+ data
+ |> Kernel.put_in([:pleroma, :settings_store], info.pleroma_settings_store)
+ end
+
+ defp maybe_put_settings_store(data, _, _, _), do: data
+
defp maybe_put_role(data, %User{info: %{show_role: true}} = user, _) do
data
|> Kernel.put_in([:pleroma, :is_admin], user.info.is_admin)
diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
index 59f3d4e11..57f5b61bb 100644
--- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
+++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
@@ -97,6 +97,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
"pleroma_api",
"mastodon_api",
"mastodon_api_streaming",
+ "polls",
if Config.get([:media_proxy, :enabled]) do
"media_proxy"
end,
@@ -149,6 +150,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
},
staffAccounts: staff_accounts,
federation: federation_response,
+ pollLimits: Config.get([:instance, :poll_limits]),
postFormats: Config.get([:instance, :allowed_post_formats]),
uploadLimits: %{
general: Config.get([:instance, :upload_limit]),
diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex
index 133decfc4..a23f80f26 100644
--- a/lib/pleroma/web/streamer.ex
+++ b/lib/pleroma/web/streamer.ex
@@ -6,6 +6,7 @@ defmodule Pleroma.Web.Streamer do
use GenServer
require Logger
alias Pleroma.Activity
+ alias Pleroma.Config
alias Pleroma.Conversation.Participation
alias Pleroma.Notification
alias Pleroma.Object
@@ -224,11 +225,10 @@ defmodule Pleroma.Web.Streamer do
mutes = user.info.mutes || []
reblog_mutes = user.info.muted_reblogs || []
- parent = Object.normalize(item)
-
- unless is_nil(parent) or item.actor in blocks or item.actor in mutes or
- item.actor in reblog_mutes or not ActivityPub.contain_activity(item, user) or
- parent.data["actor"] in blocks or parent.data["actor"] in mutes do
+ with parent when not is_nil(parent) <- Object.normalize(item),
+ true <- Enum.all?([blocks, mutes, reblog_mutes], &(item.actor not in &1)),
+ true <- Enum.all?([blocks, mutes], &(parent.data["actor"] not in &1)),
+ true <- thread_containment(item, user) do
send(socket.transport_pid, {:text, represent_update(item, user)})
end
else
@@ -264,8 +264,8 @@ defmodule Pleroma.Web.Streamer do
blocks = user.info.blocks || []
mutes = user.info.mutes || []
- unless item.actor in blocks or item.actor in mutes or
- not ActivityPub.contain_activity(item, user) do
+ with true <- Enum.all?([blocks, mutes], &(item.actor not in &1)),
+ true <- thread_containment(item, user) do
send(socket.transport_pid, {:text, represent_update(item, user)})
end
else
@@ -279,4 +279,15 @@ defmodule Pleroma.Web.Streamer do
end
defp internal_topic(topic, _), do: topic
+
+ @spec thread_containment(Activity.t(), User.t()) :: boolean()
+ defp thread_containment(_activity, %User{info: %{skip_thread_containment: true}}), do: true
+
+ defp thread_containment(activity, user) do
+ if Config.get([:instance, :skip_thread_containment]) do
+ true
+ else
+ ActivityPub.contain_activity(activity, user)
+ end
+ end
end
diff --git a/lib/pleroma/web/templates/layout/app.html.eex b/lib/pleroma/web/templates/layout/app.html.eex
index 85ec4d76c..b3cf9ed11 100644
--- a/lib/pleroma/web/templates/layout/app.html.eex
+++ b/lib/pleroma/web/templates/layout/app.html.eex
@@ -63,13 +63,14 @@
.scopes-input {
display: flex;
+ flex-direction: column;
margin-top: 1em;
text-align: left;
color: #89898a;
}
.scopes-input label:first-child {
- flex-basis: 40%;
+ height: 2em;
}
.scopes {
@@ -80,13 +81,22 @@
}
.scope {
- flex-basis: 100%;
display: flex;
+ flex-basis: 100%;
height: 2em;
align-items: center;
}
+ .scope:before {
+ color: #b9b9ba;
+ content: "✔\fe0e";
+ margin-left: 1em;
+ margin-right: 1em;
+ }
+
[type="checkbox"] + label {
+ display: none;
+ cursor: pointer;
margin: 0.5em;
}
@@ -95,10 +105,12 @@
}
[type="checkbox"] + label:before {
+ cursor: pointer;
display: inline-block;
color: white;
background-color: #121a24;
border: 4px solid #121a24;
+ box-shadow: 0px 0px 1px 0 #d8a070;
box-sizing: border-box;
width: 1.2em;
height: 1.2em;
@@ -128,7 +140,8 @@
border-radius: 4px;
border: none;
padding: 10px;
- margin-top: 30px;
+ margin-top: 20px;
+ margin-bottom: 20px;
text-transform: uppercase;
font-size: 16px;
box-shadow: 0px 0px 2px 0px black,
@@ -147,8 +160,8 @@
box-sizing: border-box;
width: 100%;
background-color: #931014;
+ border: 1px solid #a06060;
border-radius: 4px;
- border: none;
padding: 10px;
margin-top: 20px;
font-weight: 500;
@@ -171,12 +184,27 @@
margin-top: 0
}
- .scopes-input {
- flex-direction: column;
+ .scope {
+ flex-basis: 0%;
}
- .scope {
- flex-basis: 50%;
+ .scope:before {
+ content: "";
+ margin-left: 0em;
+ margin-right: 1em;
+ }
+
+ .scope:first-child:before {
+ margin-left: 1em;
+ content: "✔\fe0e";
+ }
+
+ .scope:after {
+ content: ",";
+ }
+
+ .scope:last-child:after {
+ content: "";
}
}
.form-row {
diff --git a/lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex b/lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex
index e6cfe108b..c9ec1ecbf 100644
--- a/lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex
+++ b/lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex
@@ -1,13 +1,19 @@
<div class="scopes-input">
- <%= label @form, :scope, "Permissions" %>
-
+ <%= label @form, :scope, "The following permissions will be granted" %>
<div class="scopes">
<%= for scope <- @available_scopes do %>
<%# Note: using hidden input with `unchecked_value` in order to distinguish user's empty selection from `scope` param being omitted %>
- <div class="scope">
+ <%= if scope in @scopes do %>
+ <div class="scope">
+ <%= checkbox @form, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
+ <%= label @form, :"scope_#{scope}", String.capitalize(scope) %>
+ <%= if scope in @scopes && scope do %>
+ <%= String.capitalize(scope) %>
+ <% end %>
+ </div>
+ <% else %>
<%= checkbox @form, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
- <%= label @form, :"scope_#{scope}", String.capitalize(scope) %>
- </div>
+ <% end %>
<% end %>
</div>
</div>
diff --git a/lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex b/lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex
index 4bcda7300..4a0718851 100644
--- a/lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex
+++ b/lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex
@@ -1,7 +1,9 @@
<h2>Sign in with external provider</h2>
<%= form_for @conn, o_auth_path(@conn, :prepare_request), [as: "authorization", method: "get"], fn f -> %>
- <%= render @view_module, "_scopes.html", Map.put(assigns, :form, f) %>
+ <div style="display: none">
+ <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
+ </div>
<%= hidden_input f, :client_id, value: @client_id %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
diff --git a/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex b/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
index 3e360a52c..b17142ff8 100644
--- a/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
+++ b/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
@@ -6,26 +6,38 @@
<% end %>
<h2>OAuth Authorization</h2>
-
<%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %>
-<div class="input">
- <%= label f, :name, "Name or email" %>
- <%= text_input f, :name %>
-</div>
-<div class="input">
- <%= label f, :password, "Password" %>
- <%= password_input f, :password %>
-</div>
-<%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
+<%= if @params["registration"] in ["true", true] do %>
+ <h3>This is the first time you visit! Please enter your Pleroma handle.</h3>
+ <p>Choose carefully! You won't be able to change this later. You will be able to change your display name, though.</p>
+ <div class="input">
+ <%= label f, :nickname, "Pleroma Handle" %>
+ <%= text_input f, :nickname, placeholder: "lain" %>
+ </div>
+ <%= hidden_input f, :name, value: @params["name"] %>
+ <%= hidden_input f, :password, value: @params["password"] %>
+ <br>
+<% else %>
+ <div class="input">
+ <%= label f, :name, "Username" %>
+ <%= text_input f, :name %>
+ </div>
+ <div class="input">
+ <%= label f, :password, "Password" %>
+ <%= password_input f, :password %>
+ </div>
+ <%= submit "Log In" %>
+ <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
+<% end %>
<%= hidden_input f, :client_id, value: @client_id %>
<%= hidden_input f, :response_type, value: @response_type %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
<%= hidden_input f, :state, value: @state %>
-<%= submit "Authorize" %>
<% end %>
<%= if Pleroma.Config.oauth_consumer_enabled?() do %>
<%= render @view_module, Pleroma.Web.Auth.Authenticator.oauth_consumer_template(), assigns %>
<% end %>
+
diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
index 1b6b33e69..6cf107d17 100644
--- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex
@@ -632,7 +632,15 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
defp build_info_cng(user, params) do
info_params =
- ["no_rich_text", "locked", "hide_followers", "hide_follows", "hide_favorites", "show_role"]
+ [
+ "no_rich_text",
+ "locked",
+ "hide_followers",
+ "hide_follows",
+ "hide_favorites",
+ "show_role",
+ "skip_thread_containment"
+ ]
|> Enum.reduce(%{}, fn key, res ->
if value = params[key] do
Map.put(res, key, value == "true")
diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex
index 550f35f5f..8d8892068 100644
--- a/lib/pleroma/web/twitter_api/views/user_view.ex
+++ b/lib/pleroma/web/twitter_api/views/user_view.ex
@@ -118,7 +118,8 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
"pleroma" =>
%{
"confirmation_pending" => user_info.confirmation_pending,
- "tags" => user.tags
+ "tags" => user.tags,
+ "skip_thread_containment" => user.info.skip_thread_containment
}
|> maybe_with_activation_status(user, for_user)
|> with_notification_settings(user, for_user)