FEATURE: Show an email icon beside posts that arrived via email
This commit is contained in:
parent
e182604c50
commit
1c5e8efa68
|
@ -30,6 +30,9 @@
|
||||||
{{#if wiki}}
|
{{#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}}
|
||||||
|
{{#if via_email}}
|
||||||
|
<div title="{{i18n post.via_email}}" class="via-email"><i class="fa fa-envelope-o fa-2x"></i></div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='topic-body'>
|
<div class='topic-body'>
|
||||||
|
|
|
@ -773,6 +773,11 @@ $topic-avatar-width: 45px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.via-email {
|
||||||
|
margin: 14px 0 0 8px;
|
||||||
|
color: scale-color($primary, $lightness: 60%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.gap {
|
.gap {
|
||||||
|
|
|
@ -50,7 +50,8 @@ class PostSerializer < BasicPostSerializer
|
||||||
:can_view_edit_history,
|
:can_view_edit_history,
|
||||||
:wiki,
|
:wiki,
|
||||||
:user_custom_fields,
|
:user_custom_fields,
|
||||||
:static_doc
|
:static_doc,
|
||||||
|
:via_email
|
||||||
|
|
||||||
def moderator?
|
def moderator?
|
||||||
!!(object.user && object.user.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)
|
object.post_number == 1 && Discourse.static_doc_topic_ids.include?(object.topic_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_via_email?
|
||||||
|
object.via_email?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def post_actions
|
def post_actions
|
||||||
|
|
|
@ -1070,6 +1070,8 @@ en:
|
||||||
no_value: "No, keep"
|
no_value: "No, keep"
|
||||||
yes_value: "Yes, abandon"
|
yes_value: "Yes, abandon"
|
||||||
|
|
||||||
|
via_email: "this post arrived via email"
|
||||||
|
|
||||||
wiki:
|
wiki:
|
||||||
about: "this post is a wiki; basic users can edit it"
|
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
|
end
|
||||||
|
|
||||||
def create_post(user, options)
|
def create_post(user, options)
|
||||||
|
# Mark the reply as incoming via email
|
||||||
|
options[:via_email] = true
|
||||||
|
|
||||||
creator = PostCreator.new(user, options)
|
creator = PostCreator.new(user, options)
|
||||||
post = creator.create
|
post = creator.create
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ class PostCreator
|
||||||
reply_to_post_number: @opts[:reply_to_post_number])
|
reply_to_post_number: @opts[:reply_to_post_number])
|
||||||
|
|
||||||
# Attributes we pass through to the post instance if present
|
# 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?
|
post.send("#{a}=", @opts[a]) if @opts[a].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,9 @@ Thanks for listening."
|
||||||
receiver.process
|
receiver.process
|
||||||
|
|
||||||
topic.posts.count.should == (start_count + 1)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue