mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Updates user link to artist link (user side)
This commit is contained in:
parent
7a6582bbc7
commit
04e5a4e26d
17 changed files with 27 additions and 27 deletions
|
@ -40,7 +40,7 @@ defmodule Philomena.UserLinks do
|
||||||
@doc """
|
@doc """
|
||||||
Gets a single user_link.
|
Gets a single user_link.
|
||||||
|
|
||||||
Raises `Ecto.NoResultsError` if the User link does not exist.
|
Raises `Ecto.NoResultsError` if the Artist link does not exist.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
||||||
def can?(%User{role: "moderator"}, :show, %Report{}), do: true
|
def can?(%User{role: "moderator"}, :show, %Report{}), do: true
|
||||||
def can?(%User{role: "moderator"}, :edit, %Report{}), do: true
|
def can?(%User{role: "moderator"}, :edit, %Report{}), do: true
|
||||||
|
|
||||||
# Manage user links
|
# Manage artist links
|
||||||
def can?(%User{role: "moderator"}, :create_links, %User{}), do: true
|
def can?(%User{role: "moderator"}, :create_links, %User{}), do: true
|
||||||
def can?(%User{role: "moderator"}, :edit_links, %User{}), do: true
|
def can?(%User{role: "moderator"}, :edit_links, %User{}), do: true
|
||||||
def can?(%User{role: "moderator"}, _action, UserLink), do: true
|
def can?(%User{role: "moderator"}, _action, UserLink), do: true
|
||||||
|
@ -262,7 +262,7 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
||||||
def can?(%User{role: "assistant", role_map: %{"Tag" => "moderator"}}, :batch_update, Tag),
|
def can?(%User{role: "assistant", role_map: %{"Tag" => "moderator"}}, :batch_update, Tag),
|
||||||
do: true
|
do: true
|
||||||
|
|
||||||
# User link assistant actions
|
# Artist link assistant actions
|
||||||
def can?(%User{role: "assistant", role_map: %{"UserLink" => "moderator"}}, _action, %UserLink{}),
|
def can?(%User{role: "assistant", role_map: %{"UserLink" => "moderator"}}, _action, %UserLink{}),
|
||||||
do: true
|
do: true
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
||||||
def can?(%User{id: id}, action, %Filter{user_id: id}) when action in [:edit, :update, :delete],
|
def can?(%User{id: id}, action, %Filter{user_id: id}) when action in [:edit, :update, :delete],
|
||||||
do: true
|
do: true
|
||||||
|
|
||||||
# View user links they've created
|
# View artist links they've created
|
||||||
def can?(%User{id: id}, :create_links, %User{id: id}), do: true
|
def can?(%User{id: id}, :create_links, %User{id: id}), do: true
|
||||||
def can?(%User{id: id}, :show, %UserLink{user_id: id}), do: true
|
def can?(%User{id: id}, :show, %UserLink{user_id: id}), do: true
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Admin.UserLink.ContactController do
|
||||||
{:ok, _} = UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
|
{:ok, _} = UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User link successfully marked as contacted.")
|
|> put_flash(:info, "Artist successfully marked as contacted.")
|
||||||
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Admin.UserLink.RejectController do
|
||||||
{:ok, _} = UserLinks.reject_user_link(conn.assigns.user_link)
|
{:ok, _} = UserLinks.reject_user_link(conn.assigns.user_link)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User link successfully marked as rejected.")
|
|> put_flash(:info, "Artist link successfully marked as rejected.")
|
||||||
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Admin.UserLink.VerificationController do
|
||||||
{:ok, _} = UserLinks.verify_user_link(conn.assigns.user_link, conn.assigns.current_user)
|
{:ok, _} = UserLinks.verify_user_link(conn.assigns.user_link, conn.assigns.current_user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User link successfully verified.")
|
|> put_flash(:info, "Artist link successfully verified.")
|
||||||
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
|> redirect(to: Routes.admin_user_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ defmodule PhilomenaWeb.Admin.UserLinkController do
|
||||||
])
|
])
|
||||||
|> Repo.paginate(conn.assigns.scrivener)
|
|> Repo.paginate(conn.assigns.scrivener)
|
||||||
|
|
||||||
render(conn, "index.html", title: "Admin - User Links", user_links: links)
|
render(conn, "index.html", title: "Admin - Artist Links", user_links: links)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp verify_authorized(conn, _opts) do
|
defp verify_authorized(conn, _opts) do
|
||||||
|
|
|
@ -148,7 +148,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
|
||||||
|
|
||||||
false ->
|
false ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, "You must have a verified user link to create a commission listing.")
|
|> put_flash(:error, "You must have a verified artist link to create a commission listing.")
|
||||||
|> redirect(to: Routes.commission_path(conn, :index))
|
|> redirect(to: Routes.commission_path(conn, :index))
|
||||||
|> halt()
|
|> halt()
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,12 +36,12 @@ defmodule PhilomenaWeb.Profile.UserLinkController do
|
||||||
|> where(user_id: ^user.id)
|
|> where(user_id: ^user.id)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
|
|
||||||
render(conn, "index.html", title: "User Links", user_links: user_links)
|
render(conn, "index.html", title: "Artist Links", user_links: user_links)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new(conn, _params) do
|
def new(conn, _params) do
|
||||||
changeset = UserLinks.change_user_link(%UserLink{})
|
changeset = UserLinks.change_user_link(%UserLink{})
|
||||||
render(conn, "new.html", title: "New User Link", changeset: changeset)
|
render(conn, "new.html", title: "New Artist Link", changeset: changeset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(conn, %{"user_link" => user_link_params}) do
|
def create(conn, %{"user_link" => user_link_params}) do
|
||||||
|
@ -61,13 +61,13 @@ defmodule PhilomenaWeb.Profile.UserLinkController do
|
||||||
|
|
||||||
def show(conn, _params) do
|
def show(conn, _params) do
|
||||||
user_link = conn.assigns.user_link
|
user_link = conn.assigns.user_link
|
||||||
render(conn, "show.html", title: "Showing User Link", user_link: user_link)
|
render(conn, "show.html", title: "Showing Artist Link", user_link: user_link)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit(conn, _params) do
|
def edit(conn, _params) do
|
||||||
changeset = UserLinks.change_user_link(conn.assigns.user_link)
|
changeset = UserLinks.change_user_link(conn.assigns.user_link)
|
||||||
|
|
||||||
render(conn, "edit.html", title: "Editing User Link", changeset: changeset)
|
render(conn, "edit.html", title: "Editing Artist Link", changeset: changeset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(conn, %{"user_link" => user_link_params}) do
|
def update(conn, %{"user_link" => user_link_params}) do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
h1 User Links
|
h1 Artist Links
|
||||||
p Link creation is done via the Users menu.
|
p Link creation is done via the Users menu.
|
||||||
p Verifying a link will automatically award an artist badge if the link is public, no artist badge exists, and an "artist:" tag is specified.
|
p Verifying a link will automatically award an artist badge if the link is public, no artist badge exists, and an "artist:" tag is specified.
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ br
|
||||||
= link "My Listings", to: Routes.dnp_entry_path(@conn, :index, mine: "1")
|
= link "My Listings", to: Routes.dnp_entry_path(@conn, :index, mine: "1")
|
||||||
|
|
||||||
- not is_nil(@current_user) ->
|
- not is_nil(@current_user) ->
|
||||||
' You must have a verified user link to create and manage DNP entries.
|
' You must have a verified artist link to create and manage DNP entries.
|
||||||
= link "Request a user link", to: Routes.profile_user_link_path(@conn, :new, @current_user)
|
= link "Request an artist link", to: Routes.profile_user_link_path(@conn, :new, @current_user)
|
||||||
| .
|
| .
|
||||||
|
|
||||||
- true ->
|
- true ->
|
||||||
' You must be logged in and have a verified user link to create and manage DNP entries.
|
' You must be logged in and have a verified artist link to create and manage DNP entries.
|
||||||
|
|
||||||
|
|
||||||
h3 The List
|
h3 The List
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
= @report_count
|
= @report_count
|
||||||
|
|
||||||
= if @user_link_count do
|
= if @user_link_count do
|
||||||
= link to: Routes.admin_user_link_path(@conn, :index), class: "header__link", title: "User Links" do
|
= link to: Routes.admin_user_link_path(@conn, :index), class: "header__link", title: "Artist Links" do
|
||||||
' L
|
' L
|
||||||
span.header__counter__admin
|
span.header__counter__admin
|
||||||
= @user_link_count
|
= @user_link_count
|
||||||
|
|
|
@ -145,7 +145,7 @@ a.label.label--primary.label--block href="#" data-click-toggle=".js-admin__optio
|
||||||
li
|
li
|
||||||
= link to: Routes.profile_user_link_path(@conn, :new, @user) do
|
= link to: Routes.profile_user_link_path(@conn, :new, @user) do
|
||||||
i.fa.fa-fw.fa-link
|
i.fa.fa-fw.fa-link
|
||||||
span.admin__button Add User Link
|
span.admin__button Add Artist Link
|
||||||
|
|
||||||
= if can?(@conn, :create, Philomena.Bans.User) do
|
= if can?(@conn, :create, Philomena.Bans.User) do
|
||||||
li
|
li
|
||||||
|
|
|
@ -58,9 +58,9 @@
|
||||||
.block__content.commission__block_body
|
.block__content.commission__block_body
|
||||||
== @rendered.will_not_create
|
== @rendered.will_not_create
|
||||||
|
|
||||||
/ User link block
|
/ Artist link block
|
||||||
/.block
|
/.block
|
||||||
.block__header: span.block__header__title User Links
|
.block__header: span.block__header__title Artist Links
|
||||||
- is_current = (current_user && current_user.id == @user.id)
|
- is_current = (current_user && current_user.id == @user.id)
|
||||||
- if @links.present? || is_current
|
- if @links.present? || is_current
|
||||||
= render partial: 'profiles/user_link_area'
|
= render partial: 'profiles/user_link_area'
|
||||||
|
|
|
@ -65,10 +65,10 @@
|
||||||
|
|
||||||
.block
|
.block
|
||||||
= if current?(@user, @conn.assigns.current_user) or manages_links?(@conn, @user) do
|
= if current?(@user, @conn.assigns.current_user) or manages_links?(@conn, @user) do
|
||||||
a.block__header--single-item href=Routes.profile_user_link_path(@conn, :new, @user) User Links
|
a.block__header--single-item href=Routes.profile_user_link_path(@conn, :new, @user) Artist Links
|
||||||
- else
|
- else
|
||||||
.block__header
|
.block__header
|
||||||
span.block__header__title User Links
|
span.block__header__title Artist Links
|
||||||
= for link <- @user.verified_links, should_see_link?(@conn, @user, link) do
|
= for link <- @user.verified_links, should_see_link?(@conn, @user, link) do
|
||||||
- watchers = if link.tag, do: @watcher_counts[link.tag.id] || 0, else: 0
|
- watchers = if link.tag, do: @watcher_counts[link.tag.id] || 0, else: 0
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
h1 User Links
|
h1 Artist Links
|
||||||
p
|
p
|
||||||
a.button href=Routes.profile_user_link_path(@conn, :new, @user)
|
a.button href=Routes.profile_user_link_path(@conn, :new, @user)
|
||||||
' Create a link
|
' Create a link
|
||||||
p
|
p
|
||||||
' User links associate your account on Derpibooru with tags about content you create and with accounts on sites elsewhere. This allows users to easily identify artists and admins to act more rapidly on takedown requests.
|
' Artist links associate your account on Derpibooru with tags about content you create and with accounts on sites elsewhere. This allows users to easily identify artists and admins to act more rapidly on takedown requests.
|
||||||
|
|
||||||
table.table
|
table.table
|
||||||
thead
|
thead
|
||||||
|
|
|
@ -23,7 +23,7 @@ p
|
||||||
strong> Only an owner of an image's rights (normally the artist) can request a takedown.
|
strong> Only an owner of an image's rights (normally the artist) can request a takedown.
|
||||||
' If you're the artist, you'll
|
' If you're the artist, you'll
|
||||||
strong> need
|
strong> need
|
||||||
' a verified user link.
|
' a verified artist link.
|
||||||
p
|
p
|
||||||
' For more information, please read the
|
' For more information, please read the
|
||||||
= link "takedown policy", to: "/pages/takedowns"
|
= link "takedown policy", to: "/pages/takedowns"
|
||||||
|
|
|
@ -43,7 +43,7 @@ defmodule PhilomenaWeb.Admin.UserView do
|
||||||
def description("moderator", "Image"), do: "Manage images"
|
def description("moderator", "Image"), do: "Manage images"
|
||||||
def description("moderator", "DuplicateReport"), do: "Manage duplicates"
|
def description("moderator", "DuplicateReport"), do: "Manage duplicates"
|
||||||
def description("moderator", "Comment"), do: "Manage comments"
|
def description("moderator", "Comment"), do: "Manage comments"
|
||||||
def description("moderator", "UserLink"), do: "Manage user links"
|
def description("moderator", "UserLink"), do: "Manage artist links"
|
||||||
def description("moderator", "Topic"), do: "Moderate forums"
|
def description("moderator", "Topic"), do: "Moderate forums"
|
||||||
|
|
||||||
def description("moderator", "Tag"), do: "Manage tag details"
|
def description("moderator", "Tag"), do: "Manage tag details"
|
||||||
|
|
Loading…
Reference in a new issue