Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/stable' into pkgr
  • Loading branch information
crohr committed Jan 11, 2018
2 parents 5690d25 + b9bc27e commit 298ed7e
Show file tree
Hide file tree
Showing 23 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/backups_controller.rb
Expand Up @@ -70,7 +70,7 @@ def show
send_file backup.path
else
if @error
render layout: 'no_ember', status: 422
render template: 'admin/backups/show.html.erb', layout: 'no_ember', status: 422
else
render body: nil, status: 404
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Expand Up @@ -504,8 +504,8 @@ def password_reset
success: false,
message: @error,
errors: @user&.errors&.to_hash,
is_developer: UsernameCheckerService.is_developer?(@user.email),
admin: @user.admin?
is_developer: UsernameCheckerService.is_developer?(@user&.email),
admin: @user&.admin?
}
else
render json: {
Expand Down
2 changes: 1 addition & 1 deletion app/models/topic.rb
Expand Up @@ -1273,7 +1273,7 @@ def pm_with_non_human_user?
end

def featured_link_root_domain
MiniSuffix.domain(URI.parse(self.featured_link).hostname)
MiniSuffix.domain(URI.parse(URI.encode(self.featured_link)).hostname)
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/models/topic_embed.rb
Expand Up @@ -182,8 +182,8 @@ def self.absolutize_urls(url, contents)
end

def self.topic_id_for_embed(embed_url)
embed_url = normalize_url(embed_url)
TopicEmbed.where("lower(embed_url) = ?", embed_url).pluck(:topic_id).first
embed_url = normalize_url(embed_url).sub(/^https?\:\/\//, '')
TopicEmbed.where("embed_url ~* '^https?://#{embed_url}$'").pluck(:topic_id).first
end

def self.first_paragraph_from(html)
Expand Down
3 changes: 2 additions & 1 deletion lib/cooked_post_processor.rb
Expand Up @@ -237,7 +237,8 @@ def get_size(url)
return unless SiteSetting.crawl_images? || Discourse.store.has_been_uploaded?(url)

@size_cache[url] = FastImage.size(absolute_url)
rescue Zlib::BufError # FastImage.size raises BufError for some gifs
rescue Zlib::BufError, URI::InvalidURIError, URI::InvalidComponentError
# FastImage.size raises BufError for some gifs, leave it.
end

def is_valid_image_url?(url)
Expand Down
2 changes: 1 addition & 1 deletion lib/emoji/db.json
Expand Up @@ -5754,7 +5754,7 @@
},
{
"code": "1f92b",
"name": "sushing_face"
"name": "shushing_face"
},
{
"code": "1f92d",
Expand Down
2 changes: 1 addition & 1 deletion lib/emoji/groups.json
Expand Up @@ -325,7 +325,7 @@
"diversity": false
},
{
"name": "sushing_face",
"name": "shushing_face",
"diversity": false
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Expand Up @@ -4,7 +4,7 @@ module Discourse
module VERSION #:nodoc:
MAJOR = 1
MINOR = 9
TINY = 0
TINY = 1
PRE = nil

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
Expand Down
Binary file added public/images/emoji/apple/shushing_face.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/emoji/google/shushing_face.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/emoji/google/sushing_face.png
Binary file not shown.
File renamed without changes
Binary file removed public/images/emoji/google_classic/sushing_face.png
Binary file not shown.
Binary file removed public/images/emoji/twitter/sushing_face.png
Binary file not shown.
Binary file added public/images/emoji/win10/shushing_face.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/emoji/win10/sushing_face.png
Binary file not shown.
14 changes: 11 additions & 3 deletions spec/controllers/users_controller_spec.rb
Expand Up @@ -303,11 +303,9 @@
context 'invalid token' do
render_views

before do
it 'disallows login' do
get :password_reset, params: { token: "evil_trout!" }
end

it 'disallows login' do
expect(response).to be_success

expect(CGI.unescapeHTML(response.body))
Expand All @@ -319,6 +317,16 @@

expect(session[:current_user_id]).to be_blank
end

it "responds with proper error message" do
put :password_reset, params: {
token: "evil_trout!", password: "awesomeSecretPassword"
}, format: :json

expect(response).to be_success
expect(JSON.parse(response.body)["message"]).to eq(I18n.t('password_reset.no_token'))
expect(session[:current_user_id]).to be_blank
end
end

context 'valid token' do
Expand Down
14 changes: 14 additions & 0 deletions spec/models/topic_embed_spec.rb
Expand Up @@ -60,6 +60,20 @@

end

context '.topic_id_for_embed' do
it "returns correct topic id irrespective of url protocol" do
topic_embed = Fabricate(:topic_embed, embed_url: "http://example.com/post/248")

expect(TopicEmbed.topic_id_for_embed('http://exAMPle.com/post/248')).to eq(topic_embed.topic_id)
expect(TopicEmbed.topic_id_for_embed('https://example.com/post/248/')).to eq(topic_embed.topic_id)

expect(TopicEmbed.topic_id_for_embed('http://example.com/post/248/2')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://examples.com/post/248')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://example.com/post/24')).to eq(nil)
expect(TopicEmbed.topic_id_for_embed('http://example.com/post')).to eq(nil)
end
end

describe '.find_remote' do

context ".title_scrub" do
Expand Down
1 change: 1 addition & 0 deletions spec/models/topic_spec.rb
Expand Up @@ -2101,6 +2101,7 @@ def build_topic_with_title(title)
"https://meta.discourse.org",
"https://meta.discourse.org/",
"https://meta.discourse.org/?filter=test",
"https://meta.discourse.org/t/中國/1",
].each do |featured_link|
it "should extract the root domain from #{featured_link} correctly" do
topic.featured_link = featured_link
Expand Down
3 changes: 2 additions & 1 deletion spec/requests/embed_controller_spec.rb
Expand Up @@ -4,6 +4,7 @@

let(:host) { "eviltrout.com" }
let(:embed_url) { "http://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:embed_url_secure) { "https://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:discourse_username) { "eviltrout" }

it "is 404 without an embed_url" do
Expand Down Expand Up @@ -95,7 +96,7 @@
it "displays the right view" do
topic_embed = Fabricate(:topic_embed, embed_url: embed_url)

get '/embed/comments', params: { embed_url: embed_url }, headers: headers
get '/embed/comments', params: { embed_url: embed_url_secure }, headers: headers

expect(response.body).to match(I18n.t('embed.start_discussion'))
end
Expand Down

0 comments on commit 298ed7e

Please sign in to comment.