Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6672 Allow some admins to set a generic username #4994

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ Layout/TrailingWhitespace:
Enabled: false

Lint/AmbiguousBlockAssociation:
Exclude:
# Exception for specs where we use change matchers:
# https://github.com/rubocop-hq/rubocop/issues/4222
- 'spec/**/*.rb'
Enabled: false

Lint/AmbiguousRegexpLiteral:
Enabled: false
Expand Down
94 changes: 47 additions & 47 deletions app/views/preferences/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,160 +1,160 @@
<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= ts('Set My Preferences') %></h2>
<h2 class="heading"><%= t(".page_heading") %></h2>
<%= error_messages_for :preference %>

<!--/descriptions-->

<!--subnav-->
<h3 class="landmark heading">Navigation</h3>
brianjaustin marked this conversation as resolved.
Show resolved Hide resolved
<ul class="navigation actions" role="navigation">
<li><%= link_to ts('Edit My Profile'), edit_user_path(@user) %></li>
<li><%= link_to ts('Manage My Pseuds'), user_pseuds_path(@user) %></li>
<li><%= link_to t(".blocked_users"), user_blocked_users_path %></li>
<li><%= link_to t(".muted_users"), user_muted_users_path %></li>
<li><%= link_to ts('Change My User Name'), change_username_user_path(@user) %></li>
<li><%= link_to ts('Orphan My Works'), new_orphan_path %></li>
<li><%= link_to t(".navigation.edit_my_profile"), edit_user_path(@user) %></li>
<li><%= link_to t(".navigation.manage_my_pseuds"), user_pseuds_path(@user) %></li>
<li><%= link_to t(".navigation.blocked_users"), user_blocked_users_path %></li>
<li><%= link_to t(".navigation.muted_users"), user_muted_users_path %></li>
<li><%= link_to t(".navigation.change_my_username"), change_username_user_path(@user) %></li>
<li><%= link_to t(".navigation.orphan_my_works"), new_orphan_path %></li>
</ul>
<!--/subnav-->

<!--main content-->
<%= form_for(@preference, url: user_preference_path(@user, @preference)) do |f| %>
<fieldset>
<legend><%= ts('Privacy') %></legend>
<h4 class="heading"><%= ts('Privacy') %> <%= link_to_help 'privacy-preferences' %></h4>
<legend><%= t(".privacy.legend") %></legend>
<h4 class="heading"><%= t(".privacy.heading") %> <%= link_to_help "privacy-preferences" %></h4>
<ul>
<li>
<%= f.check_box :email_visible %>
<%= f.label :email_visible, ts('Show my email address to other people.') %>
<%= f.label :email_visible, t(".privacy.show_email_address") %>
</li>
<li>
<%= f.check_box :date_of_birth_visible %>
<%= f.label :date_of_birth_visible, ts('Show my date of birth to other people.') %>
<%= f.label :date_of_birth_visible, t(".privacy.show_date_of_birth") %>
</li>
<li>
<%= f.check_box :minimize_search_engines %>
<%= f.label :minimize_search_engines, ts('Hide my work from search engines when possible.') %>
<%= f.label :minimize_search_engines, t(".privacy.hide_work_from_search_engines") %>
</li>
<li>
<%= f.check_box :disable_share_links %>
<%= f.label :disable_share_links, ts('Hide the share buttons on my work.') %>
<%= f.label :disable_share_links, t(".privacy.hide_share_buttons") %>
</li>
<li>
<%= f.check_box :allow_cocreator %>
<%= f.label :allow_cocreator, ts("Allow others to invite me to be a co-creator.") %>
<%= f.label :allow_cocreator, t(".privacy.allow_co_creator_invite") %>
</li>
</ul>
</fieldset>
<fieldset>
<legend><%= ts('Display') %></legend>
<h4 class="heading"><%= ts('Display') %> <%= link_to_help 'display-preferences' %></h4>
<legend><%= t(".display.legend") %></legend>
<h4 class="heading"><%= t(".display.heading") %> <%= link_to_help "display-preferences" %></h4>
<ul>
<li>
<%= f.check_box :adult %>
<%= f.label :adult, ts('Show me adult content without checking.') %>
<%= f.label :adult, t(".display.show_adult_content") %>
</li>
<li>
<%= f.check_box :view_full_works %>
<%= f.label :view_full_works, ts('Show the whole work by default.') %>
<%= f.label :view_full_works, t(".display.show_whole_work_default") %>
</li>
<li>
<%= f.check_box :hide_warnings %>
<%= f.label :hide_warnings, ts('Hide warnings (you can still choose to show them).') %>
<%= f.label :hide_warnings, t(".display.hide_warnings") %>
</li>
<li>
<%= f.check_box :hide_freeform %>
<%= f.label :hide_freeform, ts('Hide additional tags (you can still choose to show them).') %>
<%= f.label :hide_freeform, t(".display.hide_additional_tags") %>
</li>
<li>
<%= f.check_box :disable_work_skins %>
<%= f.label :disable_work_skins, ts('Hide work skins (you can still choose to show them).') %> <%= link_to_help 'skins-basics' %>
<%= f.label :disable_work_skins, t(".display.hide_work_skins") %> <%= link_to_help "skins-basics" %>
</li>
</ul>
</fieldset>
<fieldset>
<dl>
<dt><%= f.label :skin_id, ts('Your site skin') %> <%= link_to_help 'skins-basics' %></dt>
<dt><%= f.label :skin_id, t(".your_site_skin") %> <%= link_to_help "skins-basics" %></dt>
<dd>
<span class="actions"><%= link_to ts('Public Site Skins'), skins_path %></span>
<%= f.select :skin_id, @available_skins.collect{|s| [s.title, s.id]} %>
<span class="actions"><%= link_to t(".public_site_skins"), skins_path %></span>
<%= f.select :skin_id, @available_skins.collect { |s| [s.title, s.id] } %>
</dd>
<dt><%= f.label :time_zone, ts('Your time zone') %></dt>
<dd><%= f.time_zone_select :time_zone, nil, :default => Time.zone.name %></dd>
<dt><%= f.label :time_zone, t(".your_time_zone") %></dt>
<dd><%= f.time_zone_select :time_zone, nil, default: Time.zone.name %></dd>
<% if $rollout.active?(:set_locale_preference, @user) %>
<dt><%= f.label :preferred_locale, ts('Your locale') %> <%= link_to_help 'locale-preferences' %></dt>
<dt><%= f.label :preferred_locale, t(".your_locale") %> <%= link_to_help "locale-preferences" %></dt>
<dd><%= f.select :preferred_locale, locale_options_for_select(@available_locales, "id"),
default: @preference.preferred_locale %></dd>
<% end %>
<dt><%= f.label :work_title_format, ts('Browser page title format') %> <%= link_to_help 'work_title_format' %></dt>
<dt><%= f.label :work_title_format, t(".browser_page_title_format") %> <%= link_to_help "work_title_format" %></dt>
<dd><%= f.text_field :work_title_format %></dd>
</dl>
</fieldset>
<fieldset>
<legend><%= ts('Comments') %></legend>
<h4 class="heading"><%= ts('Comments') %> <%= link_to_help 'comment-preferences' %></h4>
<legend><%= t(".comments.legend") %></legend>
<h4 class="heading"><%= t(".comments.heading") %> <%= link_to_help "comment-preferences" %></h4>
<ul>
<li>
<%= f.check_box :comment_emails_off %>
<%= f.label :comment_emails_off, ts('Turn off emails about comments.') %>
<%= f.label :comment_emails_off, t(".comments.turn_off_emails") %>
</li>
<li>
<%= f.check_box :comment_inbox_off %>
<%= f.label :comment_inbox_off, ts('Turn off messages to your inbox about comments.') %>
<%= f.label :comment_inbox_off, t(".comments.turn_off_inbox") %>
</li>
<li>
<%= f.check_box :comment_copy_to_self_off %>
<%= f.label :comment_copy_to_self_off, ts('Turn off copies of your own comments.') %>
<%= f.label :comment_copy_to_self_off, t(".comments.turn_off_copies_own_comments") %>
</li>
<li>
<%= f.check_box :kudos_emails_off %>
<%= f.label :kudos_emails_off, ts('Turn off emails about kudos.') %>
<%= f.label :kudos_emails_off, t(".comments.turn_off_kudos_emails") %>
</li>
<li>
<%= f.check_box :guest_replies_off %>
<%= f.label :guest_replies_off, t(".guest_replies_off") %>
<%= f.label :guest_replies_off, t(".comments.guest_replies_off") %>
</li>
</ul>
</fieldset>
<fieldset>
<legend><%= ts('Collections, Challenges and Gifts') %></legend>
<h4 class="heading"><%= ts('Collections, Challenges and Gifts') %> <%= link_to_help 'collection-preferences' %></h4>
<legend><%= t(".collections_challenges_gifts.legend") %></legend>
<h4 class="heading"><%= t(".collections_challenges_gifts.heading") %> <%= link_to_help "collection-preferences" %></h4>
<ul>
<li>
<%= f.check_box :allow_collection_invitation %>
<%= f.label :allow_collection_invitation, t(".allow_collection_invitation") %>
<%= f.label :allow_collection_invitation, t(".collections_challenges_gifts.allow_collection_invitation") %>
</li>
<li>
<%= f.check_box :allow_gifts %>
<%= f.label :allow_gifts, ts("Allow anyone to gift me works.") %>
<%= f.label :allow_gifts, t(".collections_challenges_gifts.allow_gifts") %>
</li>
<li>
<%= f.check_box :collection_emails_off %>
<%= f.label :collection_emails_off, ts('Turn off emails from collections.') %>
<%= f.label :collection_emails_off, t(".collections_challenges_gifts.turn_off_collection_emails") %>
</li>
<li>
<%= f.check_box :collection_inbox_off %>
<%= f.label :collection_inbox_off, ts('Turn off inbox messages from collections.') %>
<%= f.label :collection_inbox_off, t(".collections_challenges_gifts.turn_off_collection_inbox") %>
</li>
<li>
<%= f.check_box :recipient_emails_off %>
<%= f.label :recipient_emails_off, ts('Turn off emails about gift works.') %>
<%= f.label :recipient_emails_off, t(".collections_challenges_gifts.turn_off_gift_emails") %>
</li>
</ul>
</fieldset>
<fieldset>
<legend><%= ts('Misc') %></legend>
<h4 class="heading"><%= ts('Misc') %> <%= link_to_help 'misc-preferences' %></h4>
<legend><%= t(".misc.legend") %></legend>
<h4 class="heading"><%= t(".misc.heading") %> <%= link_to_help "misc-preferences" %></h4>
<ul>
<li>
<%= f.check_box :history_enabled %>
<%= f.label :history_enabled, ts('Turn on History.') %>
<%= f.label :history_enabled, t(".misc.turn_on_history") %>
</li>
<li>
<%= f.check_box :first_login %>
<%= f.label :first_login, ts('Turn the new user help banner back on.') %>
<%= f.label :first_login, t(".misc.turn_on_new_user_help") %>
</li>
<li>
<%= f.check_box :banner_seen %>
<%= f.label :banner_seen, ts('Turn off the banner showing on every page.') %>
<%= f.label :banner_seen, t(".misc.turn_off_banner_every_page") %>
</li>
</ul>
</fieldset>
Expand Down
10 changes: 5 additions & 5 deletions app/views/pseuds/_pseuds_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
<dd>
<% if @pseud&.name == @user.login %>
<p class="important informational"><%= @pseud.name %></p>
<p class="footnote"><%= t(".change_matching_pseud_html", change_username_link: link_to(t(".change_username"), change_username_user_path(@user))) %></p>
<p class="footnote"><%= t(".cannot_change_matching_pseud_html", change_username_link: link_to(t(".change_username"), change_username_user_path(@user))) %></p>
<% else %>
<%= f.text_field :name, class: "observe_textlength", disabled: logged_in_as_admin? %>
<%= generate_countdown_html("pseud_name", Pseud::NAME_LENGTH_MAX) %>
<% end %>
</dd>

<dt><%= f.label :is_default, t(".make_default") %></dt>
<dd><%= f.check_box :is_default, disabled: ((@pseud.name && @user.login == @pseud.name && @pseud.is_default?) || logged_in_as_admin?) %></dd>

<dt><%= f.label :description, t(".description") %></dt>
<dd>
<p><%= allowed_html_instructions %></p>
<%= f.text_area :description, class: "observe_textlength" %>
<%= generate_countdown_html("pseud_description", Pseud::DESCRIPTION_MAX) %>
</dd>

<dt><%= t(".icon") %></dt>
<dd>
<ul class="notes">
Expand Down Expand Up @@ -51,7 +51,7 @@

<dt>
<%= f.label :icon_comment_text, t(".icon_comment") %>
<%= link_to_help('pseud-icon-comment') %>
<%= link_to_help("pseud-icon-comment") %>
</dt>
<dd>
<%= f.text_field :icon_comment_text, class: "observe_textlength", disabled: logged_in_as_admin? %>
Expand Down
12 changes: 6 additions & 6 deletions app/views/users/_edit_header_navigation.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="navigation actions" role="navigation">
<li><%= span_if_current ts("Edit Profile"), edit_user_path(@user) %></li>
<li><%= span_if_current ts("Edit Default Pseud and Icon"), [:edit, @user, @user.default_pseud] %></li>
<li><%= span_if_current ts("Change User Name"), change_username_user_path(@user) %></li>
<li><%= span_if_current ts("Change Password"), change_password_user_path(@user) %></li>
<li><%= span_if_current ts("Change Email"), change_email_user_path(@user) %></li>
</ul>
<li><%= span_if_current t(".edit_profile"), edit_user_path(@user) %></li>
<li><%= span_if_current t(".edit_default_pseud_and_icon"), [:edit, @user, @user.default_pseud] %></li>
<li><%= span_if_current t(".change_username"), change_username_user_path(@user) %></li>
<li><%= span_if_current t(".change_password"), change_password_user_path(@user) %></li>
<li><%= span_if_current t(".change_email"), change_email_user_path(@user) %></li>
</ul>
12 changes: 6 additions & 6 deletions app/views/users/_edit_user_navigation.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="navigation actions" role="navigation">
<li><%= span_if_current ts("Edit My Profile"), edit_user_path(@user) %></li>
<li><%= span_if_current ts("Edit Default Pseud and Icon"), [:edit, @user, @user.default_pseud] %></li>
<li><%= span_if_current ts("Change User Name"), change_username_user_path(@user) %></li>
<li><%= span_if_current ts("Change Password"), change_password_user_path(@user) %></li>
<li><%= span_if_current ts("Change Email"), change_email_user_path(@user) %></li>
</ul>
<li><%= span_if_current t(".edit_my_profile"), edit_user_path(@user) %></li>
<li><%= span_if_current t(".edit_default_pseud_and_icon"), [:edit, @user, @user.default_pseud] %></li>
<li><%= span_if_current t(".change_username"), change_username_user_path(@user) %></li>
<li><%= span_if_current t(".change_password"), change_password_user_path(@user) %></li>
<li><%= span_if_current t(".change_email"), change_email_user_path(@user) %></li>
</ul>
6 changes: 3 additions & 3 deletions app/views/users/change_username.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

<%= form_tag changed_username_user_path(@user) do %>
<dl>
<dt><%= t(".current_user_name") %></dt>
<dt><%= t(".current_username") %></dt>
<dd><p class="important informational"><%= @user.login %></p></dd>
<dt><%= label_tag :new_login, t(".new_user_name") %></dt>
<dt><%= label_tag :new_login, t(".new_username") %></dt>
<dd>
<%= text_field_tag :new_login, @new_login, autocomplete: "off", "aria-describedby": "new-login-field-description" %>
<p class="footnote" id="new-login-field-description">
Expand All @@ -46,7 +46,7 @@
<dd><%= password_field_tag :password, nil, autocomplete: "disabled" %></dd>
<dt class="landmark"><%= t(".submit_landmark") %></dt>
<dd class="submit actions">
<%= submit_tag t(".change_user_name"), data: { confirm: t(".confirm") } %>
<%= submit_tag t(".change_username"), data: { confirm: t(".confirm") } %>
</dd>
</dl>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ en:
users:
changed_username:
admin:
successfully_updated: User name has been successfully updated.
successfully_updated: Username has been successfully updated.
user:
incorrect_password: Your password was incorrect
successfully_updated: Your user name has been successfully updated.
successfully_updated: Your username has been successfully updated.
contact_abuse: contact Policy & Abuse
passwords:
create:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ en:
skin/skin_parents:
parent_skin: Parent skin
user:
login: User name
login: Username
work:
chapter_total_display: Chapters
summary: Summary
Expand Down
Loading
Loading