Merge branch 'features/add-credo-to-ci' into 'develop'
[akkoma] / lib / pleroma / web / controller_helper.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ControllerHelper do
6 use Pleroma.Web, :controller
7
8 def oauth_scopes(params, default) do
9 # Note: `scopes` is used by Mastodon — supporting it but sticking to
10 # OAuth's standard `scope` wherever we control it
11 Pleroma.Web.OAuth.parse_scopes(params["scope"] || params["scopes"], default)
12 end
13
14 def json_response(conn, status, json) do
15 conn
16 |> put_status(status)
17 |> json(json)
18 end
19 end