Merge pull request #1966 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changespull/41/head
commit
bdc61d467d
|
@ -56,6 +56,7 @@ RUN apt-get update && \
|
||||||
useradd -u "$UID" -g "${GID}" -m -d /opt/mastodon mastodon && \
|
useradd -u "$UID" -g "${GID}" -m -d /opt/mastodon mastodon && \
|
||||||
apt-get -y --no-install-recommends install whois \
|
apt-get -y --no-install-recommends install whois \
|
||||||
wget \
|
wget \
|
||||||
|
procps \
|
||||||
libssl1.1 \
|
libssl1.1 \
|
||||||
libpq5 \
|
libpq5 \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Api::V1::TagsController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow
|
def follow
|
||||||
TagFollow.first_or_create!(tag: @tag, account: current_account, rate_limit: true)
|
TagFollow.create_with(rate_limit: true).find_or_create_by!(tag: @tag, account: current_account)
|
||||||
render json: @tag, serializer: REST::TagSerializer
|
render json: @tag, serializer: REST::TagSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ class Account::Field < ActiveModelSerializers::Model
|
||||||
parsed_url.user.nil? &&
|
parsed_url.user.nil? &&
|
||||||
parsed_url.password.nil? &&
|
parsed_url.password.nil? &&
|
||||||
parsed_url.host.present? &&
|
parsed_url.host.present? &&
|
||||||
parsed_url.normalized_host == parsed_url.host
|
parsed_url.normalized_host == parsed_url.host &&
|
||||||
|
(parsed_url.path.empty? || parsed_url.path == parsed_url.normalized_path)
|
||||||
rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
|
rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,11 @@ RSpec.describe Api::V1::TagsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #follow' do
|
describe 'POST #follow' do
|
||||||
|
let!(:unrelated_tag) { Fabricate(:tag) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
TagFollow.create!(account: user.account, tag: unrelated_tag)
|
||||||
|
|
||||||
post :follow, params: { id: name }
|
post :follow, params: { id: name }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,15 @@ RSpec.describe Account::Field, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for an IDN URL' do
|
context 'for an IDN URL' do
|
||||||
let(:value) { 'http://twitter.com∕dougallj∕status∕1590357240443437057.ê.cc/twitter.html' }
|
let(:value) { 'https://twitter.com∕dougallj∕status∕1590357240443437057.ê.cc/twitter.html' }
|
||||||
|
|
||||||
|
it 'returns false' do
|
||||||
|
expect(subject.verifiable?).to be false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a URL with a non-normalized path' do
|
||||||
|
let(:value) { 'https://github.com/octocatxxxxxxxx/../mastodon' }
|
||||||
|
|
||||||
it 'returns false' do
|
it 'returns false' do
|
||||||
expect(subject.verifiable?).to be false
|
expect(subject.verifiable?).to be false
|
||||||
|
|
Loading…
Reference in New Issue