Merge branch 'master' into vdom

This commit is contained in:
Robin Ward 2016-02-16 11:48:42 -05:00
commit 3ea1f88cdc
10 changed files with 41 additions and 18 deletions
app
assets/javascripts
controllers/admin
jobs/regular
serializers
config/locales
lib/import_export
script

View File

@ -30,7 +30,13 @@
</td>
<td><a href='mailto:{{unbound l.to_address}}'>{{l.to_address}}</a></td>
<td>{{l.email_type}}</td>
<td>{{l.reply_key}}</td>
<td>
{{#if l.post_url}}
<a href="{{l.post_url}}">{{l.reply_key}}</a>
{{else}}
{{l.reply_key}}
{{/if}}
</td>
</tr>
{{else}}
<tr><td colspan="5">{{i18n 'admin.email.logs.none'}}</td></tr>

View File

@ -30,7 +30,13 @@
</td>
<td><a href='mailto:{{unbound l.to_address}}'>{{l.to_address}}</a></td>
<td>{{l.email_type}}</td>
<td>{{l.skipped_reason}}</td>
<td>
{{#if l.post_url}}
<a href="{{l.post_url}}">{{l.skipped_reason}}</a>
{{else}}
{{l.skipped_reason}}
{{/if}}
</td>
</tr>
{{else}}
<tr><td colspan="5">{{i18n 'admin.email.logs.none'}}</td></tr>

View File

@ -28,7 +28,7 @@
{{#if model.can_edit_name}}
{{text-field value=newNameInput classNames="input-xxlarge"}}
{{else}}
<span class='static'>{{name}}</span>
<span class='static'>{{model.name}}</span>
{{/if}}
</div>
<div class='instructions'>

View File

@ -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) {

View File

@ -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)

View File

@ -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}",
)

View File

@ -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

View File

@ -299,7 +299,7 @@ en:
other: "This topic has <b>{{count}}</b> posts awaiting approval"
confirm: "Save Changes"
delete_prompt: "Are you sure you want to delete <b>%{username}</b>? This will remove all of their posts and block their email and ip address."
delete_prompt: "Are you sure you want to delete <b>%{username}</b>? 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 <b>{{count}}</b> replies."
description_time: "There are <b>{{count}}</b> replies with an estimated read time of <b>{{readingTime}} minutes</b>."
description: "There are <b>{{replyCount}}</b> replies."
description_time: "There are <b>{{replyCount}}</b> replies with an estimated read time of <b>{{readingTime}} minutes</b>."
enable: 'Summarize This Topic'
disable: 'Show All Posts'

View File

@ -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)

View File

@ -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