mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
format
This commit is contained in:
parent
21c17855f8
commit
d8f04fe922
6 changed files with 56 additions and 13 deletions
|
@ -32,7 +32,10 @@ defmodule Philomena.ArtistLinks do
|
|||
recheck_query
|
||||
|> Repo.all()
|
||||
|> Enum.map(fn link ->
|
||||
ArtistLink.automatic_verify_changeset(link, AutomaticVerifier.check_link(link, recheck_time))
|
||||
ArtistLink.automatic_verify_changeset(
|
||||
link,
|
||||
AutomaticVerifier.check_link(link, recheck_time)
|
||||
)
|
||||
end)
|
||||
|> Enum.map(&Repo.update!/1)
|
||||
end
|
||||
|
|
|
@ -263,8 +263,12 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
|||
do: true
|
||||
|
||||
# Artist link assistant actions
|
||||
def can?(%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}}, _action, %ArtistLink{}),
|
||||
do: true
|
||||
def can?(
|
||||
%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}},
|
||||
_action,
|
||||
%ArtistLink{}
|
||||
),
|
||||
do: true
|
||||
|
||||
def can?(
|
||||
%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}},
|
||||
|
@ -273,14 +277,26 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
|||
),
|
||||
do: true
|
||||
|
||||
def can?(%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}}, :edit, %ArtistLink{}),
|
||||
do: true
|
||||
def can?(
|
||||
%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}},
|
||||
:edit,
|
||||
%ArtistLink{}
|
||||
),
|
||||
do: true
|
||||
|
||||
def can?(%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}}, :edit_links, %User{}),
|
||||
do: true
|
||||
def can?(
|
||||
%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}},
|
||||
:edit_links,
|
||||
%User{}
|
||||
),
|
||||
do: true
|
||||
|
||||
def can?(%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}}, :index, %ArtistLink{}),
|
||||
do: true
|
||||
def can?(
|
||||
%User{role: "assistant", role_map: %{"ArtistLink" => "moderator"}},
|
||||
:index,
|
||||
%ArtistLink{}
|
||||
),
|
||||
do: true
|
||||
|
||||
# View forums
|
||||
def can?(%User{role: "assistant"}, :show, %Forum{access_level: level})
|
||||
|
|
|
@ -13,7 +13,8 @@ defmodule PhilomenaWeb.Admin.ArtistLink.ContactController do
|
|||
preload: [:user]
|
||||
|
||||
def create(conn, _params) do
|
||||
{:ok, _} = ArtistLinks.contact_artist_link(conn.assigns.artist_link, conn.assigns.current_user)
|
||||
{:ok, _} =
|
||||
ArtistLinks.contact_artist_link(conn.assigns.artist_link, conn.assigns.current_user)
|
||||
|
||||
conn
|
||||
|> put_flash(:info, "Artist successfully marked as contacted.")
|
||||
|
|
|
@ -52,7 +52,9 @@ defmodule PhilomenaWeb.Profile.ArtistLinkController do
|
|||
:info,
|
||||
"Link submitted! Please put '#{artist_link.verification_code}' on your linked webpage now."
|
||||
)
|
||||
|> redirect(to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link))
|
||||
|> redirect(
|
||||
to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link)
|
||||
)
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "new.html", changeset: changeset)
|
||||
|
@ -75,7 +77,9 @@ defmodule PhilomenaWeb.Profile.ArtistLinkController do
|
|||
{:ok, artist_link} ->
|
||||
conn
|
||||
|> put_flash(:info, "Link successfully updated.")
|
||||
|> redirect(to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link))
|
||||
|> redirect(
|
||||
to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link)
|
||||
)
|
||||
|
||||
{:error, changeset} ->
|
||||
render(conn, "edit.html", changeset: changeset)
|
||||
|
|
|
@ -148,7 +148,10 @@ defmodule PhilomenaWeb.Profile.CommissionController do
|
|||
|
||||
false ->
|
||||
conn
|
||||
|> put_flash(:error, "You must have a verified artist 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))
|
||||
|> halt()
|
||||
end
|
||||
|
|
|
@ -4,13 +4,21 @@ defmodule Philomena.Repo.Migrations.RenameUserLinksTable do
|
|||
def up do
|
||||
rename table("user_links"), to: table("artist_links")
|
||||
execute "ALTER SEQUENCE user_links_id_seq RENAME TO artist_links_id_seq"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_aasm_state RENAME TO index_artist_links_on_aasm_state"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_contacted_by_user_id RENAME TO index_artist_links_on_contacted_by_user_id"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_next_check_at RENAME TO index_artist_links_on_next_check_at"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_tag_id RENAME TO index_artist_links_on_tag_id"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_uri_tag_id_user_id RENAME TO index_artist_links_on_uri_tag_id_user_id"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_user_id RENAME TO index_artist_links_on_user_id"
|
||||
|
||||
execute "ALTER INDEX index_user_links_on_verified_by_user_id RENAME TO index_artist_links_on_verified_by_user_id"
|
||||
|
||||
execute "ALTER TABLE artist_links RENAME CONSTRAINT user_links_pkey TO artist_links_pkey"
|
||||
execute "UPDATE roles SET resource_type='ArtistLink' WHERE resource_type='UserLink'"
|
||||
end
|
||||
|
@ -18,13 +26,21 @@ defmodule Philomena.Repo.Migrations.RenameUserLinksTable do
|
|||
def down do
|
||||
rename table("artist_links"), to: table("user_links")
|
||||
execute "ALTER SEQUENCE artist_links_id_seq RENAME TO user_links_id_seq"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_aasm_state RENAME TO index_user_links_on_aasm_state"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_contacted_by_user_id RENAME TO index_user_links_on_contacted_by_user_id"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_next_check_at RENAME TO index_user_links_on_next_check_at"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_tag_id RENAME TO index_user_links_on_tag_id"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_uri_tag_id_user_id RENAME TO index_user_links_on_uri_tag_id_user_id"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_user_id RENAME TO index_user_links_on_user_id"
|
||||
|
||||
execute "ALTER INDEX index_artist_links_on_verified_by_user_id RENAME TO index_user_links_on_verified_by_user_id"
|
||||
|
||||
execute "ALTER TABLE user_links RENAME CONSTRAINT artist_links_pkey TO user_links_pkey"
|
||||
execute "UPDATE roles SET resource_type='UserLink' WHERE resource_type='ArtistLink'"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue