From 482a65821b2aeab216f8996f24e6824201b5425e Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 12 Feb 2016 13:31:26 -0500 Subject: [PATCH 1/5] FIX: Latest eslint doesn't recognize TypedArray --- test/javascripts/lib/utilities-test.js.es6 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/javascripts/lib/utilities-test.js.es6 b/test/javascripts/lib/utilities-test.js.es6 index 003c40bb1..3cea33cbe 100644 --- a/test/javascripts/lib/utilities-test.js.es6 +++ b/test/javascripts/lib/utilities-test.js.es6 @@ -1,3 +1,4 @@ +/* global Int8Array:true */ import { blank } from 'helpers/qunit-helpers'; module("Discourse.Utilities"); From 40b099f1a6eb88e6250075981e319882bffc3de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 15 Feb 2016 12:34:45 +0100 Subject: [PATCH 2/5] FIX: keep whitespaces when replacing direct link to external images with local images --- app/jobs/regular/pull_hotlinked_images.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index 9da1f3539..379ad102e 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -63,7 +63,7 @@ module Jobs # Markdown reference - [x]: http:// raw.gsub!(/\[([^\]]+)\]:\s?#{escaped_src}/) { "[#{$1}]: #{url}" } # Direct link - raw.gsub!(/^#{escaped_src}\s?$/, "") + raw.gsub!(/^#{escaped_src}(\s?)$/) { "#{$1}" } end rescue => e Rails.logger.info("Failed to pull hotlinked image: #{src} post:#{post_id}\n" + e.message + "\n" + e.backtrace.join("\n")) From 2af587005bc639f6b41bfafd7e4cbf5736222086 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 15 Feb 2016 23:05:16 +0800 Subject: [PATCH 3/5] FIX: find_by_attribute method in Rails 4.5 is case insensitive. * https://github.com/rails/rails/pull/23690 --- app/models/discourse_single_sign_on.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/discourse_single_sign_on.rb b/app/models/discourse_single_sign_on.rb index 894d545ad..492e4a704 100644 --- a/app/models/discourse_single_sign_on.rb +++ b/app/models/discourse_single_sign_on.rb @@ -81,7 +81,7 @@ class DiscourseSingleSignOn < SingleSignOn private def match_email_or_create_user(ip_address) - user = User.find_by_email(email) + user = User.find_by(email: email) try_name = name.blank? ? nil : name try_username = username.blank? ? nil : username From 4ad5660615a4026b332a137a3977cd4a0d6e3b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 15 Feb 2016 17:53:07 +0100 Subject: [PATCH 4/5] add slightly more logs when skipping email notifications --- app/jobs/regular/user_email.rb | 40 +++++++++++++++++----------------- lib/email/sender.rb | 6 ++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/jobs/regular/user_email.rb b/app/jobs/regular/user_email.rb index 14f34b42c..404dd07f8 100644 --- a/app/jobs/regular/user_email.rb +++ b/app/jobs/regular/user_email.rb @@ -6,19 +6,20 @@ module Jobs class UserEmail < Jobs::Base def execute(args) - notification, post = nil - raise Discourse::InvalidParameters.new(:user_id) unless args[:user_id].present? raise Discourse::InvalidParameters.new(:type) unless args[:type].present? + post = nil + notification = nil type = args[:type] - user = User.find_by(id: args[:user_id]) + to_address = args[:to_address].presence || user.try(:email).presence || "no_email_found" + + set_skip_context(type, args[:user_id], to_address) - set_skip_context(type, args[:user_id], args[:to_address].presence || user.try(:email).presence || "no_email_found") return skip(I18n.t("email_log.no_user", user_id: args[:user_id])) unless user - if args[:post_id] + if args[:post_id].present? post = Post.find_by(id: args[:post_id]) return skip(I18n.t('email_log.post_not_found', post_id: args[:post_id])) unless post.present? end @@ -27,18 +28,17 @@ module Jobs notification = Notification.find_by(id: args[:notification_id]) end - message, skip_reason = message_for_email( user, - post, - type, - notification, - args[:notification_type], - args[:notification_data_hash], - args[:email_token], - args[:to_address] ) - + message, skip_reason = message_for_email(user, + post, + type, + notification, + args[:notification_type], + args[:notification_data_hash], + args[:email_token], + args[:to_address]) if message - Email::Sender.new(message, args[:type], user).send + Email::Sender.new(message, type, user).send else skip_reason end @@ -51,8 +51,8 @@ module Jobs NOTIFICATIONS_SENT_BY_MAILING_LIST ||= Set.new %w{posted replied mentioned group_mentioned quoted} def message_for_email(user, post, type, notification, - notification_type=nil, notification_data_hash=nil, - email_token=nil, to_address=nil) + notification_type=nil, notification_data_hash=nil, + email_token=nil, to_address=nil) set_skip_context(type, user.id, to_address || user.email) @@ -75,7 +75,7 @@ module Jobs end if notification || notification_type - email_args[:notification_type] ||= notification_type || notification.try(:notification_type) + email_args[:notification_type] ||= notification_type || notification.try(:notification_type) email_args[:notification_data_hash] ||= notification_data_hash || notification.try(:data_hash) unless String === email_args[:notification_type] @@ -113,7 +113,7 @@ module Jobs # Update the to address if we have a custom one if message && to_address.present? - message.to = [to_address] + message.to = to_address end [message, nil] @@ -143,7 +143,7 @@ module Jobs to_address: @skip_context[:to_address], user_id: @skip_context[:user_id], skipped: true, - skipped_reason: reason, + skipped_reason: "[UserEmail] #{reason}", ) end diff --git a/lib/email/sender.rb b/lib/email/sender.rb index e1f81c84f..f0cef9ff2 100644 --- a/lib/email/sender.rb +++ b/lib/email/sender.rb @@ -23,7 +23,7 @@ module Email def send return if SiteSetting.disable_emails - return skip(I18n.t('email_log.message_blank')) if @message.blank? + return skip(I18n.t('email_log.message_blank')) if @message.blank? return skip(I18n.t('email_log.message_to_blank')) if @message.to.blank? if @message.text_part @@ -135,7 +135,7 @@ module Email def to_address @to_address ||= begin - to = @message ? @message.to : nil + to = @message.try(:to) to = to.first if Array === to to.presence || "no_email_found" end @@ -167,7 +167,7 @@ module Email to_address: to_address, user_id: @user.try(:id), skipped: true, - skipped_reason: reason + skipped_reason: "[Sender] #{reason}" ) end From 2b689d45ff4e01c757faa23d6279493c3bd68838 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 16 Feb 2016 11:52:33 +1100 Subject: [PATCH 5/5] Revert "save height on small screens" This reverts commit 37b5905b44e4334041e56eb941cfe8fcb33124c7. It is causing too much confusion for little gain --- app/assets/stylesheets/desktop/topic-post.scss | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index e5db38f83..8744a17ed 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -1038,16 +1038,3 @@ and (max-width : 767px) { } } - -@media all -and (max-height: 700px) { - - .post-menu-area { - margin-bottom: 0px; - margin-top: -18px; - } - - .topic-body { - padding: 5px 11px 2px; - } -}