FEATURE: Show an email icon beside posts that arrived via email
This commit is contained in:
parent
e182604c50
commit
1c5e8efa68
|
@ -28,7 +28,10 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
{{#if wiki}}
|
||||
<div {{action editPost this}} class="wiki" title="{{i18n post.wiki.about}}"><i class="fa fa-pencil-square-o fa-3x"></i></div>
|
||||
<div {{action editPost this}} class="wiki" title="{{i18n post.wiki.about}}"><i class="fa fa-pencil-square-o fa-3x"></i></div>
|
||||
{{/if}}
|
||||
{{#if via_email}}
|
||||
<div title="{{i18n post.via_email}}" class="via-email"><i class="fa fa-envelope-o fa-2x"></i></div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -773,6 +773,11 @@ $topic-avatar-width: 45px;
|
|||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.via-email {
|
||||
margin: 14px 0 0 8px;
|
||||
color: scale-color($primary, $lightness: 60%);
|
||||
}
|
||||
}
|
||||
|
||||
.gap {
|
||||
|
|
|
@ -50,7 +50,8 @@ class PostSerializer < BasicPostSerializer
|
|||
:can_view_edit_history,
|
||||
:wiki,
|
||||
:user_custom_fields,
|
||||
:static_doc
|
||||
:static_doc,
|
||||
:via_email
|
||||
|
||||
def moderator?
|
||||
!!(object.user && object.user.moderator?)
|
||||
|
@ -245,6 +246,10 @@ class PostSerializer < BasicPostSerializer
|
|||
object.post_number == 1 && Discourse.static_doc_topic_ids.include?(object.topic_id)
|
||||
end
|
||||
|
||||
def include_via_email?
|
||||
object.via_email?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def post_actions
|
||||
|
|
|
@ -1070,6 +1070,8 @@ en:
|
|||
no_value: "No, keep"
|
||||
yes_value: "Yes, abandon"
|
||||
|
||||
via_email: "this post arrived via email"
|
||||
|
||||
wiki:
|
||||
about: "this post is a wiki; basic users can edit it"
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddViaEmailToPosts < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :posts, :via_email, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
|
@ -241,6 +241,9 @@ module Email
|
|||
end
|
||||
|
||||
def create_post(user, options)
|
||||
# Mark the reply as incoming via email
|
||||
options[:via_email] = true
|
||||
|
||||
creator = PostCreator.new(user, options)
|
||||
post = creator.create
|
||||
|
||||
|
|
|
@ -215,7 +215,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].each do |a|
|
||||
[:post_type, :no_bump, :cooking_options, :image_sizes, :acting_user, :invalidate_oneboxes, :cook_method, :via_email].each do |a|
|
||||
post.send("#{a}=", @opts[a]) if @opts[a].present?
|
||||
end
|
||||
|
||||
|
|
|
@ -125,7 +125,9 @@ Thanks for listening."
|
|||
receiver.process
|
||||
|
||||
topic.posts.count.should == (start_count + 1)
|
||||
topic.posts.last.cooked.strip.should == fixture_file("emails/valid_reply.cooked").strip
|
||||
created_post = topic.posts.last
|
||||
created_post.via_email.should be_true
|
||||
created_post.cooked.strip.should == fixture_file("emails/valid_reply.cooked").strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue