Merge branch 'master' into glitch-soc/merge-upstream

lolsob-rspec
Thibaut Girka 2019-11-23 19:03:01 +01:00
commit 5aa79af7cb
10 changed files with 36 additions and 18 deletions

View File

@ -6,7 +6,7 @@ module DomainControlHelper
domain = begin domain = begin
if uri_or_domain.include?('://') if uri_or_domain.include?('://')
Addressable::URI.parse(uri_or_domain).domain Addressable::URI.parse(uri_or_domain).host
else else
uri_or_domain uri_or_domain
end end

View File

@ -144,7 +144,7 @@ class PollForm extends ImmutablePureComponent {
<div className='poll__footer'> <div className='poll__footer'>
<button disabled={options.size >= 5} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button> <button disabled={options.size >= 5} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
<select value={expiresIn} onChange={this.handleSelectDuration}> <select value={expiresIn} onBlur={this.handleSelectDuration}>
<option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option> <option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option>
<option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option> <option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option>
<option value={3600}>{intl.formatMessage(messages.hours, { number: 1 })}</option> <option value={3600}>{intl.formatMessage(messages.hours, { number: 1 })}</option>

View File

@ -244,6 +244,16 @@ class FocalPointModal extends ImmutablePureComponent {
const previewWidth = 200; const previewWidth = 200;
const previewHeight = previewWidth / previewRatio; const previewHeight = previewWidth / previewRatio;
let descriptionLabel = null;
if (media.get('type') === 'audio') {
descriptionLabel = <FormattedMessage id='upload_form.audio_description' defaultMessage='Describe for people with hearing loss' />;
} else if (media.get('type') === 'video') {
descriptionLabel = <FormattedMessage id='upload_form.video_description' defaultMessage='Describe for people with hearing loss or visual impairment' />;
} else {
descriptionLabel = <FormattedMessage id='upload_form.description' defaultMessage='Describe for the visually impaired' />;
}
return ( return (
<div className='modal-root__modal report-modal' style={{ maxWidth: 960 }}> <div className='modal-root__modal report-modal' style={{ maxWidth: 960 }}>
<div className='report-modal__target'> <div className='report-modal__target'>
@ -255,7 +265,9 @@ class FocalPointModal extends ImmutablePureComponent {
<div className='report-modal__comment'> <div className='report-modal__comment'>
{focals && <p><FormattedMessage id='upload_modal.hint' defaultMessage='Click or drag the circle on the preview to choose the focal point which will always be in view on all thumbnails.' /></p>} {focals && <p><FormattedMessage id='upload_modal.hint' defaultMessage='Click or drag the circle on the preview to choose the focal point which will always be in view on all thumbnails.' /></p>}
<label className='setting-text-label' htmlFor='upload-modal__description'><FormattedMessage id='upload_form.description' defaultMessage='Describe for the visually impaired' /></label> <label className='setting-text-label' htmlFor='upload-modal__description'>
{descriptionLabel}
</label>
<div className='setting-text__wrapper'> <div className='setting-text__wrapper'>
<Textarea <Textarea

View File

@ -513,6 +513,10 @@ code {
&__overlay-area { &__overlay-area {
position: relative; position: relative;
&__blurred form {
filter: blur(2px);
}
&__overlay { &__overlay {
position: absolute; position: absolute;
top: 0; top: 0;
@ -523,8 +527,10 @@ code {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: rgba($ui-base-color, 0.65); background: rgba($ui-base-color, 0.65);
backdrop-filter: blur(2px);
border-radius: 4px; border-radius: 4px;
margin-left: -4px;
margin-top: -4px;
padding: 4px;
&__content { &__content {
text-align: center; text-align: center;

View File

@ -438,7 +438,7 @@ class Account < ApplicationRecord
accounts.*, accounts.*,
(count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank (count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank
FROM accounts FROM accounts
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?) LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?)
WHERE accounts.id IN (SELECT * FROM first_degree) WHERE accounts.id IN (SELECT * FROM first_degree)
AND #{query} @@ #{textsearch} AND #{query} @@ #{textsearch}
AND accounts.suspended_at IS NULL AND accounts.suspended_at IS NULL
@ -448,7 +448,7 @@ class Account < ApplicationRecord
LIMIT ? OFFSET ? LIMIT ? OFFSET ?
SQL SQL
records = find_by_sql([sql, account.id, account.id, account.id, account.id, limit, offset]) records = find_by_sql([sql, account.id, account.id, account.id, limit, offset])
else else
sql = <<-SQL.squish sql = <<-SQL.squish
SELECT SELECT

View File

@ -20,13 +20,13 @@ class BlockDomainService < BaseService
end end
def process_domain_block! def process_domain_block!
clear_media! if domain_block.reject_media?
if domain_block.silence? if domain_block.silence?
silence_accounts! silence_accounts!
elsif domain_block.suspend? elsif domain_block.suspend?
suspend_accounts! suspend_accounts!
end end
clear_media! if domain_block.reject_media?
end end
def invalidate_association_caches! def invalidate_association_caches!

View File

@ -67,7 +67,7 @@ class FetchLinkCardService < BaseService
else else
html = Nokogiri::HTML(@status.text) html = Nokogiri::HTML(@status.text)
links = html.css('a') links = html.css('a')
urls = links.map { |a| Addressable::URI.parse(a['href']).normalize unless skip_link?(a) }.compact urls = links.map { |a| Addressable::URI.parse(a['href']) unless skip_link?(a) }.compact.map(&:normalize).compact
end end
urls.reject { |uri| bad_url?(uri) }.first urls.reject { |uri| bad_url?(uri) }.first

View File

@ -58,7 +58,7 @@ class FetchOEmbedService
url_domain = Addressable::URI.parse(@url).normalized_host url_domain = Addressable::URI.parse(@url).normalized_host
endpoint_hash = { endpoint_hash = {
endpoint: @endpoint_url.gsub(URI.encode_www_form_component(@url), '{url}'), endpoint: @endpoint_url.gsub(/(=(http[s]?(%3A|:)(\/\/|%2F%2F)))([^&]*)/i, '={url}'),
format: @format, format: @format,
} }

View File

@ -1,5 +1,5 @@
= simple_form_for(new_user, url: user_registration_path, namespace: 'registration') do |f| .simple_form__overlay-area{ class: (closed_registrations? && @instance_presenter.closed_registrations_message.present?) ? 'simple_form__overlay-area__blurred' : '' }
.simple_form__overlay-area = simple_form_for(new_user, url: user_registration_path, namespace: 'registration') do |f|
%p.lead= t('about.federation_hint_html', instance: content_tag(:strong, site_hostname)) %p.lead= t('about.federation_hint_html', instance: content_tag(:strong, site_hostname))
.fields-group .fields-group
@ -21,8 +21,8 @@
.actions .actions
= f.button :button, sign_up_message, type: :submit, class: 'button button-primary', disabled: closed_registrations? = f.button :button, sign_up_message, type: :submit, class: 'button button-primary', disabled: closed_registrations?
- if closed_registrations? && @instance_presenter.closed_registrations_message.present? - if closed_registrations? && @instance_presenter.closed_registrations_message.present?
.simple_form__overlay-area__overlay .simple_form__overlay-area__overlay
.simple_form__overlay-area__overlay__content.rich-formatting .simple_form__overlay-area__overlay__content.rich-formatting
.block-icon= fa_icon 'warning' .block-icon= fa_icon 'warning'
= @instance_presenter.closed_registrations_message.html_safe = @instance_presenter.closed_registrations_message.html_safe

View File

@ -80,7 +80,7 @@ RSpec.describe FetchLinkCardService, type: :service do
end end
context 'in a remote status' do context 'in a remote status' do
let(:status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com'), text: 'Habt ihr ein paar gute Links zu #<span class="tag"><a href="https://quitter.se/tag/wannacry" target="_blank" rel="tag noopener noreferrer" title="https://quitter.se/tag/wannacry">Wannacry</a></span> herumfliegen? Ich will mal unter <br> <a href="https://github.com/qbi/WannaCry" target="_blank" rel="noopener noreferrer" title="https://github.com/qbi/WannaCry">https://github.com/qbi/WannaCry</a> was sammeln. !<a href="http://sn.jonkman.ca/group/416/id" target="_blank" rel="noopener noreferrer" title="http://sn.jonkman.ca/group/416/id">security</a>&nbsp;') } let(:status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com'), text: 'Habt ihr ein paar gute Links zu <a>foo</a> #<span class="tag"><a href="https://quitter.se/tag/wannacry" target="_blank" rel="tag noopener noreferrer" title="https://quitter.se/tag/wannacry">Wannacry</a></span> herumfliegen? Ich will mal unter <br> <a href="https://github.com/qbi/WannaCry" target="_blank" rel="noopener noreferrer" title="https://github.com/qbi/WannaCry">https://github.com/qbi/WannaCry</a> was sammeln. !<a href="http://sn.jonkman.ca/group/416/id" target="_blank" rel="noopener noreferrer" title="http://sn.jonkman.ca/group/416/id">security</a>&nbsp;') }
it 'parses out URLs' do it 'parses out URLs' do
expect(a_request(:get, 'https://github.com/qbi/WannaCry')).to have_been_made.at_least_once expect(a_request(:get, 'https://github.com/qbi/WannaCry')).to have_been_made.at_least_once