diff --git a/app/assets/javascripts/admin/templates/email-sent.hbs b/app/assets/javascripts/admin/templates/email-sent.hbs index 4e4f5dbf77a..2f8785c6f59 100644 --- a/app/assets/javascripts/admin/templates/email-sent.hbs +++ b/app/assets/javascripts/admin/templates/email-sent.hbs @@ -30,7 +30,13 @@ {{l.to_address}} {{l.email_type}} - {{l.reply_key}} + + {{#if l.post_url}} + {{l.reply_key}} + {{else}} + {{l.reply_key}} + {{/if}} + {{else}} {{i18n 'admin.email.logs.none'}} diff --git a/app/assets/javascripts/admin/templates/email-skipped.hbs b/app/assets/javascripts/admin/templates/email-skipped.hbs index d983b093785..6ef48725668 100644 --- a/app/assets/javascripts/admin/templates/email-skipped.hbs +++ b/app/assets/javascripts/admin/templates/email-skipped.hbs @@ -30,7 +30,13 @@ {{l.to_address}} {{l.email_type}} - {{l.skipped_reason}} + + {{#if l.post_url}} + {{l.skipped_reason}} + {{else}} + {{l.skipped_reason}} + {{/if}} + {{else}} {{i18n 'admin.email.logs.none'}} diff --git a/app/assets/javascripts/discourse/templates/user/preferences.hbs b/app/assets/javascripts/discourse/templates/user/preferences.hbs index 37966945a30..636227b757b 100644 --- a/app/assets/javascripts/discourse/templates/user/preferences.hbs +++ b/app/assets/javascripts/discourse/templates/user/preferences.hbs @@ -28,7 +28,7 @@ {{#if model.can_edit_name}} {{text-field value=newNameInput classNames="input-xxlarge"}} {{else}} - {{name}} + {{model.name}} {{/if}}
diff --git a/app/assets/javascripts/discourse/widgets/toggle-topic-summary.js.es6 b/app/assets/javascripts/discourse/widgets/toggle-topic-summary.js.es6 index 33580af7fd8..9816f35b417 100644 --- a/app/assets/javascripts/discourse/widgets/toggle-topic-summary.js.es6 +++ b/app/assets/javascripts/discourse/widgets/toggle-topic-summary.js.es6 @@ -9,9 +9,9 @@ createWidget('toggle-summary-description', { if (attrs.topicWordCount) { const readingTime = Math.floor(attrs.topicWordCount / this.siteSettings.read_time_word_count); - return I18n.t('summary.description_time', { count: attrs.topicPostsCount, readingTime }); + return I18n.t('summary.description_time', { replyCount: attrs.topicReplyCount, readingTime }); } - return I18n.t('summary.description', { count: attrs.topicPostsCount }); + return I18n.t('summary.description', { replyCount: attrs.topicReplyCount }); }, html(attrs) { diff --git a/app/controllers/admin/email_controller.rb b/app/controllers/admin/email_controller.rb index 4b685c48e24..8ca208afb8d 100644 --- a/app/controllers/admin/email_controller.rb +++ b/app/controllers/admin/email_controller.rb @@ -67,7 +67,7 @@ class Admin::EmailController < Admin::AdminController private def filter_email_logs(email_logs, params) - email_logs = email_logs.includes(:user) + email_logs = email_logs.includes(:user, { post: :topic }) .references(:user) .order(created_at: :desc) .offset(params[:offset] || 0) diff --git a/app/jobs/regular/user_email.rb b/app/jobs/regular/user_email.rb index 404dd07f8e5..6830ec2e64a 100644 --- a/app/jobs/regular/user_email.rb +++ b/app/jobs/regular/user_email.rb @@ -15,7 +15,7 @@ module Jobs 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], to_address, args[:post_id]) return skip(I18n.t("email_log.no_user", user_id: args[:user_id])) unless user @@ -44,8 +44,8 @@ module Jobs end end - def set_skip_context(type, user_id, to_address) - @skip_context = { type: type, user_id: user_id, to_address: to_address } + def set_skip_context(type, user_id, to_address, post_id) + @skip_context = { type: type, user_id: user_id, to_address: to_address, post_id: post_id } end NOTIFICATIONS_SENT_BY_MAILING_LIST ||= Set.new %w{posted replied mentioned group_mentioned quoted} @@ -54,7 +54,7 @@ module Jobs notification_type=nil, notification_data_hash=nil, email_token=nil, to_address=nil) - set_skip_context(type, user.id, to_address || user.email) + set_skip_context(type, user.id, to_address || user.email, post.try(:id)) return skip_message(I18n.t("email_log.anonymous_user")) if user.anonymous? return skip_message(I18n.t("email_log.suspended_not_pm")) if user.suspended? && type != :user_private_message @@ -142,6 +142,7 @@ module Jobs email_type: @skip_context[:type], to_address: @skip_context[:to_address], user_id: @skip_context[:user_id], + post_id: @skip_context[:post_id], skipped: true, skipped_reason: "[UserEmail] #{reason}", ) diff --git a/app/serializers/email_log_serializer.rb b/app/serializers/email_log_serializer.rb index 977e3ee93bf..07f336d4e37 100644 --- a/app/serializers/email_log_serializer.rb +++ b/app/serializers/email_log_serializer.rb @@ -7,11 +7,21 @@ class EmailLogSerializer < ApplicationSerializer :user_id, :created_at, :skipped, - :skipped_reason + :skipped_reason, + :post_url has_one :user, serializer: BasicUserSerializer, embed: :objects def include_skipped_reason? object.skipped end + + def post_url + object.post.url + end + + def include_post_url? + object.post.present? + end + end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 5ae311e510e..89a2331567c 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -299,7 +299,7 @@ en: other: "This topic has {{count}} posts awaiting approval" confirm: "Save Changes" - delete_prompt: "Are you sure you want to delete %{username}? This will remove all of their posts and block their email and ip address." + delete_prompt: "Are you sure you want to delete %{username}? This will remove all of their posts and block their email and IP address." approval: title: "Post Needs Approval" @@ -804,8 +804,8 @@ en: summary: enabled_description: "You're viewing a summary of this topic: the most interesting posts as determined by the community." - description: "There are {{count}} replies." - description_time: "There are {{count}} replies with an estimated read time of {{readingTime}} minutes." + description: "There are {{replyCount}} replies." + description_time: "There are {{replyCount}} replies with an estimated read time of {{readingTime}} minutes." enable: 'Summarize This Topic' disable: 'Show All Posts' diff --git a/lib/import_export/import_export.rb b/lib/import_export/import_export.rb index 715a4bea5e5..4bb6fa9250d 100644 --- a/lib/import_export/import_export.rb +++ b/lib/import_export/import_export.rb @@ -6,8 +6,8 @@ require "json" module ImportExport - def self.export_category(category_id) - ImportExport::CategoryExporter.new(category_id).perform.save_to_file + def self.export_category(category_id, filename=nil) + ImportExport::CategoryExporter.new(category_id).perform.save_to_file(filename) end def self.import_category(filename) diff --git a/script/discourse b/script/discourse index fb91f986f4f..af03de89b35 100755 --- a/script/discourse +++ b/script/discourse @@ -135,12 +135,12 @@ class DiscourseCLI < Thor end desc "export_category", "Export a category, all its topics, and all users who posted in those topics" - def export_category(category_id) + def export_category(category_id, filename=nil) raise "Category id argument is missing!" unless category_id load_rails load_import_export - ImportExport.export_category(category_id) + ImportExport.export_category(category_id, filename) puts "", "Done", "" end