Add "signed in as" header to some pages (#4523)

pull/4511/head^2
Eugen Rochko 2017-08-05 04:24:58 +02:00 committed by GitHub
parent 029786442a
commit df605f0f8b
40 changed files with 105 additions and 57 deletions

View File

@ -43,6 +43,10 @@ class ApplicationController < ActionController::Base
forbidden if current_user.account.suspended?
end
def after_sign_out_path_for(_resource_or_scope)
new_user_session_path
end
protected
def forbidden

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class AuthorizeFollowsController < ApplicationController
layout 'public'
layout 'modal'
before_action :authenticate_user!

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class RemoteFollowController < ApplicationController
layout 'public'
layout 'modal'
before_action :set_account
before_action :gone, if: :suspended_account?

View File

@ -47,7 +47,7 @@ body {
padding: 0;
}
@media screen and (max-width: 360px) {
@media screen and (max-width: 400px) {
padding-bottom: 0;
}
}

View File

@ -13,8 +13,9 @@
margin: 100px auto;
margin-bottom: 50px;
@media screen and (max-width: 360px) {
@media screen and (max-width: 400px) {
margin: 30px auto;
margin-bottom: 20px;
}
h1 {
@ -42,3 +43,54 @@
}
}
}
.account-header {
width: 400px;
margin: 0 auto;
display: flex;
font-size: 13px;
line-height: 18px;
box-sizing: border-box;
padding: 20px 0;
padding-bottom: 0;
margin-bottom: -30px;
margin-top: 40px;
@media screen and (max-width: 400px) {
width: 100%;
margin: 0;
margin-bottom: 10px;
padding: 20px;
padding-bottom: 0;
}
.avatar {
width: 40px;
height: 40px;
margin-right: 8px;
img {
width: 100%;
height: 100%;
display: block;
margin: 0;
border-radius: 4px;
}
}
.name {
flex: 1 1 auto;
color: $ui-secondary-color;
.username {
display: block;
font-weight: 500;
}
}
.logout-link {
display: block;
font-size: 32px;
line-height: 40px;
}
}

View File

@ -317,7 +317,7 @@ code {
}
.flash-message {
background: $ui-base-color;
background: lighten($ui-base-color, 8%);
color: $ui-primary-color;
border-radius: 4px;
padding: 15px 10px;

View File

@ -3,10 +3,9 @@
.form-container
.follow-prompt
%h2= t('authorize_follow.prompt_html', self: current_account.username)
= render 'card', account: @account
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
= hidden_field_tag :acct, @account.acct
= button_tag t('authorize_follow.follow'), type: :submit
- unless current_account.following?(@account)
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
= hidden_field_tag :acct, @account.acct
= button_tag t('authorize_follow.follow'), type: :submit

View File

@ -0,0 +1,16 @@
- content_for :header_tags do
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
- content_for :content do
- if user_signed_in?
.account-header
.avatar= image_tag current_account.avatar.url(:original)
.name
= t 'users.signed_in_as'
%span.username @#{current_account.local_username_and_domain}
= link_to destroy_user_session_path, method: :delete, class: 'logout-link icon-button' do
= fa_icon 'sign-out'
.container= yield
= render template: 'layouts/application'

View File

@ -81,7 +81,7 @@ module Mastodon
config.middleware.use Rack::Deflater
config.to_prepare do
Doorkeeper::AuthorizationsController.layout 'public'
Doorkeeper::AuthorizationsController.layout 'modal'
Doorkeeper::AuthorizedApplicationsController.layout 'admin'
Doorkeeper::Application.send :include, ApplicationExtension
end

View File

@ -34,6 +34,11 @@ Doorkeeper.configure do
# https://github.com/doorkeeper-gem/doorkeeper#custom-access-token-generator
# access_token_generator "::Doorkeeper::JWT"
# The controller Doorkeeper::ApplicationController inherits from.
# Defaults to ActionController::Base.
# https://github.com/doorkeeper-gem/doorkeeper#custom-base-controller
base_controller 'ApplicationController'
# Reuse access token for the same resource owner within an application (disabled by default)
# Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
reuse_access_token

View File

@ -43,7 +43,6 @@ ar:
authorize_follow:
error: Unfortunately, there was an error looking up the remote account
follow: إتبع
prompt_html: 'You (<strong>%{self}</strong>) have requested to follow:'
title: إتباع %{acct}
datetime:
distance_in_words:

View File

@ -43,7 +43,6 @@ bg:
authorize_follow:
error: Възникна грешка в откриването на потребителя
follow: Последвай
prompt_html: "(<strong>%{self}</strong>), молбата ти беше изпратена до:"
title: Последвай %{acct}
datetime:
distance_in_words:

View File

@ -185,7 +185,6 @@ ca:
authorize_follow:
error: Malauradament, ha ocorregut un error buscant el compte remot
follow: Seguir
prompt_html: 'Tú (<strong>%{self}</strong>) has solicitat seguir:'
title: Seguir %{acct}
datetime:
distance_in_words:

View File

@ -166,7 +166,6 @@ de:
authorize_follow:
error: Das Profil konnte nicht geladen werden
follow: Folgen
prompt_html: 'Du (<strong>%{self}</strong>) möchtest dieser Person folgen:'
title: "%{acct} folgen"
datetime:
distance_in_words:

View File

@ -215,7 +215,7 @@ en:
body: "%{reporter} has reported %{target}"
subject: New report for %{instance} (#%{id})
application_mailer:
salutation: '%{name},'
salutation: "%{name},"
settings: 'Change e-mail preferences: %{link}'
signature: Mastodon notifications from %{instance}
view: 'View:'
@ -228,13 +228,13 @@ en:
delete_account_html: If you wish to delete your account, you can <a href="%{path}">proceed here</a>. You will be asked for confirmation.
didnt_get_confirmation: Didn't receive confirmation instructions?
forgot_password: Forgot your password?
invalid_reset_password_token: Password reset link is invalid or expired. Please try again.
login: Log in
logout: Logout
register: Sign up
resend_confirmation: Resend confirmation instructions
reset_password: Reset password
set_new_password: Set new password
invalid_reset_password_token: Password reset link is invalid or expired. Please try again.
authorize_follow:
error: Unfortunately, there was an error looking up the remote account
follow: Follow
@ -244,7 +244,6 @@ en:
close: Or, you can just close this window.
return: Return to the user's profile
web: Go to web
prompt_html: 'You (<strong>%{self}</strong>) have requested to follow:'
title: Follow %{acct}
datetime:
distance_in_words:
@ -524,3 +523,4 @@ en:
users:
invalid_email: The e-mail address is invalid
invalid_otp_token: Invalid two-factor code
signed_in_as: 'Signed in as:'

View File

@ -42,7 +42,6 @@ eo:
authorize_follow:
error: Bedaŭrinde, okazis eraro provante konsulti la foran konton
follow: Sekvi
prompt_html: 'Vi (<strong>%{self}</strong>) petis sekvi:'
title: Sekvi %{acct}
datetime:
distance_in_words:

View File

@ -43,7 +43,6 @@ es:
authorize_follow:
error: Desafortunadamente, ha ocurrido un error buscando la cuenta remota
follow: Seguir
prompt_html: 'Tú (<strong>%{self}</strong>) has solicitado seguir:'
title: Seguir %{acct}
datetime:
distance_in_words:

View File

@ -212,10 +212,10 @@ fa:
title: مدیریت
admin_mailer:
new_report:
body: "کاربر %{reporter} کاربر %{target} را گزارش داد"
body: کاربر %{reporter} کاربر %{target} را گزارش داد
subject: گزارش تازه‌ای برای %{instance} (#%{id})
application_mailer:
salutation: '%{name},'
salutation: "%{name},"
settings: 'تغییر تنظیمات ایمیل: %{link}'
signature: اعلان‌های ماستدون از %{instance}
view: 'نمایش:'
@ -243,7 +243,6 @@ fa:
close: یا این پنجره را ببندید.
return: به نمایهٔ این کاربر بازگردید
web: رفتن به وب
prompt_html: 'شما (<strong>%{self}</strong>) می‌خواهید این حساب را پی بگیرید:'
title: پیگیری %{acct}
datetime:
distance_in_words:
@ -500,7 +499,7 @@ fa:
<p>این نوشته تحت اجازه‌نامهٔ CC-BY-SA قرار دارد. تاریخ آخرین به‌روزرسانی آن ۱۰ خرداد ۱۳۹۲ است.</p>
<p>این نوشته اقتباسی است از <a href="https://github.com/discourse/discourse">سیاست رازداری Discourse</a>.</p>
title: "شرایط استفاده و سیاست رازداری %{instance}"
title: شرایط استفاده و سیاست رازداری %{instance}
time:
formats:
default: "%d %b %Y, %H:%M"

View File

@ -42,7 +42,6 @@ fi:
authorize_follow:
error: Valitettavasti tapahtui virhe etätilin haussa.
follow: Seuraa
prompt_html: 'Sinä (<strong>%{self}</strong>) olet pyytänyt lupaa seurata:'
title: Seuraa %{acct}
datetime:
distance_in_words:

View File

@ -235,7 +235,6 @@ fr:
close: Ou bien, vous pouvez fermer cette fenêtre.
return: Retour au profil de l'utilisateur⋅trice
web: Retour à l'interface web
prompt_html: 'Vous (<strong>%{self}</strong>) avez demandé à suivre:'
title: Suivre %{acct}
datetime:
distance_in_words:

View File

@ -177,7 +177,6 @@ he:
authorize_follow:
error: למרבה הצער, היתה שגיאה בחיפוש החשבון המרוחק
follow: לעקוב
prompt_html: 'בקשת מעקב ממך (<strong>%{self}</strong>) אחרי:'
title: לעקוב אחרי %{acct}
datetime:
distance_in_words:

View File

@ -43,7 +43,6 @@ hr:
authorize_follow:
error: Nažalost, došlo je do greške looking up the remote račun
follow: Slijedi
prompt_html: 'Ti si (<strong>%{self}</strong>) poslao zahtjev za sljeđenje:'
title: Slijedi %{acct}
datetime:
distance_in_words:

View File

@ -168,7 +168,6 @@ id:
authorize_follow:
error: Sayangnya, ada error saat melihat akun remote
follow: Ikuti
prompt_html: 'Anda (<strong>%{self}</strong>) telah diminta untuk mengikuti:'
title: Mengikuti %{acct}
datetime:
distance_in_words:

View File

@ -166,7 +166,6 @@ io:
authorize_follow:
error: Regretinde, eventis eraro probante konsultar la fora konto
follow: Sequar
prompt_html: 'Tu (<strong>%{self}</strong>) demandis sequar:'
title: Sequar %{acct}
datetime:
distance_in_words:

View File

@ -43,7 +43,6 @@ it:
authorize_follow:
error: Sfortunatamente c'è stato un errore nel consultare l'account remoto
follow: Segui
prompt_html: 'Tu, (<strong>%{self}</strong>), hai richiesto di seguire:'
title: Segui %{acct}
datetime:
distance_in_words:

View File

@ -242,7 +242,6 @@ ja:
close: またはこのウィンドウを閉じます
return: ユーザーのプロフィールに戻る
web: Web を開く
prompt_html: 'あなた(<strong>%{self}</strong>)は以下のアカウントのフォローをリクエストしました:'
title: "%{acct} をフォロー"
datetime:
distance_in_words:

View File

@ -189,7 +189,6 @@ ko:
authorize_follow:
error: 리모트 팔로우 도중 오류가 발생했습니다.
follow: 팔로우
prompt_html: '나(<strong>%{self}</strong>) 는 아래 계정의 팔로우를 요청했습니다:'
title: "%{acct} 를 팔로우"
datetime:
distance_in_words:

View File

@ -106,7 +106,7 @@ nl:
domain: Domein
new:
create: Blokkade aanmaken
hint: Een domeinblokkade voorkomt niet dat accountgegevens van dit domein aan de database worden toegevoegd, maar dat er met terugwerkende kracht en automatisch bepaalde moderatiemethoden op deze accounts worden toegepast.
hint: Een domeinblokkade voorkomt niet dat accountgegevens van dit domein aan de database worden toegevoegd, maar dat er met terugwerkende kracht en automatisch bepaalde moderatiemethoden op deze accounts worden toegepast.
severity:
desc_html: "<strong>Negeren</strong> zorgt ervoor dat berichten van accounts van dit domein voor iedereen onzichtbaar zijn, behalve als een account wordt gevolgd. <strong>Opschorten</strong> zorgt ervoor dat alle berichten, media en profielgegevens van accounts van dit domein worden verwijderd. Gebruik <strong>Geen</strong> wanneer je alleen mediabestanden wilt weigeren."
noop: Geen
@ -129,7 +129,7 @@ nl:
suspend: Alle opgeschorste accounts van dit domein niet meer opschorten
title: Domeinblokkade voor %{domain} ongedaan maken
undo: Ongedaan maken
title: Domeinblokkades
title: Domeinblokkades
undo: Ongedaan maken
instances:
account_count: Bekende accounts
@ -169,7 +169,7 @@ nl:
title: Bericht wanneer registratie is uitgeschakeld
deletion:
desc_html: Toestaan dat iedereen hun eigen account kan verwijderen
title: Verwijderen account toestaan
title: Verwijderen account toestaan
open:
desc_html: Toestaan dat iedereen een account kan registereren
title: Open registratie
@ -241,7 +241,6 @@ nl:
close: Of je kan dit venster gewoon sluiten.
return: Ga terug naar het profiel van de gebruiker
web: Ga naar de webapp
prompt_html: 'Je (<strong>%{self}</strong>) hebt toestemming gevraagd om iemand te mogen volgen:'
title: Volg %{acct}
datetime:
distance_in_words:
@ -307,7 +306,7 @@ nl:
following: Volglijst
muting: Negeerlijst
upload: Uploaden
landing_strip_html: <strong>%{name}</strong> is een gebruiker op %{link_to_root_path}. Je kunt deze volgen en ermee communiceren als je ergens in deze fediverse een account hebt.
landing_strip_html: "<strong>%{name}</strong> is een gebruiker op %{link_to_root_path}. Je kunt deze volgen en ermee communiceren als je ergens in deze fediverse een account hebt."
landing_strip_signup_html: Als je dat niet hebt, kun je je <a href="%{sign_up_path}">hier registreren</a>.
media_attachments:
validations:
@ -510,7 +509,7 @@ nl:
generate_recovery_codes: Herstelcodes genereren
instructions_html: "<strong>Scan deze QR-code in Google Authenticator of een soortgelijke app op jouw mobiele telefoon</strong>. Van nu af aan genereert deze app aanmeldcodes die je bij het aanmelden moet invoeren."
lost_recovery_codes: Met herstelcodes kun je toegang tot jouw account krijgen wanneer je jouw telefoon bent kwijtgeraakt. Wanneer je jouw herstelcodes bent kwijtgeraakt, kan je ze hier opnieuw genereren. Jouw oude herstelcodes zijn daarna ongeldig.
manual_instructions: 'Hieronder vind je de geheime code in platte tekst. Voor het geval je de QR-code niet kunt scannen en het handmatig moet invoeren.'
manual_instructions: Hieronder vind je de geheime code in platte tekst. Voor het geval je de QR-code niet kunt scannen en het handmatig moet invoeren.
recovery_codes: Herstelcodes back-uppen
recovery_codes_regenerated: Opnieuw genereren herstelcodes geslaagd
recovery_instructions_html: Wanneer je ooit de toegang verliest tot jouw telefoon, kan je met behulp van een van de herstelcodes hieronder opnieuw toegang krijgen tot jouw account. Zorg ervoor dat je de herstelcodes op een veilige plek bewaard. (Je kunt ze bijvoorbeeld printen en ze samen met andere belangrijke documenten bewaren.)

View File

@ -170,7 +170,6 @@
authorize_follow:
error: Uheldigvis så skjedde det en feil da vi prøvde å få tak i en bruker fra en annen instans.
follow: Følg
prompt_html: 'Du (<strong>%{self}</strong>) har spurt om å følge:'
title: Følg %{acct}
datetime:
distance_in_words:

View File

@ -31,7 +31,7 @@ oc:
status_count_after: estatuts
status_count_before: quan escrich
user_count_after: personas
user_count_before: Ostal de
user_count_before: Ostal de
what_is_mastodon: Ques Mastodon ?
accounts:
follow: Sègre
@ -243,7 +243,6 @@ oc:
close: O podètz tampar aquesta fenèstra.
return: Tornar al perfil
web: Tornar a linterfàcia Web
prompt_html: 'Avètz (<strong>%{self}</strong>) demandat de sègre :'
title: Sègre %{acct}
date:
abbr_day_names:

View File

@ -215,7 +215,7 @@ pl:
body: Użytkownik %{reporter} zgłosił %{target}
subject: Nowe zgłoszenie na %{instance} (#%{id})
application_mailer:
salutation: '%{name},'
salutation: "%{name},"
settings: 'Zmień ustawienia powiadamiania: %{link}'
signature: Powiadomienie Mastodona z instancji %{instance}
view: 'Zobacz:'
@ -243,7 +243,6 @@ pl:
close: Ewentualnie, możesz po prostu zamknąć tę stronę.
return: Powróć do strony użytkownika
web: Przejdź do sieci
prompt_html: 'Ty (<strong>%{self}</strong>) chcesz śledzić:'
title: Śledź %{acct}
datetime:
distance_in_words:

View File

@ -169,7 +169,6 @@ pt-BR:
authorize_follow:
error: Infelizmente houve um erro olhando uma conta remota
follow: Seguir
prompt_html: 'Você (<strong>%{self}</strong>) pediu pra seguir:'
title: Seguir %{acct}
datetime:
distance_in_words:

View File

@ -162,7 +162,6 @@ ru:
authorize_follow:
error: К сожалению, при поиске удаленного аккаунта возникла ошибка
follow: Подписаться
prompt_html: 'Вы (<strong>%{self}</strong>) запросили подписку:'
title: Подписаться на %{acct}
datetime:
distance_in_words:
@ -269,14 +268,14 @@ ru:
truncate: "&hellip;"
push_notifications:
favourite:
title: "Ваш статус понравился %{name}"
title: Ваш статус понравился %{name}
follow:
title: "%{name} теперь подписан(а) на Вас"
mention:
action_boost: Продвинуть
action_expand: Развернуть
action_favourite: Нравится
title: "Вас упомянул(а) %{name}"
title: Вас упомянул(а) %{name}
reblog:
title: "%{name} продвинул(а) Ваш статус"
subscribed:
@ -351,7 +350,7 @@ ru:
reblogged: продвинул(а)
sensitive_content: Чувствительный контент
terms:
title: "Условия обслуживания и политика конфиденциальности %{instance}"
title: Условия обслуживания и политика конфиденциальности %{instance}
time:
formats:
default: "%b %d, %Y, %H:%M"

View File

@ -170,7 +170,6 @@ th:
authorize_follow:
error: Unfortunately, there was an error looking up the remote account
follow: ติดตาม
prompt_html: 'คุณ (<strong>%{self}</strong>) ขอติดตาม:'
title: ติดตาม %{acct}
datetime:
distance_in_words:

View File

@ -169,7 +169,6 @@ tr:
authorize_follow:
error: Uzak hesap aranırken bir hata oluştu.
follow: Takip et
prompt_html: 'Siz (<strong>%{self}</strong>) bu kullanıcıyı takip etmek istiyor musunuz?:'
title: "%{acct}'i takip et"
datetime:
distance_in_words:

View File

@ -160,7 +160,6 @@ uk:
authorize_follow:
error: На жаль, при пошуку віддаленого аккаунту виникла помилка
follow: Підписатися
prompt_html: 'Ви (<strong>%{self}</strong>) запитали про підписку:'
title: Підписатися на %{acct}
datetime:
distance_in_words:

View File

@ -176,7 +176,6 @@ zh-CN:
authorize_follow:
error: 对不起,寻找这个跨站用户时出错
follow: 关注
prompt_html: 你 (<strong>%{self}</strong>) 正准备关注︰
title: 关注 %{acct}
datetime:
distance_in_words:

View File

@ -169,7 +169,6 @@ zh-HK:
authorize_follow:
error: 對不起,尋找這個跨站用戶的過程發生錯誤
follow: 關注
prompt_html: 你 (<strong>%{self}</strong>) 正準備關注︰
title: 關注 %{acct}
datetime:
distance_in_words:

View File

@ -140,7 +140,6 @@ zh-TW:
authorize_follow:
error: 對不起,尋找這個跨站使用者的過程發生錯誤
follow: 關注
prompt_html: 您 (<strong>%{self}</strong>) 正準備關注︰
title: 關注 %{acct}
datetime:
distance_in_words:

View File

@ -28,7 +28,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
sign_in(user, scope: :user)
delete :destroy
expect(response).to redirect_to(root_path)
expect(response).to redirect_to(new_user_session_path)
end
end
@ -38,7 +38,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
sign_in(user, scope: :user)
delete :destroy
expect(response).to redirect_to(root_path)
expect(response).to redirect_to(new_user_session_path)
end
end
end