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

Add explit admin actions to (re)subscribe/unsubscribe remote accounts #3640

Merged
merged 2 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 29 additions & 2 deletions app/controllers/admin/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,43 @@

module Admin
class AccountsController < BaseController
before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload]
before_action :require_remote_account!, only: [:subscribe, :unsubscribe, :redownload]

def index
@accounts = filtered_accounts.page(params[:page])
end

def show
@account = Account.find(params[:id])
def show; end

def subscribe
Pubsubhubbub::SubscribeWorker.perform_async(@account.id)
redirect_to admin_account_path(@account.id)
end

def unsubscribe
UnsubscribeService.new.call(@account)
redirect_to admin_account_path(@account.id)
end

def redownload
@account.avatar = @account.avatar_remote_url
@account.header = @account.header_remote_url
@account.save!

redirect_to admin_account_path(@account.id)
end

private

def set_account
@account = Account.find(params[:id])
end

def require_remote_account!
redirect_to admin_account_path(@account.id) if @account.local?
end

def filtered_accounts
AccountFilter.new(filter_params).results
end
Expand Down
16 changes: 5 additions & 11 deletions app/javascript/styles/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,13 @@

.report-status__actions {
flex: 0 0 auto;
position: relative;

.nsfw-button {
color: $white;
font-size: 11px;
width: 11px;
display: block;
}
display: flex;
flex-direction: column;

.trash-button {
position: absolute;
bottom: 10px;
.icon-button {
font-size: 24px;
width: 24px;
text-align: center;
margin-bottom: 10px;
}
}
10 changes: 8 additions & 2 deletions app/views/admin/accounts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@
%th= t('.targeted_reports')
%td= link_to pluralize(@account.targeted_reports.count, t('.report')), admin_reports_path(target_account_id: @account.id)

- if @account.local?
%div{ style: 'float: right' }

%div{ style: 'float: right' }
- if @account.local?
= link_to t('admin.accounts.reset_password'), admin_account_reset_path(@account.id), method: :create, class: 'button'
- if @account.user&.otp_required_for_login?
= link_to t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(@account.user.id), method: :delete, class: 'button'
- else
= link_to @account.subscribed? ? t('admin.accounts.resubscribe') : t('admin.accounts.subscribe'), subscribe_admin_account_path(@account.id), method: :post, class: 'button'
- if @account.subscribed?
= link_to t('admin.accounts.unsubscribe'), unsubscribe_admin_account_path(@account.id), method: :post, class: 'button negative'
= link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button'

%div{ style: 'float: left' }
- if @account.silenced?
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/reports/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
.entry= render partial: 'stream_entries/simple_status', locals: { status: status }
.report-status__actions
- unless status.media_attachments.empty?
= link_to admin_report_reported_status_path(@report, status, status: { sensitive: !status.sensitive }), method: :patch, class: 'nsfw-button', title: t("admin.reports.nsfw.#{!status.sensitive}") do
= t("admin.reports.nsfw.#{!status.sensitive}")
= link_to admin_report_reported_status_path(@report, status, status: { sensitive: !status.sensitive }), method: :patch, class: 'icon-button nsfw-button', title: t("admin.reports.nsfw.#{!status.sensitive}") do
= fa_icon status.sensitive? ? 'eye' : 'eye-slash'
= link_to admin_report_reported_status_path(@report, status), method: :delete, class: 'icon-button trash-button', title: t('admin.reports.delete'), data: { confirm: t('admin.reports.are_you_sure') } do
= fa_icon 'trash'

Expand Down
16 changes: 8 additions & 8 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ ca:
account_count: Comptes coneguts
domain_name: Domini
title: Instàncies conegudes
subscriptions:
callback_url: Callback URL
confirmed: Confirmat
expires_in: Expira en
last_delivery: Últim lliurament
title: PubSubHubbub
topic: Tòpic
reports:
are_you_sure: Estàs segur?
comment:
Expand Down Expand Up @@ -186,6 +179,13 @@ ca:
title: Descripció estesa del lloc
site_title: Títol del lloc
title: Configuració del lloc
subscriptions:
callback_url: Callback URL
confirmed: Confirmat
expires_in: Expira en
last_delivery: Últim lliurament
title: PubSubHubbub
topic: Tòpic
title: Administració
application_mailer:
settings: 'Canviar preferències de correu: %{link}'
Expand Down Expand Up @@ -263,7 +263,7 @@ ca:
following: Llista de seguits
muting: Llista d'apagats
upload: Carregar
landing_strip_html: <strong>%{name}</strong> és un usuari/a de %{link_to_root_path}. Pots seguir-lo/la o interactuar amb ell/a si tens un compte a qualsevol node del fediverse.
landing_strip_html: "<strong>%{name}</strong> és un usuari/a de %{link_to_root_path}. Pots seguir-lo/la o interactuar amb ell/a si tens un compte a qualsevol node del fediverse."
landing_strip_signup_html: Si no en tens, pots <a href="%{sign_up_path}">registrar-te aquí</a>.
media_attachments:
validations:
Expand Down
18 changes: 9 additions & 9 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,14 @@ de:
account_count: Bekannte Konten
domain_name: Domain
title: Bekannte Instanzen
subscriptions:
callback_url: Callback-URL
confirmed: Bestätigt
expires_in: Verfällt in
last_delivery: Letzte Zustellung
title: PubSubHubbub
topic: Thema
reports:
comment:
label: Kommentar
none: Kein
delete: Löschen
id: ID
mark_as_resolved: Als gelöst markieren
report: '#%{id} melden'
report: "#%{id} melden"
reported_account: Gemeldetes Konto
reported_by: Gemeldet von
resolved: Gelöst
Expand Down Expand Up @@ -166,6 +159,13 @@ de:
title: Erweiterte Seitenbeschreibung
site_title: Seitentitel
title: Seiteneinstellungen
subscriptions:
callback_url: Callback-URL
confirmed: Bestätigt
expires_in: Verfällt in
last_delivery: Letzte Zustellung
title: PubSubHubbub
topic: Thema
title: Administration
application_mailer:
settings: 'E-Mail-Einstellungen ändern: %{link}'
Expand Down Expand Up @@ -229,7 +229,7 @@ de:
following: Folgeliste
muting: Stummschaltungsliste
upload: Hochladen
landing_strip_html: <strong>%{name}</strong> ist ein Benutzer auf %{link_to_root_path}. Du kannst ihm folgen oder mit ihm interagieren, sofern du ein Konto irgendwo in der Fediverse hast.
landing_strip_html: "<strong>%{name}</strong> ist ein Benutzer auf %{link_to_root_path}. Du kannst ihm folgen oder mit ihm interagieren, sofern du ein Konto irgendwo in der Fediverse hast."
landing_strip_signup_html: Wenn nicht, kannst du dich <a href="%{sign_up_path}">hier anmelden</a>.
media_attachments:
validations:
Expand Down
30 changes: 17 additions & 13 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ en:
people_who_follow: People who follow %{name}
posts: Posts
remote_follow: Remote follow
unfollow: Unfollow
reserved_username: The username is reserved
unfollow: Unfollow
activitypub:
activity:
announce:
Expand Down Expand Up @@ -86,8 +86,10 @@ en:
profile_url: Profile URL
public: Public
push_subscription_expires: PuSH subscription expires
redownload: Refresh avatar
reset: Reset
reset_password: Reset password
resubscribe: Resubscribe
salmon_url: Salmon URL
search: Search
show:
Expand All @@ -96,9 +98,11 @@ en:
targeted_reports: Reports made about this account
silence: Silence
statuses: Statuses
subscribe: Subscribe
title: Accounts
undo_silenced: Undo silence
undo_suspension: Undo suspension
unsubscribe: Unsubscribe
username: Username
web: Web
domain_blocks:
Expand Down Expand Up @@ -135,20 +139,17 @@ en:
account_count: Known accounts
domain_name: Domain
title: Known Instances
subscriptions:
callback_url: Callback URL
confirmed: Confirmed
expires_in: Expires in
last_delivery: Last delivery
title: PubSubHubbub
topic: Topic
reports:
are_you_sure: Are you sure?
comment:
label: Comment
none: None
delete: Delete
id: ID
mark_as_resolved: Mark as resolved
nsfw:
'false': Unhide media attachments
'true': Hide media attachments
report: 'Report #%{id}'
report_contents: Contents
reported_account: Reported account
Expand All @@ -161,10 +162,6 @@ en:
title: Reports
unresolved: Unresolved
view: View
nsfw:
'true': NSFW ON
'false': NSFW OFF
are_you_sure: Are you sure?
settings:
contact_information:
email: Enter a public e-mail address
Expand All @@ -187,6 +184,13 @@ en:
title: Extended site description
site_title: Site title
title: Site Settings
subscriptions:
callback_url: Callback URL
confirmed: Confirmed
expires_in: Expires in
last_delivery: Last delivery
title: PubSubHubbub
topic: Topic
title: Administration
application_mailer:
settings: 'Change e-mail preferences: %{link}'
Expand Down Expand Up @@ -265,7 +269,7 @@ en:
following: Following list
muting: Muting list
upload: Upload
landing_strip_html: <strong>%{name}</strong> is a user on %{link_to_root_path}. You can follow them or interact with them if you have an account anywhere in the fediverse.
landing_strip_html: "<strong>%{name}</strong> is a user on %{link_to_root_path}. You can follow them or interact with them if you have an account anywhere in the fediverse."
landing_strip_signup_html: If you don't, you can <a href="%{sign_up_path}">sign up here</a>.
media_attachments:
validations:
Expand Down
32 changes: 16 additions & 16 deletions config/locales/fa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fa:
about_this: دربارهٔ این سرور
apps: برنامه‌ها
business_email: 'ایمیل کاری:'
closed_registrations: "امکان ثبت نام روی این سرور هم‌اینک فعال نیست."
closed_registrations: امکان ثبت نام روی این سرور هم‌اینک فعال نیست.
contact: تماس
description_headline: "%{domain} چیست؟"
domain_count_after: سرور دیگر
Expand Down Expand Up @@ -47,8 +47,8 @@ fa:
create:
name: "%{account_name} یادداشتی نوشت."
outbox:
name: "صندوق خروجی %{account_name}"
summary: "مجموعه‌ای از فعالیت‌های کاربر %{account_name}."
name: صندوق خروجی %{account_name}
summary: مجموعه‌ای از فعالیت‌های کاربر %{account_name}.
admin:
accounts:
are_you_sure: آیا مطمئن هستید؟
Expand Down Expand Up @@ -118,7 +118,7 @@ fa:
show:
affected_accounts:
one: روی یک حساب در پایگاه داده تأثیر گذاشت
other: "روی %{count} حساب در پایگاه داده تأثیر گذاشت"
other: روی %{count} حساب در پایگاه داده تأثیر گذاشت
retroactive:
silence: بی‌صداشدن همهٔ حساب‌های این دامین را لغو کن
suspend: معلق‌شدن همهٔ حساب‌های این دامین را لغو کن
Expand All @@ -130,13 +130,6 @@ fa:
account_count: حساب‌های شناخته‌شده
domain_name: دامین
title: سرورهای شناخته‌شده
subscriptions:
callback_url: نشانی Callback
confirmed: تأییدشده
expires_in: مهلت انقضا
last_delivery: آخرین ارسال
title: PubSubHubbub
topic: موضوع
reports:
comment:
label: توضیح
Expand Down Expand Up @@ -178,6 +171,13 @@ fa:
title: اطلاعات بیشتر دربارهٔ سایت
site_title: نام سایت
title: تنظیمات سایت
subscriptions:
callback_url: نشانی Callback
confirmed: تأییدشده
expires_in: مهلت انقضا
last_delivery: آخرین ارسال
title: PubSubHubbub
topic: موضوع
title: مدیریت
application_mailer:
settings: 'تغییر تنظیمات ایمیل: %{link}'
Expand Down Expand Up @@ -255,7 +255,7 @@ fa:
following: فهرست پی‌گیری‌ها
muting: فهرست بی‌صداشده‌ها
upload: بارگذاری
landing_strip_html: <strong>%{name}</strong> کاربری روی %{link_to_root_path} است. شما با داشتن حساب روی هر سروری می‌توانید نوشته‌های او را پیگیری کرده یا با او ارتباط داشته باشید.
landing_strip_html: "<strong>%{name}</strong> کاربری روی %{link_to_root_path} است. شما با داشتن حساب روی هر سروری می‌توانید نوشته‌های او را پیگیری کرده یا با او ارتباط داشته باشید."
landing_strip_signup_html: اگر هنوز حسابی ندارید <a href="%{sign_up_path}">این‌جا حساب باز کنید</a>.
media_attachments:
validations:
Expand All @@ -272,7 +272,7 @@ fa:
one: "یک اعلان تازه از زمان آخرین بازدید شما \U0001F418"
other: "%{count} اعلان تازه از زمان آخرین بازدید شما \U0001F418"
favourite:
body: '%{name} این نوشتهٔ شما را پسندید:'
body: "%{name} این نوشتهٔ شما را پسندید:"
subject: "%{name} نوشتهٔ شما را پسندید"
follow:
body: "%{name} هم‌اینک پیگیر شماست!"
Expand All @@ -281,10 +281,10 @@ fa:
body: "%{name} می‌خواهد پیگیر نوشته‌های شما باشد"
subject: 'منتظر پیگیری: %{name}'
mention:
body: '%{name} در این‌جا از شما نام برد:'
subject: '%{name} از شما نام برد'
body: "%{name} در این‌جا از شما نام برد:"
subject: "%{name} از شما نام برد"
reblog:
body: '%{name} نوشتهٔ شما را بازبوقید:'
body: "%{name} نوشتهٔ شما را بازبوقید:"
subject: "%{name} نوشتهٔ شما را بازبوقید"
pagination:
next: بعدی
Expand Down
Loading