UX: Use smaller messages for moderator actions.

This commit is contained in:
Robin Ward
2015-07-24 16:39:03 -04:00
parent 326b2812e4
commit bb93a345eb
25 changed files with 171 additions and 60 deletions

View File

@@ -139,7 +139,7 @@ module Tilt
def generate_source(scope)
js_source = ::JSON.generate(data, quirks_mode: true)
js_source = "babel.transform(#{js_source}, {ast: false, whitelist: ['es6.constants', 'es6.properties.shorthand', 'es6.arrowFunctions', 'es6.blockScoping', 'es6.destructuring']})['code']"
js_source = "babel.transform(#{js_source}, {ast: false, whitelist: ['es6.constants', 'es6.properties.shorthand', 'es6.arrowFunctions', 'es6.blockScoping', 'es6.destructuring', 'es6.templateLiterals']})['code']"
"new module.exports.Compiler(#{js_source}, '#{module_name(scope.root_path, scope.logical_path)}', #{compiler_options}).#{compiler_method}()"
end

View File

@@ -31,6 +31,7 @@ class PostCreator
# :raw_email - Imported from an email
# via_email - Mark this post as arriving via email
# raw_email - Full text of arriving email (to store)
# action_code - Describes a small_action post (optional)
#
# When replying to a topic:
# topic_id - topic we're replying to
@@ -255,7 +256,7 @@ class PostCreator
end
def setup_post
@opts[:raw] = TextCleaner.normalize_whitespaces(@opts[:raw]).gsub(/\s+\z/, "")
@opts[:raw] = TextCleaner.normalize_whitespaces(@opts[:raw] || '').gsub(/\s+\z/, "")
post = Post.new(raw: @opts[:raw],
topic_id: @topic.try(:id),
@@ -263,7 +264,7 @@ class PostCreator
reply_to_post_number: @opts[:reply_to_post_number])
# Attributes we pass through to the post instance if present
[:post_type, :no_bump, :cooking_options, :image_sizes, :acting_user, :invalidate_oneboxes, :cook_method, :via_email, :raw_email].each do |a|
[:post_type, :no_bump, :cooking_options, :image_sizes, :acting_user, :invalidate_oneboxes, :cook_method, :via_email, :raw_email, :action_code].each do |a|
post.send("#{a}=", @opts[a]) if @opts[a].present?
end

View File

@@ -56,6 +56,9 @@ class PostJobsEnqueuer
end
def skip_after_create?
@opts[:import_mode] || @topic.private_message? || @post.post_type == Post.types[:moderator_action]
@opts[:import_mode] ||
@topic.private_message? ||
@post.post_type == Post.types[:moderator_action] ||
@post.post_type == Post.types[:small_action]
end
end

View File

@@ -379,7 +379,7 @@ class TopicView
end
if @best.present?
@filtered_posts = @filtered_posts.where('posts.post_type <> ?', Post.types[:moderator_action])
@filtered_posts = @filtered_posts.where('posts.post_type = ?', Post.types[:regular])
@contains_gaps = true
end