mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
hide staff tools
This commit is contained in:
parent
2ef4bdbbad
commit
7b5fd947f9
18 changed files with 35 additions and 24 deletions
|
@ -7,7 +7,7 @@
|
||||||
import { $$ } from './utils/dom';
|
import { $$ } from './utils/dom';
|
||||||
|
|
||||||
function hideStaffTools() {
|
function hideStaffTools() {
|
||||||
if (window.booru.hideStaffTools) {
|
if (window.booru.hideStaffTools == "true") {
|
||||||
$$('.js-staff-action').forEach(el => {
|
$$('.js-staff-action').forEach(el => {
|
||||||
el.classList.add('hidden');
|
el.classList.add('hidden');
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,6 +39,7 @@ defmodule PhilomenaWeb.SettingController do
|
||||||
|> set_cookie(user_params, "hidpi", "hidpi")
|
|> set_cookie(user_params, "hidpi", "hidpi")
|
||||||
|> set_cookie(user_params, "webm", "webm")
|
|> set_cookie(user_params, "webm", "webm")
|
||||||
|> set_cookie(user_params, "chan_nsfw", "chan_nsfw")
|
|> set_cookie(user_params, "chan_nsfw", "chan_nsfw")
|
||||||
|
|> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp set_cookie(conn, params, param_name, cookie_name) do
|
defp set_cookie(conn, params, param_name, cookie_name) do
|
||||||
|
|
|
@ -53,9 +53,9 @@ article.block.communication id="comment_#{@comment.id}"
|
||||||
- true ->
|
- true ->
|
||||||
|
|
||||||
= if can?(@conn, :show, :ip_address) do
|
= if can?(@conn, :show, :ip_address) do
|
||||||
.communication__info
|
.communication__info.js-staff-action
|
||||||
=<> link_to_ip(@conn, @comment.ip)
|
=<> link_to_ip(@conn, @comment.ip)
|
||||||
.communication__info
|
.communication__info.js-staff-action
|
||||||
=<> link_to_fingerprint(@conn, @comment.fingerprint)
|
=<> link_to_fingerprint(@conn, @comment.fingerprint)
|
||||||
|
|
||||||
= form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
|
= form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
|
||||||
|
|
|
@ -58,9 +58,9 @@ article.block.communication id="comment_#{@comment.id}"
|
||||||
- true ->
|
- true ->
|
||||||
|
|
||||||
= if can?(@conn, :show, :ip_address) do
|
= if can?(@conn, :show, :ip_address) do
|
||||||
.communication__info
|
.communication__info.js-staff-action
|
||||||
=<> link_to_ip(@conn, @comment.ip)
|
=<> link_to_ip(@conn, @comment.ip)
|
||||||
.communication__info
|
.communication__info.js-staff-action
|
||||||
=<> link_to_fingerprint(@conn, @comment.fingerprint)
|
=<> link_to_fingerprint(@conn, @comment.fingerprint)
|
||||||
|
|
||||||
= form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
|
= form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
- del = @conn.params["del"]
|
- del = @conn.params["del"]
|
||||||
|
|
||||||
= if blank?(del) do
|
= if blank?(del) do
|
||||||
a href=@route.(Keyword.put(@params, :del, 1)) title="Include Deleted/Merged Images"
|
a.js-staff-action href=@route.(Keyword.put(@params, :del, 1)) title="Include Deleted/Merged Images"
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
i.fa.fa-exclamation>
|
i.fa.fa-exclamation>
|
||||||
span.hide-mobile.hide-limited-desktop Show Deleted
|
span.hide-mobile.hide-limited-desktop Show Deleted
|
||||||
|
|
||||||
= if del != "only" do
|
= if del != "only" do
|
||||||
a href=@route.(Keyword.put(@params, :del, "only")) title="Only Deleted/Merged Images"
|
a.js-staff-action href=@route.(Keyword.put(@params, :del, "only")) title="Only Deleted/Merged Images"
|
||||||
i.fa.fa-minus
|
i.fa.fa-minus
|
||||||
i.fa.fa-check>
|
i.fa.fa-check>
|
||||||
span.hide-mobile.hide-limited-desktop Only Deleted
|
span.hide-mobile.hide-limited-desktop Only Deleted
|
||||||
|
|
||||||
= if del == "only" do
|
= if del == "only" do
|
||||||
a href=@route.(Keyword.put(@params, :del, 1)) title="Include Images Visible to Users"
|
a.js-staff-action href=@route.(Keyword.put(@params, :del, 1)) title="Include Images Visible to Users"
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
i.fa.fa-check>
|
i.fa.fa-check>
|
||||||
span.hide-mobile.hide-limited-desktop Show Non-Deleted
|
span.hide-mobile.hide-limited-desktop Show Non-Deleted
|
||||||
|
|
||||||
= if present?(del) do
|
= if present?(del) do
|
||||||
a href=@route.(Keyword.delete(@params, :del)) title="Hide Deleted/Merged Images"
|
a.js-staff-action href=@route.(Keyword.delete(@params, :del)) title="Hide Deleted/Merged Images"
|
||||||
i.fa.fa-minus
|
i.fa.fa-minus
|
||||||
i.fa.fa-exclamation>
|
i.fa.fa-exclamation>
|
||||||
span.hide-mobile.hide-limited-desktop Hide Deleted
|
span.hide-mobile.hide-limited-desktop Hide Deleted
|
||||||
|
|
||||||
= if present?(del) and del != "deleted" do
|
= if present?(del) and del != "deleted" do
|
||||||
a href=@route.(Keyword.put(@params, :del, "deleted")) title="Only Deleted (Strict)"
|
a.js-staff-action href=@route.(Keyword.put(@params, :del, "deleted")) title="Only Deleted (Strict)"
|
||||||
i.fa.fa-minus
|
i.fa.fa-minus
|
||||||
i.fa.fa-object-group>
|
i.fa.fa-object-group>
|
||||||
span.hide-mobile.hide-limited-desktop Exclude Merges
|
span.hide-mobile.hide-limited-desktop Exclude Merges
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
a href="#" data-click-tab="favoriters" data-load-tab=Routes.image_favorite_path(@conn, :index, @image)
|
a href="#" data-click-tab="favoriters" data-load-tab=Routes.image_favorite_path(@conn, :index, @image)
|
||||||
i.fa.fa-star>
|
i.fa.fa-star>
|
||||||
| List favoriters
|
| List favoriters
|
||||||
= if display_mod_tools? do
|
= if display_mod_tools? and not hide_staff_tools?(@conn) do
|
||||||
a href="#" data-click-tab="replace"
|
a href="#" data-click-tab="replace"
|
||||||
i.fa.fa-upload>
|
i.fa.fa-upload>
|
||||||
| Replace
|
| Replace
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
= @source_change_count
|
= @source_change_count
|
||||||
| )
|
| )
|
||||||
|
|
||||||
= if can?(@conn, :hide, @image) do
|
= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do
|
||||||
= form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
|
= form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
|
||||||
button.button.button--state-danger.button--separate-left type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
|
button.button.button--state-danger.button--separate-left type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
|
||||||
i.fas.fa-eraser>
|
i.fas.fa-eraser>
|
||||||
|
|
|
@ -2,7 +2,7 @@ span.image_uploader
|
||||||
' by
|
' by
|
||||||
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, awards: true, conn: @conn
|
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, awards: true, conn: @conn
|
||||||
|
|
||||||
= if can?(@conn, :show, :ip_address) do
|
= if can?(@conn, :show, :ip_address) and not hide_staff_tools?(@conn) do
|
||||||
=> link_to_ip(@conn, @image.ip)
|
=> link_to_ip(@conn, @image.ip)
|
||||||
=> link_to_fingerprint(@conn, @image.fingerprint)
|
=> link_to_fingerprint(@conn, @image.fingerprint)
|
||||||
a#edit-uploader href="#" data-click-hide=".image_uploader" data-click-show="#uploader-form"
|
a#edit-uploader href="#" data-click-hide=".image_uploader" data-click-show="#uploader-form"
|
||||||
|
|
|
@ -13,7 +13,7 @@ elixir:
|
||||||
i.fa.fa-sync
|
i.fa.fa-sync
|
||||||
span.hide-mobile<> Refresh
|
span.hide-mobile<> Refresh
|
||||||
|
|
||||||
= for {comment, body} <- @comments, not comment.destroyed_content or can?(@conn, :show, comment) do
|
= for {comment, body} <- @comments, not comment.destroyed_content or (can?(@conn, :show, comment) and @conn.cookies["hide_staff_tools"] != "true") do
|
||||||
= render PhilomenaWeb.CommentView, "_comment.html", comment: comment, body: body, conn: @conn
|
= render PhilomenaWeb.CommentView, "_comment.html", comment: comment, body: body, conn: @conn
|
||||||
|
|
||||||
.block
|
.block
|
||||||
|
|
|
@ -20,7 +20,7 @@ header.header
|
||||||
input type="hidden" name="sd" value=@conn.params["sd"]
|
input type="hidden" name="sd" value=@conn.params["sd"]
|
||||||
|
|
||||||
= if hides_images?(@conn) do
|
= if hides_images?(@conn) do
|
||||||
= select f, :del, [{"-D", ""}, {"+D", 1}, {"*D", "deleted"}, {"DO", "only"}], name: "del", class: "input header__input", autocomplete: "off"
|
= select f, :del, [{"-D", ""}, {"+D", 1}, {"*D", "deleted"}, {"DO", "only"}], name: "del", class: "input header__input js-staff-action", autocomplete: "off"
|
||||||
|
|
||||||
button.header__search__button type="submit" title="Search"
|
button.header__search__button type="submit" title="Search"
|
||||||
i.fa-embedded--search
|
i.fa-embedded--search
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/ Dummy view for the admin bar
|
|
||||||
.flex.flex--centered.header--secondary__admin-links.stretched-mobile-links.js-staff-action
|
.flex.flex--centered.header--secondary__admin-links.stretched-mobile-links.js-staff-action
|
||||||
.dropdown.hide-mobile
|
.dropdown.hide-mobile
|
||||||
a.header__link title="Admin"
|
a.header__link title="Admin"
|
||||||
|
|
|
@ -32,7 +32,7 @@ article.block.communication id="post_#{@post.id}"
|
||||||
.flex.flex--wrap.flex--spaced-out
|
.flex.flex--wrap.flex--spaced-out
|
||||||
= render PhilomenaWeb.PostView, "_post_options.html", conn: @conn, post: @post
|
= render PhilomenaWeb.PostView, "_post_options.html", conn: @conn, post: @post
|
||||||
|
|
||||||
= if can?(@conn, :hide, @post) do
|
= if can?(@conn, :hide, @post) and not hide_staff_tools?(@conn) do
|
||||||
= cond do
|
= cond do
|
||||||
- @post.hidden_from_users and not @post.destroyed_content ->
|
- @post.hidden_from_users and not @post.destroyed_content ->
|
||||||
= link(to: Routes.forum_topic_post_hide_path(@conn, :delete, @post.topic.forum, @post.topic, @post), data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
|
= link(to: Routes.forum_topic_post_hide_path(@conn, :delete, @post.topic.forum, @post.topic, @post), data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
li = link("Source changes", to: Routes.profile_source_change_path(@conn, :index, @user))
|
li = link("Source changes", to: Routes.profile_source_change_path(@conn, :index, @user))
|
||||||
|
|
||||||
= if can_index_user?(@conn) do
|
= if can_index_user?(@conn) do
|
||||||
= render PhilomenaWeb.ProfileView, "_admin_block.html", assigns
|
.js-staff-action
|
||||||
|
= render PhilomenaWeb.ProfileView, "_admin_block.html", assigns
|
||||||
|
|
||||||
= if (current?(@user, @conn.assigns.current_user) or can?(@conn, :index, Philomena.Bans.User)) and Enum.any?(@bans) do
|
= if (current?(@user, @conn.assigns.current_user) or can?(@conn, :index, Philomena.Bans.User)) and Enum.any?(@bans) do
|
||||||
.block
|
.block
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
= pluralize("user", "users", watchers)
|
= pluralize("user", "users", watchers)
|
||||||
|
|
||||||
.block
|
.block
|
||||||
= if manages_awards?(@conn) do
|
= if manages_awards?(@conn) and not hide_staff_tools?(@conn) do
|
||||||
a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges
|
a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges
|
||||||
- else
|
- else
|
||||||
.block__header
|
.block__header
|
||||||
|
@ -105,7 +106,7 @@
|
||||||
|
|
||||||
= render PhilomenaWeb.ProfileView, "_about_me.html", user: @user, about_me: @about_me, conn: @conn
|
= render PhilomenaWeb.ProfileView, "_about_me.html", user: @user, about_me: @about_me, conn: @conn
|
||||||
|
|
||||||
= if can_read_mod_notes?(@conn) do
|
= if can_read_mod_notes?(@conn) and not hide_staff_tools?(@conn) do
|
||||||
.block
|
.block
|
||||||
a.block__header--single-item href=Routes.profile_detail_path(@conn, :index, @user) Mod Notes
|
a.block__header--single-item href=Routes.profile_detail_path(@conn, :index, @user) Mod Notes
|
||||||
table.table
|
table.table
|
||||||
|
|
|
@ -122,6 +122,11 @@ h1 Content Settings
|
||||||
=> label f, :chan_nsfw, "Show NSFW channels"
|
=> label f, :chan_nsfw, "Show NSFW channels"
|
||||||
=> checkbox f, :chan_nsfw
|
=> checkbox f, :chan_nsfw
|
||||||
.fieldlabel: i Show streams marked as NSFW on the channels page.
|
.fieldlabel: i Show streams marked as NSFW on the channels page.
|
||||||
|
= if @conn.assigns.current_user.role != "user" do
|
||||||
|
.field
|
||||||
|
=> label f, :hide_staff_tools
|
||||||
|
=> checkbox f, :hide_staff_tools, class: "checkbox"
|
||||||
|
.fieldlabel: i Hide most of the staff tools (e.g. IPs, anon names) making your site appear as if you weren't staff, this is useful when browsing in public.
|
||||||
|
|
||||||
= if !@conn.assigns.current_user do
|
= if !@conn.assigns.current_user do
|
||||||
.block__tab.hidden data-tab="join-the-herd"
|
.block__tab.hidden data-tab="join-the-herd"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
= if assigns[:awards] do
|
= if assigns[:awards] do
|
||||||
= render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards
|
= render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards
|
||||||
|
|
||||||
- not is_nil(@object.user) and can?(@conn, :reveal_anon, @object) ->
|
- not is_nil(@object.user) and (can?(@conn, :reveal_anon, @object) and @conn.cookies["hide_staff_tools"] != "true") ->
|
||||||
strong<>
|
strong<>
|
||||||
= link(anonymous_name(@object, true), to: Routes.profile_path(@conn, :show, @object.user))
|
= link(anonymous_name(@object, true), to: Routes.profile_path(@conn, :show, @object.user))
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,9 @@ defmodule PhilomenaWeb.AppView do
|
||||||
def communication_body_class(%{destroyed_content: true}), do: "communication--destroyed"
|
def communication_body_class(%{destroyed_content: true}), do: "communication--destroyed"
|
||||||
def communication_body_class(_communication), do: nil
|
def communication_body_class(_communication), do: nil
|
||||||
|
|
||||||
|
def hide_staff_tools?(conn),
|
||||||
|
do: conn.cookies["hide_staff_tools"] == "true"
|
||||||
|
|
||||||
def blank?(nil), do: true
|
def blank?(nil), do: true
|
||||||
def blank?(""), do: true
|
def blank?(""), do: true
|
||||||
def blank?([]), do: true
|
def blank?([]), do: true
|
||||||
|
|
|
@ -32,6 +32,7 @@ defmodule PhilomenaWeb.LayoutView do
|
||||||
interactions = Map.get(conn.assigns, :interactions, [])
|
interactions = Map.get(conn.assigns, :interactions, [])
|
||||||
user = conn.assigns.current_user
|
user = conn.assigns.current_user
|
||||||
filter = conn.assigns.current_filter
|
filter = conn.assigns.current_filter
|
||||||
|
conn = Plug.Conn.fetch_cookies(conn)
|
||||||
|
|
||||||
data = [
|
data = [
|
||||||
filter_id: filter.id,
|
filter_id: filter.id,
|
||||||
|
@ -49,7 +50,8 @@ defmodule PhilomenaWeb.LayoutView do
|
||||||
fancy_tag_edit: if(user, do: user.fancy_tag_field_on_edit, else: true),
|
fancy_tag_edit: if(user, do: user.fancy_tag_field_on_edit, else: true),
|
||||||
fancy_tag_upload: if(user, do: user.fancy_tag_field_on_upload, else: true),
|
fancy_tag_upload: if(user, do: user.fancy_tag_field_on_upload, else: true),
|
||||||
interactions: Jason.encode!(interactions),
|
interactions: Jason.encode!(interactions),
|
||||||
ignored_tag_list: Jason.encode!(ignored_tag_list(conn.assigns[:tags]))
|
ignored_tag_list: Jason.encode!(ignored_tag_list(conn.assigns[:tags])),
|
||||||
|
hide_staff_tools: Jason.encode!(conn.cookies["hide_staff_tools"])
|
||||||
]
|
]
|
||||||
|
|
||||||
data = Keyword.merge(data, extra)
|
data = Keyword.merge(data, extra)
|
||||||
|
|
Loading…
Reference in a new issue