mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 04:36:05 +08:00
UX: better rejection message when reply via email is too short
This commit is contained in:
@ -31,6 +31,7 @@ module Email
|
||||
class TopicNotFoundError < ProcessingError; end
|
||||
class TopicClosedError < ProcessingError; end
|
||||
class InvalidPost < ProcessingError; end
|
||||
class TooShortPost < ProcessingError; end
|
||||
class InvalidPostAction < ProcessingError; end
|
||||
class UnsubscribeNotAllowed < ProcessingError; end
|
||||
class EmailNotAllowed < ProcessingError; end
|
||||
@ -932,7 +933,14 @@ module Email
|
||||
user = options.delete(:user)
|
||||
result = NewPostManager.new(user, options).perform
|
||||
|
||||
raise InvalidPost, result.errors.full_messages.join("\n") if result.errors.any?
|
||||
errors = result.errors.full_messages
|
||||
if errors.any? do |message|
|
||||
message.include?(I18n.t("activerecord.attributes.post.raw").strip) &&
|
||||
message.include?(I18n.t("errors.messages.too_short", count: SiteSetting.min_post_length).strip)
|
||||
end
|
||||
raise TooShortPost
|
||||
end
|
||||
raise InvalidPost, errors.join("\n") if result.errors.any?
|
||||
|
||||
if result.post
|
||||
@incoming_email.update_columns(topic_id: result.post.topic_id, post_id: result.post.id)
|
||||
|
Reference in New Issue
Block a user