Merge commit '2954279e9c630a9d146575bf600978dc6c5279bd' into glitch-soc/merge-upstream
This commit is contained in:
commit
15bc13c65b
22 changed files with 200 additions and 67 deletions
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
|||
20.10
|
||||
20.11
|
||||
|
|
5
Gemfile
5
Gemfile
|
@ -39,9 +39,8 @@ end
|
|||
|
||||
gem 'net-ldap', '~> 0.18'
|
||||
|
||||
# TODO: Point back at released omniauth-cas gem when PR merged
|
||||
# https://github.com/dlindahl/omniauth-cas/pull/68
|
||||
gem 'omniauth-cas', github: 'stanhu/omniauth-cas', ref: '4211e6d05941b4a981f9a36b49ec166cecd0e271'
|
||||
# TODO: Point back at released omniauth-cas gem when new version is released
|
||||
gem 'omniauth-cas', github: 'dlindahl/omniauth-cas', ref: '9d9d3a91b316c55d49ab6e621977f2067010c5bf'
|
||||
gem 'omniauth-saml', '~> 2.0'
|
||||
gem 'omniauth_openid_connect', '~> 0.6.1'
|
||||
gem 'omniauth', '~> 2.0'
|
||||
|
|
20
Gemfile.lock
20
Gemfile.lock
|
@ -7,6 +7,16 @@ GIT
|
|||
hkdf (~> 0.2)
|
||||
jwt (~> 2.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/dlindahl/omniauth-cas.git
|
||||
revision: 9d9d3a91b316c55d49ab6e621977f2067010c5bf
|
||||
ref: 9d9d3a91b316c55d49ab6e621977f2067010c5bf
|
||||
specs:
|
||||
omniauth-cas (3.0.0)
|
||||
addressable (~> 2.8)
|
||||
nokogiri (~> 1.12)
|
||||
omniauth (~> 2.1)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/jhawthorn/nsa.git
|
||||
revision: e020fcc3a54d993ab45b7194d89ab720296c111b
|
||||
|
@ -18,16 +28,6 @@ GIT
|
|||
sidekiq (>= 3.5)
|
||||
statsd-ruby (~> 1.4, >= 1.4.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/stanhu/omniauth-cas.git
|
||||
revision: 4211e6d05941b4a981f9a36b49ec166cecd0e271
|
||||
ref: 4211e6d05941b4a981f9a36b49ec166cecd0e271
|
||||
specs:
|
||||
omniauth-cas (2.0.0)
|
||||
addressable (~> 2.3)
|
||||
nokogiri (~> 1.5)
|
||||
omniauth (>= 1.2, < 3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
|
|
@ -4,4 +4,60 @@ module Admin::SettingsHelper
|
|||
def captcha_available?
|
||||
ENV['HCAPTCHA_SECRET_KEY'].present? && ENV['HCAPTCHA_SITE_KEY'].present?
|
||||
end
|
||||
|
||||
def login_activity_title(activity)
|
||||
t(
|
||||
"login_activities.#{login_activity_key(activity)}",
|
||||
method: login_activity_method(activity),
|
||||
ip: login_activity_ip(activity),
|
||||
browser: login_activity_browser(activity)
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def login_activity_key(activity)
|
||||
activity.success? ? 'successful_sign_in_html' : 'failed_sign_in_html'
|
||||
end
|
||||
|
||||
def login_activity_method(activity)
|
||||
content_tag(
|
||||
:span,
|
||||
login_activity_method_string(activity),
|
||||
class: 'target'
|
||||
)
|
||||
end
|
||||
|
||||
def login_activity_ip(activity)
|
||||
content_tag(
|
||||
:span,
|
||||
activity.ip,
|
||||
class: 'target'
|
||||
)
|
||||
end
|
||||
|
||||
def login_activity_browser(activity)
|
||||
content_tag(
|
||||
:span,
|
||||
login_activity_browser_description(activity),
|
||||
class: 'target',
|
||||
title: activity.user_agent
|
||||
)
|
||||
end
|
||||
|
||||
def login_activity_method_string(activity)
|
||||
if activity.omniauth?
|
||||
t("auth.providers.#{activity.provider}")
|
||||
else
|
||||
t("login_activities.authentication_methods.#{activity.authentication_method}")
|
||||
end
|
||||
end
|
||||
|
||||
def login_activity_browser_description(activity)
|
||||
t(
|
||||
'sessions.description',
|
||||
browser: t(activity.browser, scope: 'sessions.browsers', default: activity.browser.to_s),
|
||||
platform: t(activity.platform, scope: 'sessions.platforms', default: activity.platform.to_s)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,19 @@ module SettingsHelper
|
|||
LanguagesHelper.sorted_locale_keys(I18n.available_locales)
|
||||
end
|
||||
|
||||
def featured_tags_hint(recently_used_tags)
|
||||
safe_join(
|
||||
[
|
||||
t('simple_form.hints.featured_tag.name'),
|
||||
safe_join(
|
||||
links_for_featured_tags(recently_used_tags),
|
||||
', '
|
||||
),
|
||||
],
|
||||
' '
|
||||
)
|
||||
end
|
||||
|
||||
def session_device_icon(session)
|
||||
device = session.detection.device
|
||||
|
||||
|
@ -28,4 +41,18 @@ module SettingsHelper
|
|||
safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def links_for_featured_tags(tags)
|
||||
tags.map { |tag| post_link_to_featured_tag(tag) }
|
||||
end
|
||||
|
||||
def post_link_to_featured_tag(tag)
|
||||
link_to(
|
||||
"##{tag.display_name}",
|
||||
settings_featured_tags_path(featured_tag: { name: tag.name }),
|
||||
method: :post
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"about.blocks": "Servijerioù habaskaet",
|
||||
"about.blocks": "Servijerioù evezhiet",
|
||||
"about.contact": "Darempred :",
|
||||
"about.disclaimer": "Mastodon zo ur meziant frank, open-source hag ur merk marilhet eus Mastodon gGmbH.",
|
||||
"about.domain_blocks.no_reason_available": "Abeg dihegerz",
|
||||
|
@ -22,6 +22,7 @@
|
|||
"account.browse_more_on_origin_server": "Furchal pelloc'h war ar profil orin",
|
||||
"account.cancel_follow_request": "Nullañ ar reked heuliañ",
|
||||
"account.copy": "Eilañ al liamm war-zu ho profil",
|
||||
"account.direct": "Menegiñ @{name} ent-prevez",
|
||||
"account.disable_notifications": "Paouez d'am c'hemenn pa vez embannet traoù gant @{name}",
|
||||
"account.domain_blocked": "Domani stanket",
|
||||
"account.edit_profile": "Kemmañ ar profil",
|
||||
|
@ -68,6 +69,7 @@
|
|||
"account.unendorse": "Paouez da lakaat war-wel war ar profil",
|
||||
"account.unfollow": "Diheuliañ",
|
||||
"account.unmute": "Diguzhat @{name}",
|
||||
"account.unmute_notifications_short": "Diguzhat ar c'hemennoù",
|
||||
"account.unmute_short": "Diguzhat",
|
||||
"account_note.placeholder": "Klikit evit ouzhpennañ un notenn",
|
||||
"admin.dashboard.daily_retention": "Feur azdalc'h an implijerien·ezed dre zeiz goude bezañ lakaet o anv",
|
||||
|
@ -75,6 +77,9 @@
|
|||
"admin.dashboard.retention.average": "Keidenn",
|
||||
"admin.dashboard.retention.cohort": "Miz an enrolladur",
|
||||
"admin.dashboard.retention.cohort_size": "Implijerien.erezed nevez",
|
||||
"admin.impact_report.instance_accounts": "Profiloù kontoù a vefe dilamet",
|
||||
"admin.impact_report.instance_followers": "Heulierien a gollfe hon implijerien",
|
||||
"admin.impact_report.instance_follows": "Heulierien a gollfe o implijerien",
|
||||
"alert.rate_limited.message": "Klaskit en-dro a-benn {retry_time, time, medium}.",
|
||||
"alert.rate_limited.title": "Feur bevennet",
|
||||
"alert.unexpected.message": "Ur fazi dic'hortozet zo degouezhet.",
|
||||
|
@ -105,6 +110,7 @@
|
|||
"column.blocks": "Implijer·ezed·ien berzet",
|
||||
"column.bookmarks": "Sinedoù",
|
||||
"column.community": "Red-amzer lec'hel",
|
||||
"column.direct": "Menegoù prevez",
|
||||
"column.directory": "Mont a-dreuz ar profiloù",
|
||||
"column.domain_blocks": "Domani berzet",
|
||||
"column.favourites": "Muiañ-karet",
|
||||
|
@ -348,6 +354,7 @@
|
|||
"lightbox.next": "Da-heul",
|
||||
"lightbox.previous": "A-raok",
|
||||
"limited_account_hint.action": "Diskouez an aelad memes tra",
|
||||
"limited_account_hint.title": "Kuzhet eo bet ar profil-mañ gant an evezhierien eus {domain}.",
|
||||
"link_preview.author": "Gant {name}",
|
||||
"lists.account.add": "Ouzhpennañ d'al listenn",
|
||||
"lists.account.remove": "Lemel kuit eus al listenn",
|
||||
|
@ -373,6 +380,7 @@
|
|||
"navigation_bar.bookmarks": "Sinedoù",
|
||||
"navigation_bar.community_timeline": "Red-amzer lec'hel",
|
||||
"navigation_bar.compose": "Skrivañ un toud nevez",
|
||||
"navigation_bar.direct": "Menegoù prevez",
|
||||
"navigation_bar.discover": "Dizoleiñ",
|
||||
"navigation_bar.domain_blocks": "Domanioù kuzhet",
|
||||
"navigation_bar.edit_profile": "Kemmañ ar profil",
|
||||
|
@ -452,6 +460,7 @@
|
|||
"onboarding.profile.note_hint": "Gallout a rit @menegiñ tud all pe #hashtagoù…",
|
||||
"onboarding.profile.save_and_continue": "Enrollañ ha kenderc'hel",
|
||||
"onboarding.profile.upload_avatar": "Enporzhiañ ur skeudenn profil",
|
||||
"onboarding.share.lead": "Roit da c'houzout d'an dud e c'hallont ho kavout war vMastondon!",
|
||||
"onboarding.share.message": "Me a zo {username} war #Mastodon! Heuilhit ac'hanon war {url}",
|
||||
"onboarding.share.title": "Skignañ ho profil",
|
||||
"onboarding.start.lead": "Your new Mastodon account is ready to go. Here's how you can make the most of it:",
|
||||
|
@ -465,6 +474,7 @@
|
|||
"onboarding.steps.setup_profile.title": "Customize your profile",
|
||||
"onboarding.steps.share_profile.body": "Let your friends know how to find you on Mastodon!",
|
||||
"onboarding.steps.share_profile.title": "Share your profile",
|
||||
"password_confirmation.mismatching": "Disheñvel eo an daou c'her-termen-se",
|
||||
"picture_in_picture.restore": "Adlakaat",
|
||||
"poll.closed": "Serret",
|
||||
"poll.refresh": "Azbevaat",
|
||||
|
@ -545,6 +555,7 @@
|
|||
"report_notification.categories.spam": "Spam",
|
||||
"report_notification.categories.violation": "Torradur da reolennoù ar servijer",
|
||||
"report_notification.open": "Digeriñ an disklêriadur",
|
||||
"search.no_recent_searches": "Klask nevez ebet",
|
||||
"search.placeholder": "Klask",
|
||||
"search.quick_action.account_search": "Profiloù a glot gant {x}",
|
||||
"search.quick_action.go_to_account": "Mont d'ar profil {x}",
|
||||
|
@ -572,8 +583,10 @@
|
|||
"server_banner.server_stats": "Stadegoù ar servijer :",
|
||||
"sign_in_banner.create_account": "Krouiñ ur gont",
|
||||
"sign_in_banner.sign_in": "Kevreañ",
|
||||
"status.admin_account": "Digeriñ etrefas evezherezh evit @{name}",
|
||||
"status.admin_status": "Digeriñ an toud e-barzh an etrefas evezherezh",
|
||||
"sign_in_banner.sso_redirect": "Kennaskañ pe lakaat hoc'h anv",
|
||||
"status.admin_account": "Digeriñ etrefas evezhiañ evit @{name}",
|
||||
"status.admin_domain": "Digeriñ an etrefas evezhiañ evit {domain}",
|
||||
"status.admin_status": "Digeriñ an embannadenn e-barzh an etrefas evezhiañ",
|
||||
"status.block": "Berzañ @{name}",
|
||||
"status.bookmark": "Ouzhpennañ d'ar sinedoù",
|
||||
"status.cancel_reblog_private": "Nac'hañ ar skignadenn",
|
||||
|
@ -581,6 +594,8 @@
|
|||
"status.copy": "Eilañ liamm ar c'hannad",
|
||||
"status.delete": "Dilemel",
|
||||
"status.detailed_status": "Gwel kaozeadenn munudek",
|
||||
"status.direct": "Menegiñ @{name} ent-prevez",
|
||||
"status.direct_indicator": "Meneg prevez",
|
||||
"status.edit": "Kemmañ",
|
||||
"status.edited": "Aozet {date}",
|
||||
"status.edited_x_times": "Edited {count, plural, one {# time} other {# times}}",
|
||||
|
@ -624,6 +639,7 @@
|
|||
"status.title.with_attachments": "{user} posted {attachmentCount, plural, one {an attachment} other {# attachments}}",
|
||||
"status.translate": "Treiñ",
|
||||
"status.translated_from_with": "Troet diwar {lang} gant {provider}",
|
||||
"status.uncached_media_warning": "Rakwel n'eo ket da gaout",
|
||||
"status.unmute_conversation": "Diguzhat ar gaozeadenn",
|
||||
"status.unpin": "Dispilhennañ eus ar profil",
|
||||
"subscribed_languages.save": "Enrollañ ar cheñchamantoù",
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
"account.go_to_profile": "Przejdź do profilu",
|
||||
"account.hide_reblogs": "Ukryj podbicia od @{name}",
|
||||
"account.in_memoriam": "Ku pamięci.",
|
||||
"account.joined_short": "Dołączony",
|
||||
"account.joined_short": "Dołączył(a)",
|
||||
"account.languages": "Zmień subskrybowane języki",
|
||||
"account.link_verified_on": "Własność tego odnośnika została potwierdzona {date}",
|
||||
"account.locked_info": "To konto jest prywatne. Właściciel ręcznie wybiera kto może go obserwować.",
|
||||
|
@ -492,7 +492,7 @@
|
|||
"onboarding.profile.save_and_continue": "Zapisz i kontynuuj",
|
||||
"onboarding.profile.title": "Ustawienia profilu",
|
||||
"onboarding.profile.upload_avatar": "Dodaj zdjęcie profilowe",
|
||||
"onboarding.profile.upload_header": "Dodaj zdjęcie nagłówkowe",
|
||||
"onboarding.profile.upload_header": "Dodaj banner profilu",
|
||||
"onboarding.share.lead": "Daj znać ludziom, jak mogą cię znaleźć na Mastodonie!",
|
||||
"onboarding.share.message": "Jestem {username} na #Mastodon! Śledź mnie tutaj {url}",
|
||||
"onboarding.share.next_steps": "Możliwe dalsze kroki:",
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
= fa_icon 'warning'
|
||||
.log-entry__content
|
||||
.log-entry__title
|
||||
= t(account_warning.action, scope: 'admin.strikes.actions', name: content_tag(:span, account_warning.account ? account_warning.account.username : I18n.t('admin.action_logs.deleted_account'), class: 'username'), target: content_tag(:span, account_warning.target_account.pretty_acct, class: 'target')).html_safe
|
||||
= t(account_warning.action,
|
||||
scope: 'admin.strikes.actions',
|
||||
name: content_tag(:span, account_warning.account ? account_warning.account.username : I18n.t('admin.action_logs.deleted_account'), class: 'username'),
|
||||
target: content_tag(:span, account_warning.target_account.pretty_acct, class: 'target')).html_safe
|
||||
.log-entry__timestamp
|
||||
%time.formatted{ datetime: account_warning.created_at.iso8601 }
|
||||
= l(account_warning.created_at)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
= image_tag action_log.account.avatar.url(:original), alt: '', width: 40, height: 40, class: 'avatar'
|
||||
.log-entry__content
|
||||
.log-entry__title
|
||||
= t("admin.action_logs.actions.#{action_log.action}_#{action_log.target_type.underscore}_html", name: content_tag(:span, action_log.account.username, class: 'username'), target: content_tag(:span, log_target(action_log), class: 'target'))
|
||||
= t "admin.action_logs.actions.#{action_log.action}_#{action_log.target_type.underscore}_html",
|
||||
name: content_tag(:span, action_log.account.username, class: 'username'),
|
||||
target: content_tag(:span, log_target(action_log), class: 'target')
|
||||
.log-entry__timestamp
|
||||
%time.formatted{ datetime: action_log.created_at.iso8601 }
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
= render_video_component(status, visible: false)
|
||||
- elsif status.ordered_media_attachments.first.audio?
|
||||
- audio = status.ordered_media_attachments.first
|
||||
= react_component :audio, src: audio.file.url(:original), height: 110, alt: audio.description, lang: status.language, duration: audio.file.meta.dig(:original, :duration)
|
||||
= react_component :audio,
|
||||
alt: audio.description,
|
||||
duration: audio.file.meta.dig(:original, :duration),
|
||||
height: 110,
|
||||
lang: status.language,
|
||||
src: audio.file.url(:original)
|
||||
- else
|
||||
= react_component :media_gallery, height: 343, sensitive: status.sensitive?, visible: false, lang: status.language, media: status.ordered_media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json }
|
||||
= react_component :media_gallery,
|
||||
height: 343,
|
||||
lang: status.language,
|
||||
media: status.ordered_media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json },
|
||||
sensitive: status.sensitive?,
|
||||
visible: false
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
.simple_form
|
||||
%h1.title= t('mail_subscriptions.unsubscribe.title')
|
||||
%p.lead
|
||||
= t('mail_subscriptions.unsubscribe.confirmation_html', domain: content_tag(:strong, site_hostname), type: content_tag(:strong, I18n.t(@type, scope: 'mail_subscriptions.unsubscribe.emails')), email: content_tag(:strong, @user.email), settings_path: settings_preferences_notifications_path)
|
||||
= t 'mail_subscriptions.unsubscribe.confirmation_html',
|
||||
domain: content_tag(:strong, site_hostname),
|
||||
type: content_tag(:strong, I18n.t(@type, scope: 'mail_subscriptions.unsubscribe.emails')),
|
||||
email: content_tag(:strong, @user.email),
|
||||
settings_path: settings_preferences_notifications_path
|
||||
|
||||
= form_tag unsubscribe_path, method: :post do
|
||||
= hidden_field_tag :token, params[:token]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
.fields-group
|
||||
= f.input :name,
|
||||
hint: safe_join([t('simple_form.hints.featured_tag.name'), safe_join(@recently_used_tags.map { |tag| link_to("##{tag.display_name}", settings_featured_tags_path(featured_tag: { name: tag.name }), method: :post) }, ', ')], ' '),
|
||||
hint: featured_tags_hint(@recently_used_tags),
|
||||
wrapper: :with_block_label
|
||||
|
||||
.actions
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
:ruby
|
||||
method_str = content_tag(:span, login_activity.omniauth? ? t(login_activity.provider, scope: 'auth.providers') : t(login_activity.authentication_method, scope: 'login_activities.authentication_methods'), class: 'target')
|
||||
ip_str = content_tag(:span, login_activity.ip, class: 'target')
|
||||
browser_str = content_tag(:span, t('sessions.description', browser: t("sessions.browsers.#{login_activity.browser}", default: login_activity.browser.to_s), platform: t("sessions.platforms.#{login_activity.platform}", default: login_activity.platform.to_s)), class: 'target', title: login_activity.user_agent)
|
||||
|
||||
.log-entry
|
||||
.log-entry__header
|
||||
.log-entry__avatar
|
||||
|
@ -10,9 +5,6 @@
|
|||
= fa_icon login_activity.success? ? 'check' : 'times'
|
||||
.log-entry__content
|
||||
.log-entry__title
|
||||
- if login_activity.success?
|
||||
= t('login_activities.successful_sign_in_html', method: method_str, ip: ip_str, browser: browser_str)
|
||||
- else
|
||||
= t('login_activities.failed_sign_in_html', method: method_str, ip: ip_str, browser: browser_str)
|
||||
= login_activity_title(login_activity)
|
||||
.log-entry__timestamp
|
||||
%time.formatted{ datetime: login_activity.created_at.iso8601 }= l(login_activity.created_at)
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td.column-cell.text-center
|
||||
%p= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)
|
||||
%p= t 'user_mailer.appeal_approved.explanation',
|
||||
appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone),
|
||||
strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)
|
||||
|
||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td.column-cell.text-center
|
||||
%p= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)
|
||||
%p= t 'user_mailer.appeal_rejected.explanation',
|
||||
appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone),
|
||||
strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)
|
||||
|
||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
|
|
|
@ -45,7 +45,10 @@
|
|||
= @remote_ip
|
||||
%br/
|
||||
%strong #{t('sessions.browser')}:
|
||||
%span{ title: @user_agent }= t 'sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
|
||||
%span{ title: @user_agent }
|
||||
= t 'sessions.description',
|
||||
browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s),
|
||||
platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
|
||||
%br/
|
||||
= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)
|
||||
|
||||
|
@ -64,4 +67,5 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td.column-cell.text-center
|
||||
%p= t 'user_mailer.suspicious_sign_in.further_actions_html', action: link_to(t('user_mailer.suspicious_sign_in.change_password'), edit_user_registration_url)
|
||||
%p= t 'user_mailer.suspicious_sign_in.further_actions_html',
|
||||
action: link_to(t('user_mailer.suspicious_sign_in.change_password'), edit_user_registration_url)
|
||||
|
|
|
@ -43,10 +43,20 @@ describe Settings::FeaturedTagsController do
|
|||
end
|
||||
|
||||
describe 'GET to #index' do
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
|
||||
before do
|
||||
status = Fabricate :status, account: user.account
|
||||
status.tags << tag
|
||||
end
|
||||
|
||||
it 'responds with success' do
|
||||
get :index
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.body).to include(
|
||||
settings_featured_tags_path(featured_tag: { name: tag.name })
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ describe Settings::LoginActivitiesController do
|
|||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let!(:login_activity) { Fabricate :login_activity, user: user }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
|
@ -19,6 +20,10 @@ describe Settings::LoginActivitiesController do
|
|||
it 'returns http success with private cache control headers', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.headers['Cache-Control']).to include('private, no-store')
|
||||
expect(response.body)
|
||||
.to include(login_activity.user_agent)
|
||||
.and include(login_activity.authentication_method)
|
||||
.and include(login_activity.ip.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,21 +107,6 @@ RSpec.configure do |config|
|
|||
Capybara.current_driver = :rack_test
|
||||
end
|
||||
|
||||
config.around :each, type: :system do |example|
|
||||
# The streaming server needs access to the database
|
||||
# but with use_transactional_tests every transaction
|
||||
# is rolled-back, so the streaming server never sees the data
|
||||
# So we disable this feature for system tests, and use DatabaseCleaner to clean
|
||||
# the database tables between each test
|
||||
self.use_transactional_tests = false
|
||||
|
||||
DatabaseCleaner.cleaning do
|
||||
example.run
|
||||
end
|
||||
|
||||
self.use_transactional_tests = true
|
||||
end
|
||||
|
||||
config.before do |example|
|
||||
allow(Resolv::DNS).to receive(:open).and_raise('Real DNS queries are disabled, stub Resolv::DNS as needed') unless example.metadata[:type] == :system
|
||||
end
|
||||
|
|
|
@ -177,7 +177,9 @@ RSpec.describe 'IP Blocks' do
|
|||
let(:params) { { severity: 'sign_up_requires_approval', comment: 'Decreasing severity' } }
|
||||
|
||||
it 'returns the correct ip block', :aggregate_failures do
|
||||
subject
|
||||
expect { subject }
|
||||
.to change_severity_level
|
||||
.and change_comment_value
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to match(hash_including({
|
||||
|
@ -187,12 +189,12 @@ RSpec.describe 'IP Blocks' do
|
|||
}))
|
||||
end
|
||||
|
||||
it 'updates the severity correctly' do
|
||||
expect { subject }.to change { ip_block.reload.severity }.from('no_access').to('sign_up_requires_approval')
|
||||
def change_severity_level
|
||||
change { ip_block.reload.severity }.from('no_access').to('sign_up_requires_approval')
|
||||
end
|
||||
|
||||
it 'updates the comment correctly' do
|
||||
expect { subject }.to change { ip_block.reload.comment }.from('Spam').to('Decreasing severity')
|
||||
def change_comment_value
|
||||
change { ip_block.reload.comment }.from('Spam').to('Decreasing severity')
|
||||
end
|
||||
|
||||
context 'when ip block does not exist' do
|
||||
|
|
|
@ -32,18 +32,18 @@ describe 'Links' do
|
|||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
expect { subject }
|
||||
.to change_link_trendable_to_true
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expects_correct_link_data
|
||||
end
|
||||
|
||||
it 'sets the link as trendable' do
|
||||
expect { subject }.to change { preview_card.reload.trendable }.from(false).to(true)
|
||||
def change_link_trendable_to_true
|
||||
change { preview_card.reload.trendable }.from(false).to(true)
|
||||
end
|
||||
|
||||
it 'returns the link data' do
|
||||
subject
|
||||
|
||||
def expects_correct_link_data
|
||||
expect(body_as_json).to match(
|
||||
a_hash_including(
|
||||
url: preview_card.url,
|
||||
|
@ -85,13 +85,14 @@ describe 'Links' do
|
|||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
expect { subject }
|
||||
.to_not change_link_trendable
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'does not set the link as trendable' do
|
||||
expect { subject }.to_not(change { preview_card.reload.trendable })
|
||||
def change_link_trendable
|
||||
change { preview_card.reload.trendable }
|
||||
end
|
||||
|
||||
it 'returns the link data' do
|
||||
|
|
|
@ -95,6 +95,19 @@ RSpec.configure do |config|
|
|||
end
|
||||
end
|
||||
|
||||
config.around :each, type: :system do |example|
|
||||
# Streaming server needs DB access but `use_transactional_tests` rolls back
|
||||
# every transaction. Disable this feature for streaming tests, and use
|
||||
# DatabaseCleaner to clean the database tables between each test.
|
||||
self.use_transactional_tests = false
|
||||
|
||||
DatabaseCleaner.cleaning do
|
||||
example.run
|
||||
end
|
||||
|
||||
self.use_transactional_tests = true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def streaming_server_manager
|
||||
|
|
Loading…
Reference in a new issue