/contact: update contact page with more contact methods.

This commit is contained in:
evazion
2020-12-25 00:37:15 -06:00
parent 069231a33b
commit 96f08b78c5
3 changed files with 11 additions and 5 deletions

View File

@@ -189,7 +189,7 @@ module ApplicationHelper
to_sentence(links, **options)
end
def link_to_user(user)
def link_to_user(user, text = nil)
return "anonymous" if user.blank?
user_class = "user user-#{user.level_string.downcase}"
@@ -197,8 +197,9 @@ module ApplicationHelper
user_class += " user-post-uploader" if user.can_upload_free?
user_class += " user-banned" if user.is_banned?
text = user.pretty_name if text.blank?
data = { "user-id": user.id, "user-name": user.name, "user-level": user.level }
link_to(user.pretty_name, user_path(user), class: user_class, data: data)
link_to(text, user, class: user_class, data: data)
end
def mod_link_to_user(user, positive_or_negative)

View File

@@ -4,8 +4,11 @@
<div id="a-contact">
<h1>Contact</h1>
<h2>Questions &amp; Comments</h2>
<p>You can reach the administrator of this site at <%= mail_to Danbooru.config.contact_email, nil, :encode => :hex %>.</p>
<p>
You can contact the administrator of this site by
<%= link_to "sending a private message", new_dmail_path(dmail: { to_name: User.owner.name }) %> to <%= link_to_user User.owner, "@#{User.owner.name}" %>,
by messaging @<%= User.owner.name %> on the <%= link_to "#{Danbooru.config.canonical_app_name} Discord", Danbooru.config.discord_server_url %>,
or by sending an email to <%= mail_to Danbooru.config.contact_email, nil, encode: :hex %>.
</p>
</div>
</div>

View File

@@ -94,6 +94,8 @@ class StaticControllerTest < ActionDispatch::IntegrationTest
context "contact action" do
should "work" do
create(:owner_user)
get contact_path
assert_response :success
end