diff --git a/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 deleted file mode 100644 index 5f456c108fc..00000000000 --- a/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 +++ /dev/null @@ -1,3 +0,0 @@ -import AdminEmailSkippedController from "admin/controllers/admin-email-skipped"; - -export default AdminEmailSkippedController.extend(); diff --git a/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 new file mode 100644 index 00000000000..deb7f0771c6 --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6 @@ -0,0 +1,11 @@ +import IncomingEmail from 'admin/models/incoming-email'; + +export default Ember.Controller.extend({ + loadMore() { + return IncomingEmail.findAll(this.get("filter"), this.get("model.length")) + .then(incoming => { + if (incoming.length < 50) { this.get("model").set("allLoaded", true); } + this.get("model").addObjects(incoming); + }); + } +}); diff --git a/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 new file mode 100644 index 00000000000..2506a0cd999 --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin-email-logs.js.es6 @@ -0,0 +1,11 @@ +import EmailLog from 'admin/models/email-log'; + +export default Ember.Controller.extend({ + loadMore() { + return EmailLog.findAll(this.get("filter"), this.get("model.length")) + .then(logs => { + if (logs.length < 50) { this.get("model").set("allLoaded", true); } + this.get("model").addObjects(logs); + }); + } +}); diff --git a/app/assets/javascripts/admin/controllers/admin-email-received.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-received.js.es6 new file mode 100644 index 00000000000..69ebd5e4c49 --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin-email-received.js.es6 @@ -0,0 +1,9 @@ +import AdminEmailIncomingsController from 'admin/controllers/admin-email-incomings'; +import debounce from 'discourse/lib/debounce'; +import IncomingEmail from 'admin/models/incoming-email'; + +export default AdminEmailIncomingsController.extend({ + filterIncomingEmails: debounce(function() { + IncomingEmail.findAll(this.get("filter")).then(incomings => this.set("model", incomings)); + }, 250).observes("filter.{from,to,subject}") +}); diff --git a/app/assets/javascripts/admin/controllers/admin-email-rejected.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-rejected.js.es6 new file mode 100644 index 00000000000..317a669cd0e --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin-email-rejected.js.es6 @@ -0,0 +1,9 @@ +import AdminEmailIncomingsController from 'admin/controllers/admin-email-incomings'; +import debounce from 'discourse/lib/debounce'; +import IncomingEmail from 'admin/models/incoming-email'; + +export default AdminEmailIncomingsController.extend({ + filterIncomingEmails: debounce(function() { + IncomingEmail.findAll(this.get("filter")).then(incomings => this.set("model", incomings)); + }, 250).observes("filter.{from,to,subject,error}") +}); diff --git a/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 index 6ea640672c2..d73d640adca 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 @@ -1,12 +1,9 @@ +import AdminEmailLogsController from 'admin/controllers/admin-email-logs'; import debounce from 'discourse/lib/debounce'; import EmailLog from 'admin/models/email-log'; -export default Ember.Controller.extend({ - +export default AdminEmailLogsController.extend({ filterEmailLogs: debounce(function() { - var self = this; - EmailLog.findAll(this.get("filter")).then(function(logs) { - self.set("model", logs); - }); - }, 250).observes("filter.user", "filter.address", "filter.type", "filter.reply_key") + EmailLog.findAll(this.get("filter")).then(logs => this.set("model", logs)); + }, 250).observes("filter.{user,address,type,reply_key}") }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 index b392ea8e987..ae75d187155 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 @@ -1,8 +1,9 @@ +import AdminEmailLogsController from 'admin/controllers/admin-email-logs'; import debounce from 'discourse/lib/debounce'; +import EmailLog from 'admin/models/email-log'; -export default Ember.Controller.extend({ +export default AdminEmailLogsController.extend({ filterEmailLogs: debounce(function() { - const EmailLog = require('admin/models/email-log').default; EmailLog.findAll(this.get("filter")).then(logs => this.set("model", logs)); - }, 250).observes("filter.user", "filter.address", "filter.type", "filter.skipped_reason") + }, 250).observes("filter.{user,address,type,skipped_reason}") }); diff --git a/app/assets/javascripts/admin/models/email-log.js.es6 b/app/assets/javascripts/admin/models/email-log.js.es6 index ce7d8a2420d..2b19eeff4f5 100644 --- a/app/assets/javascripts/admin/models/email-log.js.es6 +++ b/app/assets/javascripts/admin/models/email-log.js.es6 @@ -4,7 +4,7 @@ const EmailLog = Discourse.Model.extend({}); EmailLog.reopenClass({ - create: function(attrs) { + create(attrs) { attrs = attrs || {}; if (attrs.user) { @@ -14,16 +14,15 @@ EmailLog.reopenClass({ return this._super(attrs); }, - findAll: function(filter) { + findAll(filter, offset) { filter = filter || {}; - var status = filter.status || "all"; + offset = offset || 0; + + const status = filter.status || "sent"; filter = _.omit(filter, "status"); - return Discourse.ajax("/admin/email/" + status + ".json", { data: filter }).then(function(logs) { - return _.map(logs, function (log) { - return EmailLog.create(log); - }); - }); + return Discourse.ajax(`/admin/email/${status}.json?offset=${offset}`, { data: filter }) + .then(logs => _.map(logs, log => EmailLog.create(log))); } }); diff --git a/app/assets/javascripts/admin/models/incoming-email.js.es6 b/app/assets/javascripts/admin/models/incoming-email.js.es6 new file mode 100644 index 00000000000..677fbebbc06 --- /dev/null +++ b/app/assets/javascripts/admin/models/incoming-email.js.es6 @@ -0,0 +1,29 @@ +import AdminUser from 'admin/models/admin-user'; + +const IncomingEmail = Discourse.Model.extend({}); + +IncomingEmail.reopenClass({ + + create(attrs) { + attrs = attrs || {}; + + if (attrs.user) { + attrs.user = AdminUser.create(attrs.user); + } + + return this._super(attrs); + }, + + findAll(filter, offset) { + filter = filter || {}; + offset = offset || 0; + + const status = filter.status || "received"; + filter = _.omit(filter, "status"); + + return Discourse.ajax(`/admin/email/${status}.json?offset=${offset}`, { data: filter }) + .then(incomings => _.map(incomings, incoming => IncomingEmail.create(incoming))); + } +}); + +export default IncomingEmail; diff --git a/app/assets/javascripts/admin/routes/admin-email-all.js.es6 b/app/assets/javascripts/admin/routes/admin-email-all.js.es6 deleted file mode 100644 index be310b9c385..00000000000 --- a/app/assets/javascripts/admin/routes/admin-email-all.js.es6 +++ /dev/null @@ -1,2 +0,0 @@ -import AdminEmailLogs from 'admin/routes/admin-email-logs'; -export default AdminEmailLogs.extend({ status: "all" }); diff --git a/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 b/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 new file mode 100644 index 00000000000..7eefb322cbb --- /dev/null +++ b/app/assets/javascripts/admin/routes/admin-email-incomings.js.es6 @@ -0,0 +1,14 @@ +import IncomingEmail from 'admin/models/incoming-email'; + +export default Discourse.Route.extend({ + + model() { + return IncomingEmail.findAll({ status: this.get("status") }); + }, + + setupController(controller, model) { + controller.set("model", model); + controller.set("filter", { status: this.get("status") }); + } + +}); diff --git a/app/assets/javascripts/admin/routes/admin-email-index.js.es6 b/app/assets/javascripts/admin/routes/admin-email-index.js.es6 index 9e8aa7d8990..1b75e39f6f8 100644 --- a/app/assets/javascripts/admin/routes/admin-email-index.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-email-index.js.es6 @@ -1,11 +1,11 @@ import EmailSettings from 'admin/models/email-settings'; export default Discourse.Route.extend({ - model: function() { + model() { return EmailSettings.find(); }, - renderTemplate: function() { + renderTemplate() { this.render('admin/templates/email_index', { into: 'adminEmail' }); } }); diff --git a/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 b/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 index f6cbd90eae4..27791bcaec6 100644 --- a/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-email-logs.js.es6 @@ -1,27 +1,14 @@ import EmailLog from 'admin/models/email-log'; -/** - Handles routes related to viewing email logs. - - @class AdminEmailSentRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ export default Discourse.Route.extend({ - model: function() { + model() { return EmailLog.findAll({ status: this.get("status") }); }, - setupController: function(controller, model) { + setupController(controller, model) { controller.set("model", model); - // resets the filters controller.set("filter", { status: this.get("status") }); - }, - - renderTemplate: function() { - this.render("admin/templates/email_" + this.get("status"), { into: "adminEmail" }); } }); diff --git a/app/assets/javascripts/admin/routes/admin-email-received.js.es6 b/app/assets/javascripts/admin/routes/admin-email-received.js.es6 new file mode 100644 index 00000000000..4bea62c1eb2 --- /dev/null +++ b/app/assets/javascripts/admin/routes/admin-email-received.js.es6 @@ -0,0 +1,2 @@ +import AdminEmailIncomings from 'admin/routes/admin-email-incomings'; +export default AdminEmailIncomings.extend({ status: "received" }); diff --git a/app/assets/javascripts/admin/routes/admin-email-rejected.js.es6 b/app/assets/javascripts/admin/routes/admin-email-rejected.js.es6 new file mode 100644 index 00000000000..ed662e21182 --- /dev/null +++ b/app/assets/javascripts/admin/routes/admin-email-rejected.js.es6 @@ -0,0 +1,2 @@ +import AdminEmailIncomings from 'admin/routes/admin-email-incomings'; +export default AdminEmailIncomings.extend({ status: "rejected" }); diff --git a/app/assets/javascripts/admin/routes/admin-route-map.js.es6 b/app/assets/javascripts/admin/routes/admin-route-map.js.es6 index 406a0011706..3626ea48d31 100644 --- a/app/assets/javascripts/admin/routes/admin-route-map.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-route-map.js.es6 @@ -8,9 +8,10 @@ export default { }); this.resource('adminEmail', { path: '/email'}, function() { - this.route('all'); this.route('sent'); this.route('skipped'); + this.route('received'); + this.route('rejected'); this.route('previewDigest', { path: '/preview-digest' }); }); diff --git a/app/assets/javascripts/admin/templates/email-received.hbs b/app/assets/javascripts/admin/templates/email-received.hbs new file mode 100644 index 00000000000..95e0cb2dc57 --- /dev/null +++ b/app/assets/javascripts/admin/templates/email-received.hbs @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + {{#each email in model}} + + + + + + + {{else}} + + {{/each}} + +
{{i18n 'admin.email.time'}}{{i18n 'admin.email.incoming_emails.from_address'}}{{i18n 'admin.email.incoming_emails.to_addresses'}}{{i18n 'admin.email.incoming_emails.subject'}}
{{i18n 'admin.email.logs.filters.title'}}{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}}{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}}{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}}
{{format-date email.created_at}} +
+ {{#if email.user}} + {{#link-to 'adminUser' email.user}} + {{avatar email.user imageSize="tiny"}} + {{email.from_address}} + {{/link-to}} + {{else}} + — + {{/if}} +
+
+ {{#each to in email.to_addresses}} +

{{unbound to}}

+ {{/each}} + {{#each cc in email.cc_addresses}} +

{{unbound cc}}

+ {{/each}} +
+ {{#if email.post_url}} + {{email.subject}} + {{else}} + {{email.subject}} + {{/if}} +
{{i18n 'admin.email.incoming_emails.none'}}
+ +{{conditional-loading-spinner condition=view.loading}} diff --git a/app/assets/javascripts/admin/templates/email-rejected.hbs b/app/assets/javascripts/admin/templates/email-rejected.hbs new file mode 100644 index 00000000000..6e055ffb2fa --- /dev/null +++ b/app/assets/javascripts/admin/templates/email-rejected.hbs @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + {{#each email in model}} + + + + + + + + {{else}} + + {{/each}} + +
{{i18n 'admin.email.time'}}{{i18n 'admin.email.incoming_emails.from_address'}}{{i18n 'admin.email.incoming_emails.to_addresses'}}{{i18n 'admin.email.incoming_emails.subject'}}{{i18n 'admin.email.incoming_emails.error'}}
{{i18n 'admin.email.logs.filters.title'}}{{text-field value=filter.from placeholderKey="admin.email.incoming_emails.filters.from_placeholder"}}{{text-field value=filter.to placeholderKey="admin.email.incoming_emails.filters.to_placeholder"}}{{text-field value=filter.subject placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"}}{{text-field value=filter.error placeholderKey="admin.email.incoming_emails.filters.error_placeholder"}}
{{format-date email.created_at}} +
+ {{#if email.user}} + {{#link-to 'adminUser' email.user}} + {{avatar email.user imageSize="tiny"}} + {{email.from_address}} + {{/link-to}} + {{else}} + — + {{/if}} +
+
+ {{#each to in email.to_addresses}} +

{{unbound to}}

+ {{/each}} + {{#each cc in email.cc_addresses}} +

{{unbound cc}}

+ {{/each}} +
{{email.subject}}{{email.error}}
{{i18n 'admin.email.incoming_emails.none'}}
+ +{{conditional-loading-spinner condition=view.loading}} diff --git a/app/assets/javascripts/admin/templates/email_sent.hbs b/app/assets/javascripts/admin/templates/email-sent.hbs similarity index 93% rename from app/assets/javascripts/admin/templates/email_sent.hbs rename to app/assets/javascripts/admin/templates/email-sent.hbs index 0287492f178..4e4f5dbf77a 100644 --- a/app/assets/javascripts/admin/templates/email_sent.hbs +++ b/app/assets/javascripts/admin/templates/email-sent.hbs @@ -1,4 +1,4 @@ - +
@@ -37,3 +37,5 @@ {{/each}}
{{i18n 'admin.email.sent_at'}}
+ +{{conditional-loading-spinner condition=view.loading}} diff --git a/app/assets/javascripts/admin/templates/email_skipped.hbs b/app/assets/javascripts/admin/templates/email-skipped.hbs similarity index 94% rename from app/assets/javascripts/admin/templates/email_skipped.hbs rename to app/assets/javascripts/admin/templates/email-skipped.hbs index c2c6d261a7e..d983b093785 100644 --- a/app/assets/javascripts/admin/templates/email_skipped.hbs +++ b/app/assets/javascripts/admin/templates/email-skipped.hbs @@ -1,4 +1,4 @@ - +
@@ -37,3 +37,5 @@ {{/each}}
{{i18n 'admin.email.time'}}
+ +{{conditional-loading-spinner condition=view.loading}} diff --git a/app/assets/javascripts/admin/templates/email.hbs b/app/assets/javascripts/admin/templates/email.hbs index e14d8ba4b5e..1a7d5bbfe7b 100644 --- a/app/assets/javascripts/admin/templates/email.hbs +++ b/app/assets/javascripts/admin/templates/email.hbs @@ -1,10 +1,11 @@ {{#admin-nav}} {{nav-item route='adminEmail.index' label='admin.email.settings'}} - {{nav-item route='adminEmail.all' label='admin.email.all'}} + {{nav-item route='adminEmail.previewDigest' label='admin.email.preview_digest'}} + {{nav-item route='adminCustomizeEmailTemplates' label='admin.email.templates'}} {{nav-item route='adminEmail.sent' label='admin.email.sent'}} {{nav-item route='adminEmail.skipped' label='admin.email.skipped'}} - {{nav-item route='adminEmail.previewDigest' label='admin.email.preview_digest'}} - {{nav-item route='adminCustomizeEmailTemplates' label='admin.customize.email_templates.title'}} + {{nav-item route='adminEmail.received' label='admin.email.received'}} + {{nav-item route='adminEmail.rejected' label='admin.email.rejected'}} {{/admin-nav}}
diff --git a/app/assets/javascripts/admin/templates/email_all.hbs b/app/assets/javascripts/admin/templates/email_all.hbs deleted file mode 100644 index c2c6d261a7e..00000000000 --- a/app/assets/javascripts/admin/templates/email_all.hbs +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - {{#each l in model}} - - - - - - - - {{else}} - - {{/each}} - -
{{i18n 'admin.email.time'}}{{i18n 'admin.email.user'}}{{i18n 'admin.email.to_address'}}{{i18n 'admin.email.email_type'}}{{i18n 'admin.email.skipped_reason'}}
{{i18n 'admin.email.logs.filters.title'}}{{text-field value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}}{{text-field value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}}{{text-field value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}}{{text-field value=filter.skipped_reason placeholderKey="admin.email.logs.filters.skipped_reason_placeholder"}}
{{format-date l.created_at}} - {{#if l.user}} - {{#link-to 'adminUser' l.user}}{{avatar l.user imageSize="tiny"}}{{/link-to}} - {{#link-to 'adminUser' l.user}}{{l.user.username}}{{/link-to}} - {{else}} - — - {{/if}} - {{l.to_address}}{{l.email_type}}{{l.skipped_reason}}
{{i18n 'admin.email.logs.none'}}
diff --git a/app/assets/javascripts/admin/views/admin-email-incomings.js.es6 b/app/assets/javascripts/admin/views/admin-email-incomings.js.es6 new file mode 100644 index 00000000000..6360f857b71 --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-incomings.js.es6 @@ -0,0 +1,14 @@ +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { + loading: false, + eyelineSelector: ".email-list tr", + + actions: { + loadMore() { + if (this.get("loading") || this.get("model.allLoaded")) { return; } + this.set("loading", true); + return this.get("controller").loadMore().then(() => this.set("loading", false)); + } + } +}); diff --git a/app/assets/javascripts/admin/views/admin-email-logs.js.es6 b/app/assets/javascripts/admin/views/admin-email-logs.js.es6 new file mode 100644 index 00000000000..6360f857b71 --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-logs.js.es6 @@ -0,0 +1,14 @@ +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { + loading: false, + eyelineSelector: ".email-list tr", + + actions: { + loadMore() { + if (this.get("loading") || this.get("model.allLoaded")) { return; } + this.set("loading", true); + return this.get("controller").loadMore().then(() => this.set("loading", false)); + } + } +}); diff --git a/app/assets/javascripts/admin/views/admin-email-received.js.es6 b/app/assets/javascripts/admin/views/admin-email-received.js.es6 new file mode 100644 index 00000000000..da0d8de157c --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-received.js.es6 @@ -0,0 +1,5 @@ +import AdminEmailIncomingsView from "admin/views/admin-email-incomings"; + +export default AdminEmailIncomingsView.extend({ + templateName: "admin/templates/email-received" +}); diff --git a/app/assets/javascripts/admin/views/admin-email-rejected.js.es6 b/app/assets/javascripts/admin/views/admin-email-rejected.js.es6 new file mode 100644 index 00000000000..b89fe8d46a0 --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-rejected.js.es6 @@ -0,0 +1,5 @@ +import AdminEmailIncomingsView from "admin/views/admin-email-incomings"; + +export default AdminEmailIncomingsView.extend({ + templateName: "admin/templates/email-rejected" +}); diff --git a/app/assets/javascripts/admin/views/admin-email-sent.js.es6 b/app/assets/javascripts/admin/views/admin-email-sent.js.es6 new file mode 100644 index 00000000000..d007a79644f --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-sent.js.es6 @@ -0,0 +1,5 @@ +import AdminEmailLogsView from "admin/views/admin-email-logs"; + +export default AdminEmailLogsView.extend({ + templateName: "admin/templates/email-sent" +}); diff --git a/app/assets/javascripts/admin/views/admin-email-skipped.js.es6 b/app/assets/javascripts/admin/views/admin-email-skipped.js.es6 new file mode 100644 index 00000000000..e3c44670992 --- /dev/null +++ b/app/assets/javascripts/admin/views/admin-email-skipped.js.es6 @@ -0,0 +1,5 @@ +import AdminEmailLogsView from "admin/views/admin-email-logs"; + +export default AdminEmailLogsView.extend({ + templateName: "admin/templates/email-skipped" +}); diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 57e7fce2e1d..7318e215d2d 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -1769,6 +1769,30 @@ table#user-badges { } } +// Emails + +.email-list { + .filters input { + width: 100%; + } + .time { + width: 50px; + } + .username div { + max-width: 180px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .addresses p { + margin: 2px 0; + max-width: 200px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +} + // Mobile specific styles // Mobile view text-inputs need some padding .mobile-view .admin-contents { diff --git a/app/controllers/admin/email_controller.rb b/app/controllers/admin/email_controller.rb index 5ae6a320566..4f9837e8b72 100644 --- a/app/controllers/admin/email_controller.rb +++ b/app/controllers/admin/email_controller.rb @@ -17,11 +17,6 @@ class Admin::EmailController < Admin::AdminController end end - def all - email_logs = filter_email_logs(EmailLog.all, params) - render_serialized(email_logs, EmailLogSerializer) - end - def sent email_logs = filter_email_logs(EmailLog.sent, params) render_serialized(email_logs, EmailLogSerializer) @@ -32,6 +27,16 @@ class Admin::EmailController < Admin::AdminController render_serialized(email_logs, EmailLogSerializer) end + def received + incoming_emails = filter_incoming_emails(IncomingEmail, params) + render_serialized(incoming_emails, IncomingEmailSerializer) + end + + def rejected + incoming_emails = filter_incoming_emails(IncomingEmail.errored, params) + render_serialized(incoming_emails, IncomingEmailSerializer) + end + def preview_digest params.require(:last_seen_at) params.require(:username) @@ -49,13 +54,33 @@ class Admin::EmailController < Admin::AdminController private def filter_email_logs(email_logs, params) - email_logs = email_logs.limit(50).includes(:user).order("email_logs.created_at desc").references(:user) - email_logs = email_logs.where("users.username LIKE ?", "%#{params[:user]}%") if params[:user].present? - email_logs = email_logs.where("email_logs.to_address LIKE ?", "%#{params[:address]}%") if params[:address].present? - email_logs = email_logs.where("email_logs.email_type LIKE ?", "%#{params[:type]}%") if params[:type].present? - email_logs = email_logs.where("email_logs.reply_key LIKE ?", "%#{params[:reply_key]}%") if params[:reply_key].present? - email_logs = email_logs.where("email_logs.skipped_reason LIKE ?", "%#{params[:skipped_reason]}%") if params[:skipped_reason].present? - email_logs.to_a + email_logs = email_logs.includes(:user) + .references(:user) + .order(created_at: :desc) + .offset(params[:offset] || 0) + .limit(50) + + email_logs = email_logs.where("users.username ILIKE ?", "%#{params[:user]}%") if params[:user].present? + email_logs = email_logs.where("email_logs.to_address ILIKE ?", "%#{params[:address]}%") if params[:address].present? + email_logs = email_logs.where("email_logs.email_type ILIKE ?", "%#{params[:type]}%") if params[:type].present? + email_logs = email_logs.where("email_logs.reply_key ILIKE ?", "%#{params[:reply_key]}%") if params[:reply_key].present? + email_logs = email_logs.where("email_logs.skipped_reason ILIKE ?", "%#{params[:skipped_reason]}%") if params[:skipped_reason].present? + + email_logs + end + + def filter_incoming_emails(incoming_emails, params) + incoming_emails = incoming_emails.includes(:user, { post: :topic }) + .order(created_at: :desc) + .offset(params[:offset] || 0) + .limit(50) + + incoming_emails = incoming_emails.where("from_address ILIKE ?", "%#{params[:from]}%") if params[:from].present? + incoming_emails = incoming_emails.where("to_addresses ILIKE ? OR cc_addresses ILIKE ?", "%#{params[:to]}%") if params[:to].present? + incoming_emails = incoming_emails.where("subject ILIKE ?", "%#{params[:subject]}%") if params[:subject].present? + incoming_emails = incoming_emails.where("error ILIKE ?", "%#{params[:error]}%") if params[:error].present? + + incoming_emails end def delivery_settings diff --git a/app/jobs/scheduled/poll_mailbox.rb b/app/jobs/scheduled/poll_mailbox.rb index 552833731ab..2d141e3b1be 100644 --- a/app/jobs/scheduled/poll_mailbox.rb +++ b/app/jobs/scheduled/poll_mailbox.rb @@ -1,6 +1,3 @@ -# -# Connects to a mailbox and checks for replies -# require 'net/pop' require_dependency 'email/receiver' require_dependency 'email/sender' @@ -10,6 +7,7 @@ module Jobs class PollMailbox < Jobs::Scheduled every SiteSetting.pop3_polling_period_mins.minutes sidekiq_options retry: false + include Email::BuildEmailHelper def execute(args) @@ -17,53 +15,42 @@ module Jobs poll_pop3 if SiteSetting.pop3_polling_enabled? end - def handle_mail(mail) + def process_popmail(popmail) begin - mail_string = mail.pop + mail_string = popmail.pop Email::Receiver.new(mail_string).process rescue => e handle_failure(mail_string, e) - ensure - mail.delete end end def handle_failure(mail_string, e) Rails.logger.warn("Email can not be processed: #{e}\n\n#{mail_string}") if SiteSetting.log_mail_processing_failures + message_template = case e + when Email::Receiver::EmptyEmailError then :email_reject_empty + when Email::Receiver::NoBodyDetectedError then :email_reject_empty + when Email::Receiver::NoMessageIdError then :email_reject_no_message_id + when Email::Receiver::AutoGeneratedEmailError then :email_reject_auto_generated + when Email::Receiver::InactiveUserError then :email_reject_inactive_user + when Email::Receiver::BadDestinationAddress then :email_reject_bad_destination_address + when Email::Receiver::StrangersNotAllowedError then :email_reject_strangers_not_allowed + when Email::Receiver::InsufficientTrustLevelError then :email_reject_insufficient_trust_level + when Email::Receiver::ReplyUserNotMatchingError then :email_reject_reply_user_not_matching + when Email::Receiver::TopicNotFoundError then :email_reject_topic_not_found + when Email::Receiver::TopicClosedError then :email_reject_topic_closed + when Email::Receiver::InvalidPost then :email_reject_invalid_post + when ActiveRecord::Rollback then :email_reject_invalid_post + when Email::Receiver::InvalidPostAction then :email_reject_invalid_post_action + when Discourse::InvalidAccess then :email_reject_invalid_access + end + template_args = {} - case e - when Email::Receiver::UserNotSufficientTrustLevelError - message_template = :email_reject_trust_level - when Email::Receiver::UserNotFoundError - message_template = :email_reject_no_account - when Email::Receiver::EmptyEmailError - message_template = :email_reject_empty - when Email::Receiver::EmailUnparsableError - message_template = :email_reject_parsing - when Email::Receiver::EmailLogNotFound - message_template = :email_reject_reply_key - when Email::Receiver::BadDestinationAddress - message_template = :email_reject_destination - when Email::Receiver::TopicNotFoundError - message_template = :email_reject_topic_not_found - when Email::Receiver::TopicClosedError - message_template = :email_reject_topic_closed - when Email::Receiver::AutoGeneratedEmailError - message_template = :email_reject_auto_generated - when Discourse::InvalidAccess - message_template = :email_reject_invalid_access - when ActiveRecord::Rollback - message_template = :email_reject_post_error - when Email::Receiver::InvalidPost - if e.message.length < 6 - message_template = :email_reject_post_error - else - message_template = :email_reject_post_error_specified - template_args[:post_error] = e.message - end - else - message_template = nil + + # there might be more information available in the exception + if message_template == :email_reject_invalid_post && e.message.size > 6 + message_template = :email_reject_invalid_post_specified + template_args[:post_error] = e.message end if message_template @@ -81,19 +68,16 @@ module Jobs end def poll_pop3 - connection = Net::POP3.new(SiteSetting.pop3_polling_host, SiteSetting.pop3_polling_port) - connection.enable_ssl if SiteSetting.pop3_polling_ssl + pop3 = Net::POP3.new(SiteSetting.pop3_polling_host, SiteSetting.pop3_polling_port) + pop3.enable_ssl if SiteSetting.pop3_polling_ssl - connection.start(SiteSetting.pop3_polling_username, SiteSetting.pop3_polling_password) do |pop| - unless pop.mails.empty? - pop.each { |mail| handle_mail(mail) } + pop3.start(SiteSetting.pop3_polling_username, SiteSetting.pop3_polling_password) do |pop| + pop.delete_all do |p| + process_popmail(p) end - pop.finish end rescue Net::POPAuthenticationError => e Discourse.handle_job_exception(e, error_context(@args, "Signing in to poll incoming email")) - rescue Net::POPError => e - Discourse.handle_job_exception(e, error_context(@args, "Generic POP error")) end end diff --git a/app/mailers/rejection_mailer.rb b/app/mailers/rejection_mailer.rb index 1c1a7558b13..2821f9abf6a 100644 --- a/app/mailers/rejection_mailer.rb +++ b/app/mailers/rejection_mailer.rb @@ -3,13 +3,23 @@ require_dependency 'email/message_builder' class RejectionMailer < ActionMailer::Base include Email::BuildEmailHelper - DISALLOWED_TEMPLATE_ARGS = [:to, :from, :base_url, + DISALLOWED_TEMPLATE_ARGS = [:to, + :from, + :base_url, :user_preferences_url, - :include_respond_instructions, :html_override, - :add_unsubscribe_link, :respond_instructions, - :style, :body, :post_id, :topic_id, :subject, - :template, :allow_reply_by_email, - :private_reply, :from_alias] + :include_respond_instructions, + :html_override, + :add_unsubscribe_link, + :respond_instructions, + :style, + :body, + :post_id, + :topic_id, + :subject, + :template, + :allow_reply_by_email, + :private_reply, + :from_alias] # Send an email rejection message. # diff --git a/app/models/incoming_email.rb b/app/models/incoming_email.rb new file mode 100644 index 00000000000..1ba3fb88c3f --- /dev/null +++ b/app/models/incoming_email.rb @@ -0,0 +1,32 @@ +class IncomingEmail < ActiveRecord::Base + belongs_to :user + belongs_to :topic + belongs_to :post + + scope :errored, -> { where.not(error: nil) } +end + +# == Schema Information +# +# Table name: incoming_emails +# +# id :integer not null, primary key +# user_id :integer +# topic_id :integer +# post_id :integer +# raw :text +# error :text +# message_id :text +# from_address :text +# to_addresses :text +# cc_addresses :text +# subject :text +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_incoming_emails_on_created_at (created_at) +# index_incoming_emails_on_error (error) +# index_incoming_emails_on_message_id (message_id) +# diff --git a/app/models/topic.rb b/app/models/topic.rb index 39b233977c2..171c7fd066c 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -514,6 +514,12 @@ class Topic < ActiveRecord::Base true end + def add_small_action(user, action_code, who=nil) + custom_fields = {} + custom_fields["action_code_who"] = who if who.present? + add_moderator_post(user, nil, post_type: Post.types[:small_action], action_code: action_code, custom_fields: custom_fields) + end + def add_moderator_post(user, text, opts=nil) opts ||= {} new_post = nil @@ -562,14 +568,7 @@ class Topic < ActiveRecord::Base topic_user = topic_allowed_users.find_by(user_id: user.id) if topic_user topic_user.destroy - # add small action - self.add_moderator_post( - removed_by, - nil, - post_type: Post.types[:small_action], - action_code: "removed_user", - custom_fields: { action_code_who: user.username } - ) + add_small_action(removed_by, "removed_user", user.username) return true end end @@ -584,13 +583,7 @@ class Topic < ActiveRecord::Base user = User.find_by_username_or_email(username_or_email) if user && topic_allowed_users.create!(user_id: user.id) # Create a small action message - self.add_moderator_post( - invited_by, - nil, - post_type: Post.types[:small_action], - action_code: "invited_user", - custom_fields: { action_code_who: user.username } - ) + add_small_action(invited_by, "invited_user", user.username) # Notify the user they've been invited user.notifications.create(notification_type: Notification.types[:invited_to_private_message], diff --git a/app/models/user.rb b/app/models/user.rb index 0d81fa1b94f..a0669751971 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -169,8 +169,7 @@ class User < ActiveRecord::Base def self.suggest_name(email) return "" if email.blank? - name = email.split(/[@\+]/)[0].gsub(".", " ") - name.titleize + email[/\A[^@]+/].tr(".", " ").titleize end def self.find_by_username_or_email(username_or_email) diff --git a/app/serializers/incoming_email_serializer.rb b/app/serializers/incoming_email_serializer.rb new file mode 100644 index 00000000000..53916e24cd5 --- /dev/null +++ b/app/serializers/incoming_email_serializer.rb @@ -0,0 +1,32 @@ +class IncomingEmailSerializer < ApplicationSerializer + + attributes :id, + :created_at, + :from_address, + :to_addresses, + :cc_addresses, + :subject, + :error, + :post_url + + has_one :user, serializer: BasicUserSerializer, embed: :objects + + def post_url + object.post.url + end + + def include_post_url? + object.post.present? + end + + def to_addresses + return if object.to_addresses.blank? + object.to_addresses.split(";") + end + + def cc_addresses + return if object.cc_addresses.blank? + object.cc_addresses.split(";") + end + +end diff --git a/app/services/spam_rule/auto_block.rb b/app/services/spam_rule/auto_block.rb index 2a5fa9dd66c..8a6cea9f308 100644 --- a/app/services/spam_rule/auto_block.rb +++ b/app/services/spam_rule/auto_block.rb @@ -18,7 +18,8 @@ class SpamRule::AutoBlock def block? @user.blocked? or - (!@user.has_trust_level?(TrustLevel[1]) and + (!@user.staged? and + !@user.has_trust_level?(TrustLevel[1]) and SiteSetting.num_flags_to_block_new_user > 0 and SiteSetting.num_users_to_block_new_user > 0 and num_spam_flags_against_user >= SiteSetting.num_flags_to_block_new_user and diff --git a/app/services/spam_rule/flag_sockpuppets.rb b/app/services/spam_rule/flag_sockpuppets.rb index b6223df7211..4c96a0687fc 100644 --- a/app/services/spam_rule/flag_sockpuppets.rb +++ b/app/services/spam_rule/flag_sockpuppets.rb @@ -21,6 +21,8 @@ class SpamRule::FlagSockpuppets !first_post.user.staff? && !@post.user.staff? && + !first_post.user.staged? && + !@post.user.staged? && @post.user != first_post.user && @post.user.ip_address == first_post.user.ip_address && @post.user.new_user? && diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 3974e91debe..e026c77c9ba 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2190,14 +2190,17 @@ en: email: - title: "Email" + title: "Emails" settings: "Settings" - all: "All" + templates: "Templates" + preview_digest: "Preview Digest" sending_test: "Sending test Email..." error: "ERROR - %{server_error}" test_error: "There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again." sent: "Sent" skipped: "Skipped" + received: "Received" + rejected: "Rejected" sent_at: "Sent At" time: "Time" user: "User" @@ -2207,7 +2210,6 @@ en: send_test: "Send Test Email" sent_test: "sent!" delivery_method: "Delivery Method" - preview_digest: "Preview Digest" preview_digest_desc: "Preview the content of the digest emails sent to inactive users." refresh: "Refresh" format: "Format" @@ -2216,6 +2218,19 @@ en: last_seen_user: "Last Seen User:" reply_key: "Reply Key" skipped_reason: "Skip Reason" + incoming_emails: + from_address: "From" + to_addresses: "To" + cc_addresses: "Cc" + subject: "Subject" + error: "Error" + none: "No incoming emails found." + filters: + from_placeholder: "from@example.com" + to_placeholder: "to@example.com" + cc_placeholder: "cc@example.com" + subject_placeholder: "Subject..." + error_placeholder: "Error" logs: none: "No logs found." filters: diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index add5f8fb881..2f628d66e34 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -945,8 +945,6 @@ en: verbose_localization: "Show extended localization tips in the UI" previous_visit_timeout_hours: "How long a visit lasts before we consider it the 'previous' visit, in hours" - allow_staged_accounts: "[BETA] Automatically create staged accounts for incoming emails." - rate_limit_create_topic: "After creating a topic, users must wait (n) seconds before creating another topic." rate_limit_create_post: "After posting, users must wait (n) seconds before creating another post." rate_limit_new_user_create_topic: "After creating a topic, new users must wait (n) seconds before creating another topic." @@ -1744,13 +1742,34 @@ en: subject_template: "Data export failed" text_body_template: "We're sorry, but your data export failed. Please check the logs or contact a staff member." - email_reject_trust_level: + email_reject_insufficient_trust_level: subject_template: "[%{site_name}] Email issue -- Insufficient Trust Level" text_body_template: | We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. Your account does not have the required trust level to post new topics to this email address. If you believe this is in error, contact a staff member. + email_reject_inactive_user: + subject_template: "[%{site_name}] Email issue -- Inactive User" + text_body_template: | + We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. + + Your account associated with this email address is not activated. Please activate your account before sending emails in. + + email_reject_reply_user_not_matching: + subject_template: "[%{site_name}] Email issue -- Reply User Not Matching" + text_body_template: | + We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. + + The original notification was not sent to this email address. Try sending from a different email address, or contact a staff member. + + email_reject_no_message_id: + subject_template: "[%{site_name}] Email issue -- No Message Id" + text_body_template: | + We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. + + There was no Message-Id header in the email. Try sending from a different email address, or contact a staff member. + email_reject_no_account: subject_template: "[%{site_name}] Email issue -- Unknown Account" text_body_template: | @@ -1781,14 +1800,21 @@ en: Your account does not have the privileges to post new topics in that category. If you believe this is in error, contact a staff member. - email_reject_post_error: + email_reject_strangers_not_allowed: + subject_template: "[%{site_name}] Email issue -- Invalid Access" + text_body_template: | + We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. + + The category you sent this email to does not allow emails from unrestricted accounts. If you believe this is in error, contact a staff member. + + email_reject_invalid_post: subject_template: "[%{site_name}] Email issue -- Posting error" text_body_template: | We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. Some possible causes are: complex formatting, message too large, message too small. Please try again, or post via the website if this continues. - email_reject_post_error_specified: + email_reject_invalid_post_specified: subject_template: "[%{site_name}] Email issue -- Posting error" text_body_template: | We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. @@ -1799,6 +1825,14 @@ en: If you can correct the problem, please try again. + email_reject_invalid_post_action: + subject_template: "[%{site_name}] Email issue -- Invalid Post Action" + text_body_template: | + We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. + + The Post Action was not recognized. Please try again, or post via the website if this continues. + + email_reject_reply_key: subject_template: "[%{site_name}] Email issue -- Unknown Reply Key" text_body_template: | @@ -1806,12 +1840,12 @@ en: The provided reply key is invalid or unknown, so we don't know what this email is in reply to. Contact a staff member. - email_reject_destination: + email_reject_bad_destination_address: subject_template: "[%{site_name}] Email issue -- Unknown To: Address" text_body_template: | We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. - None of the destination addresses are recognized. Please make sure that the site address is in the To: line (not Cc: or Bcc:), and that you are sending to the correct email address provided by staff. + None of the destination addresses are recognized. Please make sure that you are sending to the correct email address provided by staff. email_reject_topic_not_found: subject_template: "[%{site_name}] Email issue -- Topic Not Found" diff --git a/config/routes.rb b/config/routes.rb index 60d3c615148..270f749c3d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -119,9 +119,10 @@ Discourse::Application.routes.draw do resources :email, constraints: AdminConstraint.new do collection do post "test" - get "all" get "sent" get "skipped" + get "received" + get "rejected" get "preview-digest" => "email#preview_digest" post "handle_mail" end diff --git a/config/site_settings.yml b/config/site_settings.yml index 8102f9a7ebf..5f0687db9d5 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -806,8 +806,6 @@ developer: default: 500 client: true hidden: true - allow_staged_accounts: - default: false embedding: feed_polling_enabled: diff --git a/db/migrate/20151109124147_drop_group_managers.rb b/db/migrate/20151109124147_drop_group_managers.rb index 2e197cfb591..41e07141c1a 100644 --- a/db/migrate/20151109124147_drop_group_managers.rb +++ b/db/migrate/20151109124147_drop_group_managers.rb @@ -10,6 +10,6 @@ class DropGroupManagers < ActiveRecord::Migration end def down - raise ActiveRecord::IrriversableMigration + raise ActiveRecord::IrreversibleMigration end end diff --git a/db/migrate/20160113160742_create_incoming_emails.rb b/db/migrate/20160113160742_create_incoming_emails.rb new file mode 100644 index 00000000000..34502bace5c --- /dev/null +++ b/db/migrate/20160113160742_create_incoming_emails.rb @@ -0,0 +1,24 @@ +class CreateIncomingEmails < ActiveRecord::Migration + def change + create_table :incoming_emails do |t| + t.integer :user_id + t.integer :topic_id + t.integer :post_id + + t.text :raw + t.text :error + + t.text :message_id + t.text :from_address + t.text :to_addresses + t.text :cc_addresses + t.text :subject + + t.timestamps null: false + end + + add_index :incoming_emails, :created_at + add_index :incoming_emails, :message_id + add_index :incoming_emails, :error + end +end diff --git a/db/migrate/20160118233631_backfill_incoming_emails.rb b/db/migrate/20160118233631_backfill_incoming_emails.rb new file mode 100644 index 00000000000..f2d1f0d7259 --- /dev/null +++ b/db/migrate/20160118233631_backfill_incoming_emails.rb @@ -0,0 +1,28 @@ +class BackfillIncomingEmails < ActiveRecord::Migration + def up + execute <<-SQL + INSERT INTO incoming_emails (post_id, created_at, updated_at, user_id, topic_id, message_id, from_address, to_addresses, subject) + SELECT posts.id + , posts.created_at + , posts.created_at + , posts.user_id + , posts.topic_id + , array_to_string(regexp_matches(posts.raw_email, '^\s*Message-Id: .*<([^>]+)>', 'im'), '') + , users.email + , array_to_string(regexp_matches(array_to_string(regexp_matches(posts.raw_email, '^to:.+$', 'im'), ''), '[^<\s"''(]+@[^>\s"'')]+'), '') + , topics.title + FROM posts + JOIN topics ON posts.topic_id = topics.id + JOIN users ON posts.user_id = users.id + WHERE posts.user_id IS NOT NULL + AND posts.topic_id IS NOT NULL + AND posts.via_email = 't' + AND posts.raw_email ~* 'Message-Id' + ORDER BY posts.id; + SQL + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/discourse.sublime-project b/discourse.sublime-project index 20854867ba8..6ec5f18c583 100644 --- a/discourse.sublime-project +++ b/discourse.sublime-project @@ -16,9 +16,7 @@ { "path": "script" }, { "path": "spec" }, { "path": "vendor" }, - { "path": "test", - "folder_exclude_patterns": ["fixtures"] - } + { "path": "test" }, ], "settings": { diff --git a/lib/backup_restore/restorer.rb b/lib/backup_restore/restorer.rb index 167c455994f..4d1a4849f49 100644 --- a/lib/backup_restore/restorer.rb +++ b/lib/backup_restore/restorer.rb @@ -48,7 +48,7 @@ module BackupRestore switch_schema! - migrate_database + # migrate_database reconnect_database reload_site_settings clear_emoji_cache @@ -56,7 +56,7 @@ module BackupRestore disable_readonly_mode ### READ-ONLY / END ### - extract_uploads + # extract_uploads rescue SystemExit log "Restore process was cancelled!" rollback diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb index bb2ad455ac0..39dd2c324cf 100644 --- a/lib/email/receiver.rb +++ b/lib/email/receiver.rb @@ -1,144 +1,198 @@ -require_dependency 'new_post_manager' -require_dependency 'email/html_cleaner' -require_dependency 'post_action_creator' +require_dependency "new_post_manager" +require_dependency "post_action_creator" +require_dependency "email/html_cleaner" module Email class Receiver - include ActionView::Helpers::NumberHelper + class ProcessingError < StandardError; end + class EmptyEmailError < ProcessingError; end + class NoMessageIdError < ProcessingError; end + class AutoGeneratedEmailError < ProcessingError; end + class NoBodyDetectedError < ProcessingError; end + class InactiveUserError < ProcessingError; end + class BadDestinationAddress < ProcessingError; end + class StrangersNotAllowedError < ProcessingError; end + class InsufficientTrustLevelError < ProcessingError; end + class ReplyUserNotMatchingError < ProcessingError; end + class TopicNotFoundError < ProcessingError; end + class TopicClosedError < ProcessingError; end + class InvalidPost < ProcessingError; end + class InvalidPostAction < ProcessingError; end - class ProcessingError < StandardError; end - class EmailUnparsableError < ProcessingError; end - class EmptyEmailError < ProcessingError; end - class UserNotFoundError < ProcessingError; end - class UserNotSufficientTrustLevelError < ProcessingError; end - class BadDestinationAddress < ProcessingError; end - class TopicNotFoundError < ProcessingError; end - class TopicClosedError < ProcessingError; end - class AutoGeneratedEmailError < ProcessingError; end - class EmailLogNotFound < ProcessingError; end - class InvalidPost < ProcessingError; end - class ReplyUserNotFoundError < ProcessingError; end - class ReplyUserNotMatchingError < ProcessingError; end - class InactiveUserError < ProcessingError; end - class InvalidPostAction < ProcessingError; end - - attr_reader :body, :email_log - - def initialize(raw, opts=nil) - @raw = raw - @opts = opts || {} + def initialize(mail_string) + raise EmptyEmailError if mail_string.blank? + @raw_email = mail_string + @mail = Mail.new(@raw_email) + raise NoMessageIdError if @mail.message_id.blank? end def process - raise EmptyEmailError if @raw.blank? - - @message = Mail.new(@raw) - - raise AutoGeneratedEmailError if @message.header.to_s =~ /auto-(replied|generated)/ - - @body = parse_body(@message) - - # 'smtp_envelope_to' is a combination of: to, cc and bcc fields - # prioriziting the `:reply` types - dest_infos = @message.smtp_envelope_to - .map { |to_address| check_address(to_address) } - .compact - .sort do |a, b| - if a[:type] == :reply && b[:type] != :reply - 1 - elsif a[:type] != :reply && b[:type] == :reply - -1 - else - 0 - end - end - - raise BadDestinationAddress if dest_infos.empty? - - from = @message[:from].address_list.addresses.first - user_email = from.address - user_name = from.display_name - - user = User.find_by_email(user_email) - raise InactiveUserError if user.present? && !user.active && !user.staged - - # TODO: take advantage of all the "TO"s - dest_info = dest_infos[0] - case dest_info[:type] - when :group - group = dest_info[:obj] - - if user.blank? - if SiteSetting.allow_staged_accounts - user = create_staged_account(user_email, user_name) - else - wrap_body_in_quote(user_email) - user = Discourse.system_user - end - end - - create_new_topic(user, archetype: Archetype.private_message, target_group_names: [group.name]) - when :category - category = dest_info[:obj] - - if user.blank? && category.email_in_allow_strangers - if SiteSetting.allow_staged_accounts - user = create_staged_account(user_email) - else - wrap_body_in_quote(user_email) - user = Discourse.system_user - end - end - - raise UserNotFoundError if user.blank? - raise UserNotSufficientTrustLevelError.new(user) unless category.email_in_allow_strangers || user.has_trust_level?(TrustLevel[SiteSetting.email_in_min_trust.to_i]) - - create_new_topic(user, category: category.id) - when :reply - @email_log = dest_info[:obj] - - raise EmailLogNotFound if @email_log.blank? - raise TopicNotFoundError if Topic.find_by_id(@email_log.topic_id).nil? - raise TopicClosedError if Topic.find_by_id(@email_log.topic_id).closed? - raise ReplyUserNotFoundError if user.blank? - raise ReplyUserNotMatchingError if @email_log.user_id != user.id - - if post_action_type = post_action_for(@body) - create_post_action(@email_log, post_action_type) - else - create_reply(@email_log) - end - end - - rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError => e - raise EmailUnparsableError.new(e) + @incoming_email = find_or_create_incoming_email + process_internal + rescue => e + @incoming_email.update_columns(error: e.to_s) + raise end - def create_staged_account(email, name=nil) - User.create( - email: email, - username: UserNameSuggester.suggest(name.presence || email), - name: name.presence || User.suggest_name(email), - staged: true, - ) + def find_or_create_incoming_email + IncomingEmail.find_or_create_by(message_id: @mail.message_id) do |incoming_email| + incoming_email.raw = @raw_email + incoming_email.subject = @mail.subject + incoming_email.from_address = @mail.from.first.downcase + incoming_email.to_addresses = @mail.to.map(&:downcase).join(";") if @mail.to.present? + incoming_email.cc_addresses = @mail.cc.map(&:downcase).join(";") if @mail.cc.present? + end + end + + def process_internal + raise AutoGeneratedEmailError if is_auto_generated? + + body = select_body || "" + + raise NoBodyDetectedError if body.blank? && !@mail.has_attachments? + + user = find_or_create_user(from) + + @incoming_email.update_columns(user_id: user.id) + + raise InactiveUserError if !user.active && !user.staged + + if post = find_related_post + create_reply(user: user, raw: body, post: post, topic: post.topic) + else + destination = destinations.first + + raise BadDestinationAddress if destination.blank? + + case destination[:type] + when :group + group = destination[:obj] + create_topic(user: user, raw: body, title: @mail.subject, archetype: Archetype.private_message, target_group_names: [group.name], skip_validations: true) + when :category + category = destination[:obj] + + raise StrangersNotAllowedError if user.staged? && !category.email_in_allow_strangers + raise InsufficientTrustLevelError if !user.has_trust_level?(SiteSetting.email_in_min_trust) + + create_topic(user: user, raw: body, title: @mail.subject, category: category.id) + when :reply + email_log = destination[:obj] + + raise ReplyUserNotMatchingError if email_log.user_id != user.id + + create_reply(user: user, raw: body, post: email_log.post, topic: email_log.post.topic) + end + end + end + + def is_auto_generated? + @mail.return_path.blank? || + @mail[:precedence].to_s[/list|junk|bulk|auto_reply/] || + @mail.header.to_s[/auto-(submitted|replied|generated)/] + end + + def select_body + text = nil + html = nil + + if @mail.multipart? + text = fix_charset(@mail.text_part) + html = fix_charset(@mail.html_part) + elsif @mail.content_type.to_s["text/html"] + html = fix_charset(@mail) + else + text = fix_charset(@mail) + end + + # prefer text over html + if text.present? + text_encoding = text.encoding + text = DiscourseEmailParser.parse_reply(text) + text = try_to_encode(text, text_encoding) + return text if text.present? + end + + # clean the html if that's all we've got + if html.present? + html_encoding = html.encoding + html = Email::HtmlCleaner.new(html).output_html + html = DiscourseEmailParser.parse_reply(html) + html = try_to_encode(html, html_encoding) + return html if html.present? + end + end + + def fix_charset(mail_part) + return nil if mail_part.blank? || mail_part.body.blank? + + string = mail_part.body.to_s + + # TODO (use charlock_holmes to properly detect encoding) + + # 1) use the charset provided + if mail_part.charset.present? + fixed = try_to_encode(string, mail_part.charset) + return fixed if fixed.present? + end + + # 2) default to UTF-8 + try_to_encode(string, "UTF-8") + end + + def try_to_encode(string, encoding) + string.encode("UTF-8", encoding) + rescue Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError + nil + end + + def from + @from ||= @mail[:from].address_list.addresses.first + end + + def find_or_create_user(address_field) + # decode the address field + address_field.decoded + # extract email and name + email = address_field.address.downcase + name = address_field.display_name.try(:to_s) + username = UserNameSuggester.sanitize_username(name) if name.present? + + User.find_or_create_by(email: email) do |user| + user.username = UserNameSuggester.suggest(username.presence || email) + user.name = name.presence || User.suggest_name(email) + user.staged = true + end + end + + def destinations + [ @mail.destinations, + [@mail[:x_forwarded_to]].flatten.compact.map(&:decoded), + [@mail[:delivered_to]].flatten.compact.map(&:decoded), + ].flatten + .select(&:present?) + .uniq + .lazy + .map { |d| check_address(d) } + .drop_while(&:blank?) end def check_address(address) # only check for a group/category when 'email_in' is enabled if SiteSetting.email_in group = Group.find_by_email(address) - return { address: address, type: :group, obj: group } if group + return { type: :group, obj: group } if group category = Category.find_by_email(address) - return { address: address, type: :category, obj: category } if category + return { type: :category, obj: category } if category end + # reply match = reply_by_email_address_regex.match(address) if match && match[1].present? email_log = EmailLog.for(match[1]) - return { address: address, type: :reply, obj: email_log } + return { type: :reply, obj: email_log } if email_log end end @@ -147,173 +201,89 @@ module Email .gsub(Regexp.escape("%{reply_key}"), "([[:xdigit:]]{32})") end - def parse_body(message) - body = select_body(message) - encoding = body.encoding - raise EmptyEmailError if body.strip.blank? + def find_related_post + message_ids = [@mail.in_reply_to, extract_references] + message_ids.flatten! + message_ids.select!(&:present?) + message_ids.uniq! + return if message_ids.empty? - body = discourse_email_trimmer(body) - raise EmptyEmailError if body.strip.blank? - - body = DiscourseEmailParser.parse_reply(body) - raise EmptyEmailError if body.strip.blank? - - body.force_encoding(encoding).encode("UTF-8") + IncomingEmail.where.not(post_id: nil) + .where(message_id: message_ids) + .first + .try(:post) end - def select_body(message) - html = nil - - if message.multipart? - text = fix_charset message.text_part - # prefer text over html - return text if text - html = fix_charset message.html_part - elsif message.content_type =~ /text\/html/ - html = fix_charset message + def extract_references + if Array === @mail.references + @mail.references + elsif @mail.references.present? + @mail.references.split(/[\s,]/).map { |r| r.sub(/^$/, "") } end - - if html - body = HtmlCleaner.new(html).output_html - else - body = fix_charset message - end - - return body if @opts[:skip_sanity_check] - - # Certain trigger phrases that means we didn't parse correctly - if body =~ /Content\-Type\:/ || body =~ /multipart\/alternative/ || body =~ /text\/plain/ - raise EmptyEmailError - end - - body end - # Force encoding to UTF-8 on a Mail::Message or Mail::Part - def fix_charset(object) - return nil if object.nil? - - if object.charset - object.body.decoded.force_encoding(object.charset.gsub(/utf8/i, "UTF-8")).encode("UTF-8").to_s - else - object.body.to_s - end - rescue - nil - end - - REPLYING_HEADER_LABELS = ['From', 'Sent', 'To', 'Subject', 'In-Reply-To', 'Cc', 'Bcc', 'Date'] - REPLYING_HEADER_REGEX = Regexp.union(REPLYING_HEADER_LABELS.map { |lbl| "#{lbl}:" }) - - def line_is_quote?(l) - l =~ /\A\s*\-{3,80}\s*\z/ || - l =~ Regexp.new("\\A\\s*" + I18n.t('user_notifications.previous_discussion') + "\\s*\\Z") || - (l =~ /via #{SiteSetting.title}(.*)\:$/) || - # This one might be controversial but so many reply lines have years, times and end with a colon. - # Let's try it and see how well it works. - (l =~ /\d{4}/ && l =~ /\d:\d\d/ && l =~ /\:$/) || - (l =~ /On [\w, ]+\d+.*wrote:/) - end - - def discourse_email_trimmer(body) - lines = body.scrub.lines.to_a - range_start = 0 - range_end = 0 - - # If we started with a quote, skip it - lines.each_with_index do |l, idx| - break unless line_is_quote?(l) or l =~ /^>/ or l.blank? - range_start = idx + 1 - end - - lines[range_start..-1].each_with_index do |l, idx| - break if line_is_quote?(l) - - # Headers on subsequent lines - break if (0..2).all? { |off| lines[idx+off] =~ REPLYING_HEADER_REGEX } - # Headers on the same line - break if REPLYING_HEADER_LABELS.count { |lbl| l.include? lbl } >= 3 - range_end = range_start + idx - end - - lines[range_start..range_end].join.strip - end - - private - - def wrap_body_in_quote(user_email) - @body = "[quote=\"#{user_email}\"]\n#{@body}\n[/quote]" - end - - def create_post_action(email_log, type) - PostActionCreator.new(email_log.user, email_log.post).perform(type) - rescue Discourse::InvalidAccess, PostAction::AlreadyActed => e - raise InvalidPostAction.new(e) + def likes + @likes ||= Set.new ["+1", I18n.t('post_action_types.like.title').downcase] end def post_action_for(body) - if ['+1', I18n.t('post_action_types.like.title').downcase].include? body.downcase + if likes.include?(body.strip.downcase) PostActionType.types[:like] end end - def create_reply(email_log) - create_post_with_attachments(email_log.user, - raw: @body, - topic_id: email_log.topic_id, - reply_to_post_number: email_log.post.post_number) + def create_topic(options={}) + create_post_with_attachments(options) end - def create_new_topic(user, topic_options={}) - topic_options[:raw] = @body - topic_options[:title] = @message.subject + def create_reply(options={}) + raise TopicNotFoundError if options[:topic].nil? || options[:topic].trashed? + raise TopicClosedError if options[:topic].closed? - result = create_post_with_attachments(user, topic_options) - topic_id = result.post.present? ? result.post.topic_id : nil - - EmailLog.create( - email_type: "topic_via_incoming_email", - to_address: user.email, - topic_id: topic_id, - user_id: user.id, - ) - - result + if post_action_type = post_action_for(options[:raw]) + create_post_action(options[:user], options[:post], post_action_type) + else + options[:topic_id] = options[:post].try(:topic_id) + options[:reply_to_post_number] = options[:post].try(:post_number) + create_post_with_attachments(options) + end end - def create_post_with_attachments(user, post_options={}) - options = { - cooking_options: { traditional_markdown_linebreaks: true }, - }.merge(post_options) - - raw = options[:raw] + def create_post_action(user, post, type) + PostActionCreator.new(user, post).perform(type) + rescue PostAction::AlreadyActed + # it's cool, don't care + rescue Discourse::InvalidAccess => e + raise InvalidPostAction.new(e) + end + def create_post_with_attachments(options={}) # deal with attachments - @message.attachments.each do |attachment| + @mail.attachments.each do |attachment| tmp = Tempfile.new("discourse-email-attachment") begin # read attachment File.open(tmp.path, "w+b") { |f| f.write attachment.body.decoded } # create the upload for the user - upload = Upload.create_for(user.id, tmp, attachment.filename, tmp.size) + upload = Upload.create_for(options[:user].id, tmp, attachment.filename, tmp.size) if upload && upload.errors.empty? # try to inline images - if attachment.content_type.start_with?("image/") - if raw =~ /\[image: Inline image \d+\]/ - raw.sub!(/\[image: Inline image \d+\]/, attachment_markdown(upload)) - next - end + if attachment.content_type.start_with?("image/") && options[:raw][/\[image: .+ \d+\]/] + options[:raw].sub!(/\[image: .+ \d+\]/, attachment_markdown(upload)) + else + options[:raw] << "\n#{attachment_markdown(upload)}\n" end - raw << "\n#{attachment_markdown(upload)}\n" end ensure - tmp.close! + tmp.try(:close!) rescue nil end end - options[:raw] = raw + post_options = { + cooking_options: { traditional_markdown_linebreaks: true }, + }.merge(options) - create_post(user, options) + create_post(post_options) end def attachment_markdown(upload) @@ -324,20 +294,46 @@ module Email end end - def create_post(user, options) - # Mark the reply as incoming via email + def create_post(options={}) options[:via_email] = true - options[:raw_email] = @raw + options[:raw_email] = @raw_email - manager = NewPostManager.new(user, options) + # ensure posts aren't created in the future + options[:created_at] = [@mail.date, DateTime.now].min + + manager = NewPostManager.new(options[:user], options) result = manager.perform - if result.errors.present? - raise InvalidPost, result.errors.full_messages.join("\n") - end + raise InvalidPost, result.errors.full_messages.join("\n") if result.errors.any? - result + if result.post + @incoming_email.update_columns(topic_id: result.post.topic_id, post_id: result.post.id) + if result.post.topic && result.post.topic.private_message? + add_other_addresses(result.post.topic, options[:user]) + end + end + end + + def add_other_addresses(topic, sender) + %i(to cc bcc).each do |d| + if @mail[d] && @mail[d].address_list && @mail[d].address_list.addresses + @mail[d].address_list.addresses.each do |address| + begin + if user = find_or_create_user(address) + unless topic.topic_allowed_users.where(user_id: user.id).exists? && + topic.topic_allowed_groups.where("group_id IN (SELECT group_id FROM group_users WHERE user_id = ?)", user.id).exists? + topic.topic_allowed_users.create!(user_id: user.id) + topic.add_small_action(sender, "invited_user", user.username) + end + end + rescue ActiveRecord::RecordInvalid + # don't care if user already allowed + end + end + end + end end end + end diff --git a/lib/tasks/emails.rake b/lib/tasks/emails.rake new file mode 100644 index 00000000000..1ab9c71d357 --- /dev/null +++ b/lib/tasks/emails.rake @@ -0,0 +1,56 @@ +def process_popmail(popmail) + begin + mail_string = popmail.pop + Email::Receiver.new(mail_string).process + rescue + putc "!" + else + putc "." + end +end + +desc "use this task to import a mailbox into Disourse" +task "emails:import" => :environment do + begin + unless SiteSetting.email_in + puts "ERROR: you should enable the 'email_in' site setting before running this task" + exit(1) + end + + address = ENV["ADDRESS"].presence || "pop.gmail.com" + port = (ENV["PORT"].presence || 995).to_i + ssl = (ENV["SSL"].presence || "1") == "1" + username = ENV["USERNAME"].presence + password = ENV["PASSWORD"].presence + + if username.blank? + puts "ERROR: expecting USERNAME= rake emails:import" + exit(2) + elsif password.blank? + puts "ERROR: expecting PASSWORD= rake emails:import" + exit(3) + end + + RateLimiter.disable + + mails_left = 1 + pop3 = Net::POP3.new(address, port) + pop3.enable_ssl if ssl + + while mails_left > 0 + pop3.start(username, password) do |pop| + pop.delete_all do |p| + process_popmail(p) + end + mails_left = pop.n_mails + end + end + + puts "Done" + rescue Net::POPAuthenticationError + puts "AUTH EXCEPTION: please make sure your credentials are correct." + exit(10) + ensure + RateLimiter.enable + end +end diff --git a/lib/topic_creator.rb b/lib/topic_creator.rb index c4791a2f7ef..9ca18af0113 100644 --- a/lib/topic_creator.rb +++ b/lib/topic_creator.rb @@ -193,6 +193,6 @@ class TopicCreator end def check_can_send_permission!(topic, obj) - rollback_with!(topic, :cant_send_pm) unless @guardian.can_send_private_message?(obj) + rollback_with!(topic, :cant_send_pm) unless @opts[:skip_validations] || @guardian.can_send_private_message?(obj) end end diff --git a/lib/user_name_suggester.rb b/lib/user_name_suggester.rb index 4819a3f879b..c182db5c252 100644 --- a/lib/user_name_suggester.rb +++ b/lib/user_name_suggester.rb @@ -34,12 +34,11 @@ module UserNameSuggester end def self.sanitize_username(name) - name = ActiveSupport::Inflector.transliterate(name) - name = name.gsub(/^[^[:alnum:]]+|\W+$/, "") - .gsub(/\W+/, "_") - .gsub(/^\_+/, '') - .gsub(/[\-_\.]{2,}/, "_") - name + ActiveSupport::Inflector.transliterate(name) + .gsub(/^[^[:alnum:]]+|\W+$/, "") + .gsub(/\W+/, "_") + .gsub(/^\_+/, '') + .gsub(/[\-_\.]{2,}/, "_") end def self.rightsize_username(name) diff --git a/spec/components/email/receiver_spec.rb b/spec/components/email/receiver_spec.rb index 796ce440d4d..7f4d0d16a33 100644 --- a/spec/components/email/receiver_spec.rb +++ b/spec/components/email/receiver_spec.rb @@ -1,791 +1,233 @@ -# -*- encoding : utf-8 -*- - -require 'rails_helper' -require 'email/receiver' +require "rails_helper" +require "email/receiver" describe Email::Receiver do before do - SiteSetting.reply_by_email_address = "reply+%{reply_key}@appmail.adventuretime.ooo" - SiteSetting.email_in = false - SiteSetting.title = "Discourse" + SiteSetting.email_in = true + SiteSetting.reply_by_email_address = "reply+%{reply_key}@bar.com" end - describe 'parse_body' do - def test_parse_body(mail_string) - Email::Receiver.new(nil).parse_body(Mail::Message.new mail_string) + def email(email_name) + fixture_file("emails/#{email_name}.eml") + end + + def process(email_name) + Email::Receiver.new(email(email_name)).process + end + + it "raises an EmptyEmailError when 'mail_string' is blank" do + expect { Email::Receiver.new(nil) }.to raise_error(Email::Receiver::EmptyEmailError) + expect { Email::Receiver.new("") }.to raise_error(Email::Receiver::EmptyEmailError) + end + + it "raises an NoMessageIdError when 'mail_string' is not an email" do + expect { Email::Receiver.new("wat") }.to raise_error(Email::Receiver::NoMessageIdError) + end + + it "raises an NoMessageIdError when 'mail_string' is missing the message_id" do + expect { Email::Receiver.new(email(:missing_message_id)) }.to raise_error(Email::Receiver::NoMessageIdError) + end + + it "raises an AutoGeneratedEmailError when the mail has no return path" do + expect { process(:no_return_path) }.to raise_error(Email::Receiver::AutoGeneratedEmailError) + end + + it "raises an AutoGeneratedEmailError when the mail is auto generated" do + expect { process(:auto_generated_precedence) }.to raise_error(Email::Receiver::AutoGeneratedEmailError) + expect { process(:auto_generated_header) }.to raise_error(Email::Receiver::AutoGeneratedEmailError) + end + + it "raises a NoBodyDetectedError when the body is blank" do + expect { process(:no_body) }.to raise_error(Email::Receiver::NoBodyDetectedError) + end + + it "raises an InactiveUserError when the sender is inactive" do + Fabricate(:user, email: "inactive@bar.com", active: false) + expect { process(:inactive_sender) }.to raise_error(Email::Receiver::InactiveUserError) + end + + skip "doesn't raise an InactiveUserError when the sender is staged" do + Fabricate(:user, email: "staged@bar.com", active: false, staged: true) + expect { process(:staged_sender) }.not_to raise_error + end + + it "raises a BadDestinationAddress when destinations aren't matching any of the incoming emails" do + expect { process(:bad_destinations) }.to raise_error(Email::Receiver::BadDestinationAddress) + end + + context "reply" do + + let(:reply_key) { "4f97315cc828096c9cb34c6f1a0d6fe8" } + let(:user) { Fabricate(:user, email: "discourse@bar.com") } + let(:topic) { create_topic(user: user) } + let(:post) { create_post(topic: topic, user: user) } + let!(:email_log) { Fabricate(:email_log, reply_key: reply_key, user: user, topic: topic, post: post) } + + it "raises a ReplyUserNotMatchingError when the email address isn't matching the one we sent the notification to" do + expect { process(:reply_user_not_matching) }.to raise_error(Email::Receiver::ReplyUserNotMatchingError) end - it "raises EmptyEmailError if the message is blank" do - expect { test_parse_body("") }.to raise_error(Email::Receiver::EmptyEmailError) + it "raises a TopicNotFoundError when the topic was deleted" do + topic.update_columns(deleted_at: 1.day.ago) + expect { process(:reply_user_matching) }.to raise_error(Email::Receiver::TopicNotFoundError) end - it "raises EmptyEmailError if the message is not an email" do - expect { test_parse_body("asdf" * 30) }.to raise_error(Email::Receiver::EmptyEmailError) + it "raises a TopicClosedError when the topic was closed" do + topic.update_columns(closed: true) + expect { process(:reply_user_matching) }.to raise_error(Email::Receiver::TopicClosedError) end - it "raises EmptyEmailError if there is no reply content" do - expect { test_parse_body(fixture_file("emails/no_content_reply.eml")) }.to raise_error(Email::Receiver::EmptyEmailError) + it "raises an InvalidPost when there was an error while creating the post" do + expect { process(:too_small) }.to raise_error(Email::Receiver::InvalidPost) end - skip "raises EmailUnparsableError if the headers are corrupted" do - expect { ; }.to raise_error(Email::Receiver::EmailUnparsableError) + it "raises an InvalidPost when there are too may mentions" do + SiteSetting.max_mentions_per_post = 1 + Fabricate(:user, username: "user1") + Fabricate(:user, username: "user2") + expect { process(:too_many_mentions) }.to raise_error(Email::Receiver::InvalidPost) end - it "can parse the html section" do - expect(test_parse_body(fixture_file("emails/html_only.eml"))).to eq("The EC2 instance - I've seen that there tends to be odd and " + - "unrecommended settings on the Bitnami installs that I've checked out.") + it "raises an InvalidPostAction when they aren't allowed to like a post" do + topic.update_columns(archived: true) + expect { process(:like) }.to raise_error(Email::Receiver::InvalidPostAction) end - it "supports a Dutch reply" do - expect(test_parse_body(fixture_file("emails/dutch.eml"))).to eq("Dit is een antwoord in het Nederlands.") + it "works" do + expect { process(:text_reply) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This is a text reply :)") + expect(topic.posts.last.via_email).to eq(true) + expect(topic.posts.last.cooked).not_to match(/
HTML reply ;)") + + expect { process(:hebrew_reply) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("שלום! מה שלומך היום?") + + expect { process(:chinese_reply) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("您好! 你今天好吗?") end - it "supports a Hebrew reply" do - I18n.stubs(:t).with('user_notifications.previous_discussion').returns('כלטוב') - - # The force_encoding call is only needed for the test - it is passed on fine to the cooked post - expect(test_parse_body(fixture_file("emails/hebrew.eml"))).to eq("שלום") + it "prefers text over html" do + expect { process(:text_and_html_reply) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This is the *text* part.") end - it "supports a BIG5-encoded reply" do - # The force_encoding call is only needed for the test - it is passed on fine to the cooked post - expect(test_parse_body(fixture_file("emails/big5.eml"))).to eq("媽!我上電視了!") + it "removes the 'on , wrote' quoting line" do + expect { process(:on_date_contact_wrote) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This is the actual reply.") end - it "removes 'via' lines if they match the site title" do - SiteSetting.title = "Discourse" - - expect(test_parse_body(fixture_file("emails/via_line.eml"))).to eq("Hello this email has content!") - end - - it "removes an 'on date wrote' quoting line" do - expect(test_parse_body(fixture_file("emails/on_wrote.eml"))).to eq("Sure, all you need to do is frobnicate the foobar and you'll be all set!") - end - - it "removes the 'Previous Discussion' marker" do - expect(test_parse_body(fixture_file("emails/previous.eml"))).to eq("This will not include the previous discussion that is present in this email.") + it "removes the 'Previous Replies' marker" do + expect { process(:previous_replies) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This will not include the previous discussion that is present in this email.") end it "handles multiple paragraphs" do - expect(test_parse_body(fixture_file("emails/paragraphs.eml"))). - to eq( -"Is there any reason the *old* candy can't be be kept in silos while the new candy -is imported into *new* silos? - -The thing about candy is it stays delicious for a long time -- we can just keep -it there without worrying about it too much, imo. - -Thanks for listening." - ) - end - - it "handles multiple paragraphs when parsing html" do - expect(test_parse_body(fixture_file("emails/html_paragraphs.eml"))). - to eq( -"Awesome! - -Pleasure to have you here! - -:boom:" - ) - end - - it "handles newlines" do - expect(test_parse_body(fixture_file("emails/newlines.eml"))). - to eq( -"This is my reply. -It is my best reply. -It will also be my *only* reply." - ) + expect { process(:paragraphs) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("Do you like liquorice?\n\nI really like them. One could even say that I am *addicted* to liquorice. Anf if\nyou can mix it up with some anise, then I'm in heaven ;)") end it "handles inline reply" do - expect(test_parse_body(fixture_file("emails/inline_reply.eml"))). - to eq( -"On Wed, Oct 8, 2014 at 11:12 AM, techAPJ wrote: - -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> ------------------------------ -> Previous Replies codinghorror -> -> November 28 -> -> We're testing the latest GitHub email processing library which we are -> integrating now. -> -> https://github.com/github/email_reply_parser -> -> Go ahead and reply to this topic and I'll reply from various email clients -> for testing. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog." - ) + expect { process(:inline_reply) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("On Tue, Jan 15, 2016 at 11:12 AM, Bar Foo wrote:\n\n> WAT November 28\n>\n> This is the previous post.\n\nAnd this is *my* reply :+1:") end - it "can retrieve the first part of multiple replies" do - expect(test_parse_body(fixture_file("emails/inline_mixed.eml"))).to eq( -"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. - -> First paragraph. -> -> Second paragraph. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown" - ) - + it "retrieves the first part of multiple replies" do + expect { process(:inline_mixed_replies) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("On Tue, Jan 15, 2016 at 11:12 AM, Bar Foo wrote:\n\n> WAT November 28\n>\n> This is the previous post.\n\nAnd this is *my* reply :+1:\n\n> This is another post.\n\nAnd this is **another** reply.") end - it "should not include previous replies" do - expect(test_parse_body(fixture_file("emails/previous_replies.eml"))).not_to match(/Previous Replies/) - end + it "strips signatures" do + expect { process(:iphone_signature) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This is not the signature you're looking for.") - it "strips iPhone signature" do - expect(test_parse_body(fixture_file("emails/iphone_signature.eml"))).not_to match(/Sent from my iPhone/) - end - - it "strips regular signature" do - expect(test_parse_body(fixture_file("emails/signature.eml"))).not_to match(/Arpit/) + expect { process(:signature) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("You shall not sign!") end it "strips 'original message' context" do - expect(test_parse_body(fixture_file("emails/original_message_context.eml"))).not_to match(/Context/) + expect { process(:original_message) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to eq("This is a reply :)") end - it "properly renders email reply from gmail web client" do - expect(test_parse_body(fixture_file("emails/gmail_web.eml"))). - to eq( -"### This is a reply from standard GMail in Google Chrome. + it "supports attachments" do + expect { process(:no_body_with_attachments) }.to change { topic.posts.count } + expect(topic.posts.last.raw).to match(//) - expect(Upload.find_by(sha1: upload_sha)).not_to eq(nil) - end - - describe 'Liking via email' do - let!(:reply_key) { '636ca428858779856c226bb145ef4fad' } - let(:replied_user_like_params) { { user: replying_user, post: post, post_action_type_id: PostActionType.types[:like] } } - let(:replied_user_like) { PostAction.find_by(replied_user_like_params) } - - describe "plus_one.eml" do - let!(:email_raw) { - fixture_file("emails/plus_one.eml") - .gsub("TO", "reply+#{reply_key}@appmail.adventuretime.ooo") - .gsub("FROM", replying_user_email) - } - - it "adds a user like to the post" do - expect { receiver.process }.to change { PostAction.count }.by(1) - expect(replied_user_like).to be_present - end - - it "does not create a duplicate like" do - PostAction.create(replied_user_like_params) - before_count = PostAction.count - expect { receiver.process }.to raise_error(Email::Receiver::InvalidPostAction) - expect(PostAction.count).to eq before_count - expect(replied_user_like).to be_present - end - - it "does not allow unauthorized happiness" do - post.trash! - before_count = PostAction.count - expect { receiver.process }.to raise_error(Email::Receiver::InvalidPostAction) - expect(PostAction.count).to eq before_count - expect(replied_user_like).to_not be_present - end - end - - describe "like.eml" do - let!(:email_raw) { - fixture_file("emails/like.eml") - .gsub("TO", "reply+#{reply_key}@appmail.adventuretime.ooo") - .gsub("FROM", replying_user_email) - } - - it 'adds a user like to the post' do - expect { receiver.process }.to change { PostAction.count }.by(1) - expect(replied_user_like).to be_present - end - end - end - end - - # === Failure Conditions === - - describe "too_short.eml" do - let!(:reply_key) { '636ca428858779856c226bb145ef4fad' } - let!(:email_raw) { - fixture_file("emails/too_short.eml") - .gsub("TO", "reply+#{reply_key}@appmail.adventuretime.ooo") - .gsub("FROM", replying_user_email) - .gsub("SUBJECT", "re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux'") - } - - it "raises an InvalidPost error" do - SiteSetting.min_post_length = 5 - expect { receiver.process }.to raise_error(Email::Receiver::InvalidPost) - end - end - - describe "too_many_mentions.eml" do - let!(:reply_key) { '636ca428858779856c226bb145ef4fad' } - let!(:email_raw) { fixture_file("emails/too_many_mentions.eml") } - - it "raises an InvalidPost error" do - SiteSetting.max_mentions_per_post = 10 - (1..11).each do |i| - Fabricate(:user, username: "user#{i}").save - end - - expect { receiver.process }.to raise_error(Email::Receiver::InvalidPost) - end - end - - describe "auto response email replies should not be accepted" do - let!(:reply_key) { '636ca428858779856c226bb145ef4fad' } - let!(:email_raw) { fixture_file("emails/auto_reply.eml") } - it "raises a AutoGeneratedEmailError" do - expect { receiver.process }.to raise_error(Email::Receiver::AutoGeneratedEmailError) - end + it "ensures posts aren't dated in the future" do + expect { process(:from_the_future) }.to change { topic.posts.count } + expect(topic.posts.last.created_at).to be_within(1.minute).of(DateTime.now) end end - describe "posting reply to a closed topic" do - let(:reply_key) { raise "Override this in a lower describe block" } - let(:email_raw) { raise "Override this in a lower describe block" } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:receiver) { Email::Receiver.new(email_raw) } - let(:topic) { Fabricate(:topic, closed: true) } - let(:post) { Fabricate(:post, topic: topic, post_number: 1) } - let(:replying_user_email) { 'jake@adventuretime.ooo' } - let(:replying_user) { Fabricate(:user, email: replying_user_email, trust_level: 2) } - let(:email_log) { EmailLog.new(reply_key: reply_key, - post: post, - post_id: post.id, - topic_id: topic.id, - email_type: 'user_posted', - user: replying_user, - user_id: replying_user.id, - to_address: replying_user_email - ) } + context "new message to a group" do - before do - email_log.save + let!(:group) { Fabricate(:group, incoming_email: "team@bar.com") } + + it "handles encoded display names" do + expect { process(:encoded_display_name) }.to change(Topic, :count) + + topic = Topic.last + expect(topic.private_message?).to eq(true) + expect(topic.allowed_groups).to include(group) + + user = topic.user + expect(user.staged).to eq(true) + expect(user.username).to eq("random_name") + expect(user.name).to eq("Случайная Имя") end - describe "should not create post" do - let!(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let!(:email_raw) { fill_email(fixture_file("emails/valid_reply.eml"), replying_user_email, to) } - it "raises a TopicClosedError" do - expect { receiver.process }.to raise_error(Email::Receiver::TopicClosedError) - end - end - end - - describe "posting reply to a deleted topic" do - let(:reply_key) { raise "Override this in a lower describe block" } - let(:email_raw) { raise "Override this in a lower describe block" } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:receiver) { Email::Receiver.new(email_raw) } - let(:deleted_topic) { Fabricate(:deleted_topic) } - let(:post) { Fabricate(:post, topic: deleted_topic, post_number: 1) } - let(:replying_user_email) { 'jake@adventuretime.ooo' } - let(:replying_user) { Fabricate(:user, email: replying_user_email, trust_level: 2) } - let(:email_log) { EmailLog.new(reply_key: reply_key, - post: post, - post_id: post.id, - topic_id: deleted_topic.id, - email_type: 'user_posted', - user: replying_user, - user_id: replying_user.id, - to_address: replying_user_email - ) } - - before do - email_log.save - end - - describe "should not create post" do - let!(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let!(:email_raw) { fill_email(fixture_file("emails/valid_reply.eml"), replying_user_email, to) } - it "raises a TopicNotFoundError" do - expect { receiver.process }.to raise_error(Email::Receiver::TopicNotFoundError) - end - end - end - - describe "posting reply as a inactive user" do - let(:reply_key) { raise "Override this in a lower describe block" } - let(:email_raw) { raise "Override this in a lower describe block" } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:receiver) { Email::Receiver.new(email_raw) } - let(:topic) { Fabricate(:topic) } - let(:post) { Fabricate(:post, topic: topic, post_number: 1) } - let(:replying_user_email) { 'jake@adventuretime.ooo' } - let(:replying_user) { Fabricate(:user, email: replying_user_email, trust_level: 2, active: false) } - let(:email_log) { EmailLog.new(reply_key: reply_key, - post: post, - post_id: post.id, - topic_id: topic.id, - email_type: 'user_posted', - user: replying_user, - user_id: replying_user.id, - to_address: replying_user_email - ) } - - before do - email_log.save - end - - describe "should not create post" do - let!(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let!(:email_raw) { fill_email(fixture_file("emails/valid_reply.eml"), replying_user_email, to) } - it "raises a InactiveUserError" do - expect { receiver.process }.to raise_error(Email::Receiver::InactiveUserError) - end - end - end - - describe "posting a new topic in a category" do - let(:category_destination) { raise "Override this in a lower describe block" } - let(:email_raw) { raise "Override this in a lower describe block" } - let(:allow_strangers) { false } - # ---- - let(:receiver) { Email::Receiver.new(email_raw) } - let(:user_email) { 'jake@adventuretime.ooo' } - let(:user) { Fabricate(:user, email: user_email, trust_level: 2)} - let(:category) { Fabricate(:category, email_in: category_destination, email_in_allow_strangers: allow_strangers) } - - before do - SiteSetting.email_in = true - user.save - category.save - end - - describe "too_short.eml" do - let!(:category_destination) { 'incoming+amazing@appmail.adventuretime.ooo' } - let(:email_raw) { - fixture_file("emails/too_short.eml") - .gsub("TO", category_destination) - .gsub("FROM", user_email) - .gsub("SUBJECT", "A long subject that passes the checks") - } - - it "does not create a topic if the post fails" do - before_topic_count = Topic.count - - expect { receiver.process }.to raise_error(Email::Receiver::InvalidPost) - - expect(Topic.count).to eq(before_topic_count) - end - + it "invites everyone in the chain" do + expect { process(:cc) }.to change(Topic, :count) + emails = Topic.last.allowed_users.pluck(:email) + expect(emails.size).to eq(5) + expect(emails).to include("someone@else.com", "discourse@bar.com", "team@bar.com", "wat@bar.com", "42@bar.com") end end - def process_email(opts) - incoming_email = fixture_file("emails/valid_incoming.eml") - email = fill_email(incoming_email, opts[:from], opts[:to], opts[:body], opts[:subject], opts[:cc]) - Email::Receiver.new(email).process - end + context "new topic in a category" do - describe "with a valid email" do - let(:reply_key) { "59d8df8370b7e95c5a49fbf86aeb2c93" } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:user_email) { "test@test.com" } - let(:user) { Fabricate(:user, email: user_email, trust_level: 2)} - let(:post) { create_post(user: user) } - - let(:valid_reply) { - reply = fixture_file("emails/valid_reply.eml") - fill_email(reply, user.email, to) - } - - let(:receiver) { Email::Receiver.new(valid_reply) } - let(:email_log) { EmailLog.new(reply_key: reply_key, - post_id: post.id, - topic_id: post.topic_id, - user_id: post.user_id, - post: post, - user: user, - email_type: 'test', - to_address: user.email - ) } - let(:reply_body) { -"I could not disagree more. I am obviously biased but adventure time is the -greatest show ever created. Everyone should watch it. - -- Jake out" } - - describe "with an email log" do - - it "extracts data" do - expect { receiver.process }.to raise_error(Email::Receiver::EmailLogNotFound) - - email_log.save! - receiver.process - - expect(receiver.body).to eq(reply_body) - expect(receiver.email_log).to eq(email_log) - end + let!(:category) { Fabricate(:category, email_in: "category@bar.com", email_in_allow_strangers: false) } + it "raises a StrangersNotAllowedError when 'email_in_allow_strangers' is disabled" do + expect { process(:stranger_not_allowed) }.to raise_error(Email::Receiver::StrangersNotAllowedError) end - end - - describe "with a valid email from a different user" do - let(:reply_key) { SecureRandom.hex(16) } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:user) { Fabricate(:user, email: "test@test.com", trust_level: 2)} - let(:post) { create_post(user: user) } - let!(:email_log) { EmailLog.create(reply_key: reply_key, - post_id: post.id, - topic_id: post.topic_id, - user_id: post.user_id, - post: post, - user: user, - email_type: 'test', - to_address: user.email) } - - it "raises ReplyUserNotFoundError when user doesn't exist" do - reply = fill_email(fixture_file("emails/valid_reply.eml"), "unknown@user.com", to) - receiver = Email::Receiver.new(reply) - expect { receiver.process }.to raise_error(Email::Receiver::ReplyUserNotFoundError) + it "raises an InsufficientTrustLevelError when user's trust level isn't enough" do + SiteSetting.email_in_min_trust = 4 + Fabricate(:user, email: "insufficient@bar.com", trust_level: 3) + expect { process(:insufficient_trust_level) }.to raise_error(Email::Receiver::InsufficientTrustLevelError) end - it "raises ReplyUserNotMatchingError when user is not matching the reply key" do - another_user = Fabricate(:user, email: "existing@user.com") - reply = fill_email(fixture_file("emails/valid_reply.eml"), another_user.email, to) - receiver = Email::Receiver.new(reply) - expect { receiver.process }.to raise_error(Email::Receiver::ReplyUserNotMatchingError) - end - end + it "raises an InvalidAccess when the user is part of a readonly group" do + user = Fabricate(:user, email: "readonly@bar.com", trust_level: SiteSetting.email_in_min_trust) + group = Fabricate(:group) - describe "processes an email to a category" do - let(:to) { "some@email.com" } + group.add(user) + group.save - before do - SiteSetting.email_in = true - SiteSetting.email_in_min_trust = TrustLevel[4].to_s - end - - it "correctly can target categories" do - Fabricate(:category, email_in_allow_strangers: false, email_in: to) - - # no email in for user - expect{ - process_email(from: "cobb@dob.com", to: "invalid@address.com") - }.to raise_error(Email::Receiver::BadDestinationAddress) - - # valid target invalid user - expect{ - process_email(from: "cobb@dob.com", to: to) - }.to raise_error(Email::Receiver::UserNotFoundError) - - # untrusted - user = Fabricate(:user) - expect{ - process_email(from: user.email, to: to) - }.to raise_error(Email::Receiver::UserNotSufficientTrustLevelError) - - # trusted - user.trust_level = 4 - user.save - - process_email(from: user.email, to: to) - expect(user.posts.count).to eq(1) - - # email too short - message = nil - begin - process_email(from: user.email, to: to, body: "x", subject: "this is my new topic title") - rescue Email::Receiver::InvalidPost => e - message = e.message - end - - expect(e.message).to include("too short") - end - - - it "blocks user in restricted group from creating topic" do - to = "some@email.com" - - restricted_user = Fabricate(:user, trust_level: 4) - restricted_group = Fabricate(:group) - restricted_group.add(restricted_user) - restricted_group.save - - category = Fabricate(:category, email_in_allow_strangers: false, email_in: to) - category.set_permissions(restricted_group => :readonly) + category.set_permissions(group => :readonly) category.save - expect{ - process_email(from: restricted_user.email, to: to) - }.to raise_error(Discourse::InvalidAccess) + expect { process(:readonly) }.to raise_error(Discourse::InvalidAccess) end - end - - describe "processes an unknown email sender to category" do - let(:email_in) { "bob@bob.com" } - let(:user_email) { "#{SecureRandom.hex(32)}@foobar.com" } - let(:body) { "This is a new topic created\n\ninside a category ! :)" } - - before do - SiteSetting.email_in = true - SiteSetting.allow_staged_accounts = true - end - - it "rejects anon email" do - Fabricate(:category, email_in_allow_strangers: false, email_in: email_in) - - expect { - process_email(from: user_email, to: email_in, body: body) - }.to raise_error(Email::Receiver::UserNotFoundError) - end - - it "creates a topic for matching category" do - Fabricate(:category, email_in_allow_strangers: true, email_in: email_in) - process_email(from: user_email, to: email_in, body: body) - - staged_account = User.find_by_email(user_email) - expect(staged_account).to be - expect(staged_account.staged).to be(true) - expect(staged_account.posts.order(id: :desc).limit(1).pluck(:raw).first).to eq(body) - end - - end - - describe "processes an unknown email sender to group" do - let(:incoming_email) { "foo@bar.com" } - let(:user_email) { "#{SecureRandom.hex(32)}@foobar.com" } - let(:body) { "This is a message to\n\na group ;)" } - - before do - SiteSetting.email_in = true - SiteSetting.allow_staged_accounts = true - end - - it "creates a message for matching group" do - Fabricate(:group, incoming_email: incoming_email) - process_email(from: user_email, to: incoming_email, body: body) - - staged_account = User.find_by_email(user_email) - expect(staged_account).to be - expect(staged_account.name).to eq("Jake the Dog") - expect(staged_account.staged).to be(true) - - post = staged_account.posts.order(id: :desc).first - expect(post).to be - expect(post.raw).to eq(body) - expect(post.topic.private_message?).to eq(true) - end - - end - - describe "supports incoming mail in CC fields" do - - let(:incoming_email) { "foo@bar.com" } - let(:user_email) { "#{SecureRandom.hex(32)}@foobar.com" } - let(:body) { "This is a message to\n\na group via CC ;)" } - - before do - SiteSetting.email_in = true - SiteSetting.allow_staged_accounts = true - end - - it "creates a message for matching group" do - Fabricate(:group, incoming_email: incoming_email) - process_email(from: user_email, to: "some@email.com", body: body, cc: incoming_email) - - staged_account = User.find_by_email(user_email) - expect(staged_account).to be - expect(staged_account.staged).to be(true) - - post = staged_account.posts.order(id: :desc).first - expect(post).to be - expect(post.raw).to eq(body) - expect(post.topic.private_message?).to eq(true) + it "works" do + Fabricate(:user, email: "sufficient@bar.com", trust_level: SiteSetting.email_in_min_trust) + expect { process(:sufficient_trust_level) }.to change(Topic, :count) end end diff --git a/spec/fixtures/emails/android_gmail.eml b/spec/fixtures/emails/android_gmail.eml deleted file mode 100644 index 21c5dde2346..00000000000 --- a/spec/fixtures/emails/android_gmail.eml +++ /dev/null @@ -1,177 +0,0 @@ -Delivered-To: reply@discourse.org -Return-Path: -MIME-Version: 1.0 -In-Reply-To: -References: - -Date: Fri, 28 Nov 2014 12:53:21 -0800 -Subject: Re: [Discourse Meta] [Lounge] Testing default email replies -From: Walter White -To: Discourse Meta -Content-Type: multipart/alternative; boundary=089e0149cfa485c6630508f173df - ---089e0149cfa485c6630508f173df -Content-Type: text/plain; charset=UTF-8 - -### this is a reply from Android 5 gmail - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. - -This is **bold** in Markdown. - -This is a link to http://example.com -On Nov 28, 2014 12:36 PM, "Arpit Jalan" wrote: - -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> ------------------------------ -> Previous Replies codinghorror -> -> November 28 -> -> We're testing the latest GitHub email processing library which we are -> integrating now. -> -> https://github.com/github/email_reply_parser -> -> Go ahead and reply to this topic and I'll reply from various email clients -> for testing. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---089e0149cfa485c6630508f173df -Content-Type: text/html; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -

### this is a reply from Android 5 gmail

-

The quick brown fox jumps over the lazy dog. The quick brown= - fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. = -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over= - the lazy dog. The quick brown fox jumps over the lazy dog.

-

This is **bold** in Markdown.

-

This is a link to http://exam= -ple.com

-
On Nov 28, 2014 12:36 PM, "Arpit Jalan"= -; <info@discourse.org> wrot= -e:
- - - - - - - - - - - -
- - - techAPJ
- November 28 -
-

Test reply.

- -

First paragraph.

- -

Second paragraph.

-
- - -
-

To respond, reply to this email or visit https:/= -/meta.discourse.org/t/testing-default-email-replies/22638/3 in your bro= -wser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - codinghorror - November 28 -
-

We're testing the latest GitHub emai= -l processing library which we are integrating now.

- -

https://github.com/github/email_reply_parser

- -

Go ahead and reply to this topic and I&#= -39;ll reply from various email clients for testing.

-
- - -
- -
-

To respond, reply to this email or visit https://met= -a.discourse.org/t/testing-default-email-replies/22638/3 in your browser= -.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
-
- ---089e0149cfa485c6630508f173df-- diff --git a/spec/fixtures/emails/attachment.eml b/spec/fixtures/emails/attachment.eml deleted file mode 100644 index f25c3d1a449..00000000000 --- a/spec/fixtures/emails/attachment.eml +++ /dev/null @@ -1,351 +0,0 @@ -Message-ID: <51C22E52.1030509@darthvader.ca> -Date: Wed, 19 Jun 2013 18:18:58 -0400 -From: Anakin Skywalker -User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 -MIME-Version: 1.0 -To: Han Solo via Death Star -Subject: Re: [Death Star] [PM] re: Regarding your post in "Site Customization - not working" -References: <51d23d33f41fb_5f4e4b35d7d60798@xwing.mail> -In-Reply-To: <51d23d33f41fb_5f4e4b35d7d60798@xwing.mail> -Content-Type: multipart/mixed; boundary=047d7b45041e19c68004eb9f3de8 - ---047d7b45041e19c68004eb9f3de8 -Content-Type: multipart/alternative; boundary=047d7b45041e19c67b04eb9f3de6 - ---047d7b45041e19c67b04eb9f3de6 -Content-Type: text/plain; charset=ISO-8859-1 - -here is an image attachment - - -On Tue, Nov 19, 2013 at 5:11 PM, Neil wrote: - -> Neil -> November 19 -> -> Actually, deleting a spammer does what it's supposed to. It does mark the -> topic as deleted. -> -> That topic has id 11002, and you're right that the user was deleted. -> -> @eviltrout Any idea why it showed up in -> suggested topics? -> -> To respond, reply to this email or visit -> http://meta.discourse.org/t/spam-post-pops-back-up-in-suggested-topics/11005/5in your browser. -> ------------------------------ -> Previous Replies Neil -> November 19 -> -> Looks like a bug when deleting a spammer. I'll look at it. -> riking -> November 19 -> -> codinghorror: -> -> I can't even find that topic by name. -> -> In that case, I'm fairly certain someone used the 'Delete Spammer' -> function on the user, which would explain your inability to find it - it's -> gone. -> -> I'm raising this because, well, it's gone and shouldn't be showing up. And -> even if it was hanging around, it should be invisible to me, and not -> showing up in Suggested Topics. -> codinghorror -> November 19 -> -> Hmm, that's interesting -- can you have a look @eviltrout? -> I can't even find that topic by name. -> riking -> November 19 -> -> I'm one of the users who flagged this particular spam post, and it was -> promptly deleted/hidden, but it just popped up in the Suggested Topics box: -> -> Pasted image1125x220 27.7 KB -> -> -> We may want to recheck the suppression on these. -> ------------------------------ -> -> To respond, reply to this email or visit -> http://meta.discourse.org/t/spam-post-pops-back-up-in-suggested-topics/11005/5in your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---047d7b45041e19c67b04eb9f3de6 -Content-Type: text/html; charset=ISO-8859-1 -Content-Transfer-Encoding: quoted-printable - -
here is an image attachment


On Tue, Nov 19, 2013 at 5:11 PM, Neil = -<info@discourse.org> wrote:
-
- - - - - - - - -
- - - Neil<= -/a>
-No= -vember 19 -
-

Actually, deleting a spammer does what it's s= -upposed to. It does mark the topic as deleted.

- -

That topic has id 11002, and you're right tha= -t the user was deleted.

- -

@eviltrout Any idea why it showed up in suggested topics?

-
-
-

To respond, reply to this email or visit http://meta.discourse.org/t/spam-post-pops-back= --up-in-suggested-topics/11005/5 in your browser.

- -
-
-

Previous Replies

- - - - - - - - - -
- - - Neil<= -/a>
-No= -vember 19 -

Looks= - like a bug when deleting a spammer. I'll look at it.

- - - - - - - - -
- - - rik= -ing
-No= -vember 19 -
-

-
-codinghorror:
-

I can't even find that topic by n= -ame.

- -

In that case, I'm fairly certain someone used= - the 'Delete Spammer' function on the user, which would explain you= -r inability to find it - it's gone.

- -

I'm raising this because, well, it's gone= - and shouldn't be showing up. And even if it was hanging around, it sho= -uld be invisible to me, and not showing up in Suggested Topics.

-
- - - - - - - - -
- - - codinghorror
-No= -vember 19 -

Hmm, = -that's interesting -- can you have a look @eviltrout? I can't even find that topic by= - name.

-
- - - - - - - - -
- - - rik= -ing
-No= -vember 19 -
-

I'm one of the users who flagged this particu= -lar spam post, and it was promptly deleted/hidden, but it just popped up in= - the Suggested Topics box:

- -

- - -

We may want to recheck the suppression on these.<= -/p> -

-
-
-

To respond, reply to this email or visit http://meta.discourse.org/t/spam-post-pops-back-up-= -in-suggested-topics/11005/5 in your browser.

- -
-
-

To unsubscribe from these emails, visit your user pre= -ferences.

-
-

- ---047d7b45041e19c67b04eb9f3de6-- ---047d7b45041e19c68004eb9f3de8 -Content-Type: image/png; name="bricks.png" -Content-Disposition: attachment; filename="bricks.png" -Content-Transfer-Encoding: base64 -X-Attachment-Id: f_ho8uteve0 - -iVBORw0KGgoAAAANSUhEUgAAASEAAAB+CAIAAADk0DDaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ -bWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdp -bj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6 -eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEz -NDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJo -dHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlw -dGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAv -IiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RS -ZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpD -cmVhdG9yVG9vbD0iQWRvYmUgUGhv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UayiLcLkeydvtmcJo/swH2+JkM55BMJvsw51KVJTnOcDcwzX8Sw6rMGPkYAIjomOsP -MudT5/ycOA/+jFX3hmmRNkf8Mfn06eEpz/cijQm5/+DPhUkmDE+aS2Xv+xdpc5zhU3QdUgG3JA8x -rMqMMZcKAATzseboncfB0dp/XL151//0j3/W7uHc2WNfwQq624Igt5WUMLzWgf9Jvnjyphsp9CQT -hn2SM6OGGgxrI9kw/PqlGy/HmG+prRAcXaMjjTDepDtPumOOKeghuY9hgtvicBgGyXGY0WXoRawI -ABLYOr+jYk6KWVGV1Dy6icvZAqMMu/7VAnvbFzdjN0yAjgHA0mseZukO4lnNv70zMI4BjrZgjOA7 -WqhZcZJde4aOAUDlfOz7r+6SYdd7OPJv51Si3AQp6CD9Hw65TytW/tCPwz9y/FyRb7r/Tu3pEFHx -/g7pCbOR8SP7Le/DBNI7v+Uckl2VC2YdkQMmXAi/zfGm+t8hJ2U2tdQldr/5nwADACLM1IGrPYuL -AAAAAElFTkSuQmCC ---047d7b45041e19c68004eb9f3de8-- diff --git a/spec/fixtures/emails/auto_generated_header.eml b/spec/fixtures/emails/auto_generated_header.eml new file mode 100644 index 00000000000..74e0e9d4fd4 --- /dev/null +++ b/spec/fixtures/emails/auto_generated_header.eml @@ -0,0 +1,8 @@ +Return-Path: +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <3@foo.bar.mail> +Auto-Submitted: auto-generated +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit diff --git a/spec/fixtures/emails/auto_generated_precedence.eml b/spec/fixtures/emails/auto_generated_precedence.eml new file mode 100644 index 00000000000..bc82e2b3c26 --- /dev/null +++ b/spec/fixtures/emails/auto_generated_precedence.eml @@ -0,0 +1,8 @@ +Return-Path: +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <2@foo.bar.mail> +Precedence: list +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit diff --git a/spec/fixtures/emails/auto_reply.eml b/spec/fixtures/emails/auto_reply.eml deleted file mode 100644 index 7999c8d78b7..00000000000 --- a/spec/fixtures/emails/auto_reply.eml +++ /dev/null @@ -1,21 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+636ca428858779856c226bb145ef4fad@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -Auto-Submitted: auto-generated -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -Test reply to Discourse email digest diff --git a/spec/fixtures/emails/bad_destinations.eml b/spec/fixtures/emails/bad_destinations.eml new file mode 100644 index 00000000000..5690e66778b --- /dev/null +++ b/spec/fixtures/emails/bad_destinations.eml @@ -0,0 +1,11 @@ +Return-Path: +From: Foo Bar +To: wat@bar.com +Cc: foofoo@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <9@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/spec/fixtures/emails/big5.eml b/spec/fixtures/emails/big5.eml deleted file mode 100644 index 4a7b2082486..00000000000 --- a/spec/fixtures/emails/big5.eml +++ /dev/null @@ -1,26 +0,0 @@ - -Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org -Received: by 10.194.216.104 with SMTP id op8csp80593wjc; - Wed, 24 Jul 2013 07:59:14 -0700 (PDT) -Return-Path: -References: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -From: Walter White -In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -Mime-Version: 1.0 (1.0) -Date: Wed, 24 Jul 2013 15:59:10 +0100 -Message-ID: <4597127794206131679@unknownmsgid> -Subject: Re: [Discourse] new reply to your post in 'Crystal Blue' -To: walter via Discourse -Content-Type: multipart/alternative; boundary=20cf301cc47ada510404f040b262 - ---20cf301cc47ada510404f040b262 -Content-Type: text/plain; charset=Big5 -Content-Transfer-Encoding: base64 - -tv2hSafapFe5cbX4pEahSQ0K ---20cf301cc47ada510404f040b262 -Content-Type: text/html; charset=Big5 -Content-Transfer-Encoding: base64 - -PGRpdiBkaXI9Imx0ciI+tv2hSafapFe5cbX4pEahSTxicj48L2Rpdj4NCg== ---20cf301cc47ada510404f040b262-- diff --git a/spec/fixtures/emails/bottom_reply.eml b/spec/fixtures/emails/bottom_reply.eml deleted file mode 100644 index 5fc992971fc..00000000000 --- a/spec/fixtures/emails/bottom_reply.eml +++ /dev/null @@ -1,160 +0,0 @@ -Received: by 10.107.19.29 with SMTP id b29csp111716ioj; - Wed, 30 Jul 2014 17:52:05 -0700 (PDT) -X-Received: by 10.194.238.6 with SMTP id vg6mr11340975wjc.24.1406767925330; - Wed, 30 Jul 2014 17:52:05 -0700 (PDT) -Received: from localhost (localhost [127.0.0.1]) - by bendel.debian.org (Postfix) with QMQP - id 18F5C417; Thu, 31 Jul 2014 00:52:04 +0000 (UTC) -Old-Return-Path: -X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on bendel.debian.org -X-Spam-Level: -X-Spam-Status: No, score=-25.9 required=4.0 tests=FOURLA,LDOSUBSCRIBER, - LDO_WHITELIST,MURPHY_DEBIAN_MESSAGE,PGPSIGNATURE autolearn=unavailable - version=3.3.2 -X-Original-To: lists-debian-ctte@bendel.debian.org -Delivered-To: lists-debian-ctte@bendel.debian.org -Received: from localhost (localhost [127.0.0.1]) - by bendel.debian.org (Postfix) with ESMTP id CE6CDEE - for ; Thu, 31 Jul 2014 00:51:52 +0000 (UTC) -X-Virus-Scanned: at lists.debian.org with policy bank en-lt -X-Amavis-Spam-Status: No, score=-11.9 tagged_above=-10000 required=5.3 - tests=[BAYES_00=-2, FOURLA=0.1, LDO_WHITELIST=-5, PGPSIGNATURE=-5] - autolearn=ham -Received: from bendel.debian.org ([127.0.0.1]) - by localhost (lists.debian.org [127.0.0.1]) (amavisd-new, port 2525) - with ESMTP id SB451DwGZCOe for ; - Thu, 31 Jul 2014 00:51:47 +0000 (UTC) -X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .debian. - helo: .becquer.dodds. - helo-domain: .dodds.) FROM/MX_MATCHES_NOT_HELO(DOMAIN)=0; rate: -5 -Received: from becquer.dodds.net (becquer.dodds.net [207.224.24.209]) - by bendel.debian.org (Postfix) with ESMTP id 8E89A2B4 - for ; Thu, 31 Jul 2014 00:51:47 +0000 (UTC) -Received: from virgil.dodds.net (unknown [192.168.15.59]) - by becquer.dodds.net (Postfix) with ESMTPA id 9B0A9256EB - for ; Wed, 30 Jul 2014 17:51:19 -0700 (PDT) -Received: by virgil.dodds.net (Postfix, from userid 1000) - id 942FB60199; Wed, 30 Jul 2014 17:51:15 -0700 (PDT) -Date: Wed, 30 Jul 2014 17:51:15 -0700 -From: Jake -To: incoming+amazing@appmail.adventuretime.ooo -Subject: Re: Next Debian CTTE IRC Meeting at date -d'Thu Jul 31 17:00:00 UTC - 2014' -Message-ID: <20140731005115.GA19044@virgil.dodds.net> -Mail-Followup-To: debian-ctte@lists.debian.org -References: <20140730213924.GA12356@teltox.donarmstrong.com> -MIME-Version: 1.0 -Content-Type: multipart/signed; micalg=pgp-sha256; - protocol="application/pgp-signature"; boundary="qMm9M+Fa2AknHoGS" -Content-Disposition: inline -In-Reply-To: <20140730213924.GA12356@teltox.donarmstrong.com> -User-Agent: Mutt/1.5.23 (2014-03-12) -X-Debian-Message: Signature check passed for Debian member -X-Rc-Virus: 2007-09-13_01 -X-Rc-Spam: 2008-11-04_01 -Resent-Message-ID: -Resent-From: debian-ctte@lists.debian.org -X-Mailing-List: archive/latest/4791 -X-Loop: debian-ctte@lists.debian.org -List-Id: -List-Post: -List-Help: -List-Subscribe: -List-Unsubscribe: -Precedence: list -Resent-Sender: debian-ctte-request@lists.debian.org -Resent-Date: Thu, 31 Jul 2014 00:52:04 +0000 (UTC) - - ---qMm9M+Fa2AknHoGS -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline -Content-Transfer-Encoding: quoted-printable - -On Wed, Jul 30, 2014 at 02:39:24PM -0700, Don Armstrong wrote: -> The next Debian CTTE IRC meeting is at=20 - -> date -d 'Thu Jul 31 17:00:00 UTC 2014' on irc.debian.org in -> #debian-ctte. - -> The current meeting agenda is here, and more up-to-date ones may be -> found in the git repository. - -> #startmeeting - -> #topic Who is here? - -> #topic Next Meeting? - -> #topic #717076 Decide between libjpeg-turbo and libjpeg8 et al. - -This has been voted on; should probably be removed from the agenda, someone -just needs to confirm the vote results and get it on the website. (AIUI the -archive has already begun moving on accordingly.) - -> #topic #636783 constitution: super-majority bug - -> #topic #636783 constitution: casting vote - -> #topic #636783 constitution: minimum discussion period - -> #topic #636783 constitution: TC member retirement/rollover - -> #topic #636783 constitution: TC chair retirement/rollover - -> #topic #681419 Depends: foo | foo-nonfree - -> #topic #741573 menu systems and mime-support - -> #topic #746715 init system fallout - -Also voted and just needs to be confirmed. - -> #topic #750135 Maintainer of aptitude package ->=20 -> #topic #752400 Advice on util-linux - -This has been closed by mutual agreement of the people involved and doesn't -require any action from the TC. Removed from the agenda. - -There's also bug #744246, which was assigned to the TC at my request but -without any preamble so it may have escaped notice. However, that situation -has been evolving constructively among the related parties (apparently, an -informal comment from a member of the release team was mistaken for a -release team position, so that's now being revisited), so I don't believe -this is anything we need to put on the agenda for tomorrow despite being on -the open bug list. - ---=20 -Steve Langasek Give me a lever long enough and a Free OS -Debian Developer to set it on, and I can move the world. -Ubuntu Developer http://www.debian.org/ -slangasek@ubuntu.com vorlon@debian.org - ---qMm9M+Fa2AknHoGS -Content-Type: application/pgp-signature; name="signature.asc" -Content-Description: Digital signature - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1 - -iQIcBAEBCAAGBQJT2ZMDAAoJEFaNMPMhshM9GLsP/244S3wtYZEeVgJWIdB5PE0A -sZVezEA692y++/0oVZVecwV67yBOyfSjPPetdAph2UDMRtfurwxfj2BkbOFA2+Y6 -++MErbmC3V7IGpd/L/fFGdXgvMQT2MNBpw0fnMA7bLpNjCvoj+Hr1HXRUcWoJSlj -WmHWwWSTVRcHg8a3iWYJzY6XfLyEEgHlahrlKvJExsTx/9mc1qg7g8KGdnhzHFBl -ttdH2fxpAk/624dReCcw5RKmOLfZ1HsEl9XcVe1cb4K+MDaQiXmoEK5v3xaNz1tS -NK5v2D5gDs229zoxKzQnnzOPLHxqI5E0L9PpI/mu4T9z7H2bHR3U5BvhnT99t5uw -ydf2cZNGY0uFCV3Rvn07BfAIW5WSXhOfN/5IymRKmdhjsTiwZ/wFjFrK8tVjtERu -yeyA7RIYiblGCEKYIYLWSxhoXeEdmAdfp6EA2/IA1CpgMB+ZdSfaeMgFY7xosgmG -ax3NTnaKyhr1QEUJ2gjAwHnKjuGbRVDAinYrSvP0o8Bh9sAs2BN2negWBCZVwwkN -S9hWTjVqsBmpaPOt5SEDwDo9O9dfzkmaamDsxOuUEz9F7v5jYg0mxA/WbogGty9R -vOMKxdxRkzflL/CferVbkzL/EkZRDfWDp9SleZggrpz7miiNDbS7jdRzJ4EttmJ8 -gHBAVrOzcnbIPOIkk9pw -=KXIu ------END PGP SIGNATURE----- - ---qMm9M+Fa2AknHoGS-- - - --- -To UNSUBSCRIBE, email to debian-ctte-REQUEST@lists.debian.org -with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org -Archive: https://lists.debian.org/20140731005115.GA19044@virgil.dodds.net diff --git a/spec/fixtures/emails/boundary.eml b/spec/fixtures/emails/boundary.eml deleted file mode 100644 index 1250fe498b0..00000000000 --- a/spec/fixtures/emails/boundary.eml +++ /dev/null @@ -1,61 +0,0 @@ - -MIME-Version: 1.0 -Received: by 10.64.14.41 with HTTP; Wed, 19 Jun 2013 06:29:41 -0700 (PDT) -In-Reply-To: <51c19490e928a_13442dd8ae892548@tree.mail> -References: <51c19490e928a_13442dd8ae892548@tree.mail> -Date: Wed, 19 Jun 2013 09:29:41 -0400 -Delivered-To: finn@adventuretime.ooo -Message-ID: -Subject: Re: [Adventure Time] jake mentioned you in 'peppermint butler is - missing' -From: Finn the Human -To: jake via Adventure Time -Content-Type: multipart/alternative; boundary=001a11c206a073876a04df81d2a9 - ---001a11c206a073876a04df81d2a9 -Content-Type: text/plain; charset=ISO-8859-1 - -I'll look into it, thanks! - - -On Wednesday, June 19, 2013, jake via Discourse wrote: - -> jake mentioned you in 'peppermint butler is missing' on Adventure -> Time: -> ------------------------------ -> -> yeah, just noticed this cc @jake -> ------------------------------ -> -> Please visit this link to respond: -> http://adventuretime.ooo/t/peppermint-butler-is-missing/7628/2 -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---001a11c206a073876a04df81d2a9 -Content-Type: text/html; charset=ISO-8859-1 -Content-Transfer-Encoding: quoted-printable - -I'll look into it, thanks!

On Wednesday, June 19, 2= -013, jake via Adventure Time wrote:

sa= -m mentioned you in 'Duplicate message are shown in profile' on Adve= -nture Time

- - -

yeah, just noticed this cc @eviltrout

- -

Please visit this link to respond: http= -://adventuretime.ooo/t/peppermint-butler-is-missing/7628/2 - - -

To unsubscribe from these emails, visit your user preferences.

-
- ---001a11c206a073876a04df81d2a9-- diff --git a/spec/fixtures/emails/cc.eml b/spec/fixtures/emails/cc.eml new file mode 100644 index 00000000000..73e52c111b6 --- /dev/null +++ b/spec/fixtures/emails/cc.eml @@ -0,0 +1,12 @@ +Return-Path: +From: Foo Bar +To: someone@else.com +CC: team@bar.com, wat@bar.com, 42@bar.com +Subject: The more, the merrier +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <30@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +It is more fun with more people. diff --git a/spec/fixtures/emails/chinese_reply.eml b/spec/fixtures/emails/chinese_reply.eml new file mode 100644 index 00000000000..befb3b1cbb7 --- /dev/null +++ b/spec/fixtures/emails/chinese_reply.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <17@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=Big5 +Content-Transfer-Encoding: base64 + +5oKo5aW977yBIOS9oOS7iuWkqeWlveWQl++8nw== diff --git a/spec/fixtures/emails/dutch.eml b/spec/fixtures/emails/dutch.eml deleted file mode 100644 index 7be08dc4938..00000000000 --- a/spec/fixtures/emails/dutch.eml +++ /dev/null @@ -1,20 +0,0 @@ - -Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org -Received: by 10.194.216.104 with SMTP id op8csp80593wjc; - Wed, 24 Jul 2013 07:59:14 -0700 (PDT) -Return-Path: -References: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -From: Walter White -In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -Mime-Version: 1.0 (1.0) -Date: Wed, 24 Jul 2013 15:59:10 +0100 -Message-ID: <4597127794206131679@unknownmsgid> -Subject: Re: [Discourse] new reply to your post in 'Crystal Blue' -To: walter via Discourse -Content-Type: multipart/alternative; boundary=001a11c20edc15a39304e2432790 - -Dit is een antwoord in het Nederlands. - -Op 18 juli 2013 10:23 schreef Sander Datema het volgende: - -Dit is de originele post. \ No newline at end of file diff --git a/spec/fixtures/emails/empty.eml b/spec/fixtures/emails/empty.eml deleted file mode 100644 index 85bebc66245..00000000000 --- a/spec/fixtures/emails/empty.eml +++ /dev/null @@ -1,21 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - - - diff --git a/spec/fixtures/emails/encoded_display_name.eml b/spec/fixtures/emails/encoded_display_name.eml new file mode 100644 index 00000000000..cf31f703ef7 --- /dev/null +++ b/spec/fixtures/emails/encoded_display_name.eml @@ -0,0 +1,11 @@ +Return-Path: +From: =?UTF-8?B?0KHQu9GD0YfQsNC50L3QsNGP?= =?UTF-8?B?INCY0LzRjw==?= +To: team@bar.com +Subject: I need help +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <29@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Будьте здоровы! diff --git a/spec/fixtures/emails/from_the_future.eml b/spec/fixtures/emails/from_the_future.eml new file mode 100644 index 00000000000..6e14c442e1d --- /dev/null +++ b/spec/fixtures/emails/from_the_future.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Wed, 01 Jan 3000 00:00:00 +0100 +Message-ID: <4@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Back to the future! diff --git a/spec/fixtures/emails/gmail_web.eml b/spec/fixtures/emails/gmail_web.eml deleted file mode 100644 index 8bb83835711..00000000000 --- a/spec/fixtures/emails/gmail_web.eml +++ /dev/null @@ -1,181 +0,0 @@ -Delivered-To: reply@discourse.org -Return-Path: -MIME-Version: 1.0 -In-Reply-To: -References: - -Date: Fri, 28 Nov 2014 12:36:49 -0800 -Subject: Re: [Discourse Meta] [Lounge] Testing default email replies -From: Walter White -To: Discourse Meta -Content-Type: multipart/alternative; boundary=001a11c2e04e6544f30508f138ba - ---001a11c2e04e6544f30508f138ba -Content-Type: text/plain; charset=UTF-8 - -### This is a reply from standard GMail in Google Chrome. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. - -Here's some **bold** text in Markdown. - -Here's a link http://example.com - -On Fri, Nov 28, 2014 at 12:35 PM, Arpit Jalan wrote: - -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> ------------------------------ -> Previous Replies codinghorror -> -> November 28 -> -> We're testing the latest GitHub email processing library which we are -> integrating now. -> -> https://github.com/github/email_reply_parser -> -> Go ahead and reply to this topic and I'll reply from various email clients -> for testing. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---001a11c2e04e6544f30508f138ba -Content-Type: text/html; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -
### This is a reply from standard GMail in Google Chr= -ome.

The quick brown fox jumps over the lazy dog. = -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over= - the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown= - fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. = -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over= - the lazy dog.=C2=A0

Here's some **bold** text= - in Markdown.

Here's a link http://example.com
<= -br>
On Fri, Nov 28, 2014 at 12:35 PM, Arpit Jalan= - <info@discourse.org> wrote:
- - - - - - - - - - - -
- - - techAPJ
- November 28 -
-

Test reply.

- -

First paragraph.

- -

Second paragraph.

-
- - -
-

To respond, reply to this email or visit https:/= -/meta.discourse.org/t/testing-default-email-replies/22638/3 in your bro= -wser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - codinghorror - November 28 -
-

We're testing the latest GitHub emai= -l processing library which we are integrating now.

- -

https://github.com/github/email_reply_parser

- -

Go ahead and reply to this topic and I&#= -39;ll reply from various email clients for testing.

-
- - -
- -
-

To respond, reply to this email or visit https://met= -a.discourse.org/t/testing-default-email-replies/22638/3 in your browser= -.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
-

- ---001a11c2e04e6544f30508f138ba-- diff --git a/spec/fixtures/emails/hebrew.eml b/spec/fixtures/emails/hebrew.eml deleted file mode 100644 index f4c8f01adc3..00000000000 --- a/spec/fixtures/emails/hebrew.eml +++ /dev/null @@ -1,17 +0,0 @@ - -Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org -Received: by 10.194.216.104 with SMTP id op8csp80593wjc; - Wed, 24 Jul 2013 07:59:14 -0700 (PDT) -Return-Path: -References: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -From: Walter White -In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -Mime-Version: 1.0 (1.0) -Date: Wed, 24 Jul 2013 15:59:10 +0100 -Message-ID: <4597127794206131679@unknownmsgid> -Subject: Re: [Discourse] new reply to your post in 'Crystal Blue' -To: walter via Discourse -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: base64 - -16nXnNeV150= \ No newline at end of file diff --git a/spec/fixtures/emails/hebrew_reply.eml b/spec/fixtures/emails/hebrew_reply.eml new file mode 100644 index 00000000000..450e2dea2fc --- /dev/null +++ b/spec/fixtures/emails/hebrew_reply.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <16@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: base64 + +16nXnNeV150hINee15Qg16nXnNeV157XmiDXlNeZ15XXnT8= diff --git a/spec/fixtures/emails/html_only.eml b/spec/fixtures/emails/html_only.eml deleted file mode 100644 index db88f2c3885..00000000000 --- a/spec/fixtures/emails/html_only.eml +++ /dev/null @@ -1,93 +0,0 @@ - -Delivered-To: walter@breakingbad.com -Received: by 10.64.13.41 with SMTP id m9csp29769iec; - Thu, 20 Jun 2013 08:53:22 -0700 (PDT) -X-Received: by 10.252.23.9 with SMTP id p9mr4055675lag.4.1371743601980; - Thu, 20 Jun 2013 08:53:21 -0700 (PDT) -Received: from mail-la0-x229.google.com (mail-la0-x229.google.com [2a00:1450:4010:c03::229]) - by mx.google.com with ESMTPS id u4si430203lae.48.2013.06.20.08.53.20 - for - (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); - Thu, 20 Jun 2013 08:53:21 -0700 (PDT) -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=google.com; s=20120113; - h=x-forwarded-to:x-forwarded-for:delivered-to:x-return-path - :content-type:mime-version:content-transfer-encoding:x-mailer - :message-id:date:subject:from:in-reply-to:to:resent-date:resent-from - :resent-to:resent-subject:resent-message-id:resent-user-agent - :x-scanned-by:x-gm-message-state; - bh=9O67r74ofh9WkEaKTRB/frQ3MKOtQlbCac2mz0/MiyY=; - b=YVAo2/JDMP53RxDmqDEKNcEMtggtfaVyq2DoseZ6vBAfB7G6NtHC9ZEkRs4oGhk6LU - fnyAPe0wnz5d9WINoMAuuTRIhplLxzcqysduSnAJAQ2qqR7mFBnlj9wJeVEKltNwmUME - nPwxsf8go20VBzrZCtECPedcLi60wbl32NCXVn0qwt2LvKiy6ktSS5Xgb4zY8i4dfXAP - 6Y5gu32boooWIb9DkH1TJkn3C0RrEugNlw/DUnXrnkFefgxWF3pt/zcoW/wYRyikOdx+ - smBClgR9my6QmsS2KsQrMvWJZUva7fddTiZ6FC22e4hW+8Wha0RaZOZu5O7hjg6G4/1g - IEyg== -X-Received: by 10.112.55.9 with SMTP id n9mr5916187lbp.5.1371743600857; - Thu, 20 Jun 2013 08:53:20 -0700 (PDT) -X-Forwarded-To: walter@breakingbad.com -X-Forwarded-For: walter@breakingbad.com -Delivered-To: walter@breakingbad.com -Content-Type: text/html; charset="us-ascii" -MIME-Version: 1.0 -Content-Transfer-Encoding: quoted-printable -X-Mailer: BlackBerry Email (10.1.0.1720) -Message-ID: <20130619231548.6307981.74194.2379@breakingbad.com> -Date: Wed, 19 Jun 2013 19:15:48 -0400 -Subject: Re: [Discourse Meta] [PM] re: Regarding your post in "Site - Customization not working" -From: aaron@breakingbad.com -In-Reply-To: <51c238655a394_5f4e3ce6690667bd@tiefighter2.mail> -To: reply+20c1b0a8bd1a63c0163cc7e7641ca06b@appmail.adventuretime.ooo -ReSent-Date: Thu, 20 Jun 2013 11:53:08 -0400 (EDT) -ReSent-From: Aaron -ReSent-Subject: Re: [Discourse Meta] [PM] re: Regarding your post in "Site - Customization not working" -X-Gm-Message-State: ALoCoQl1BtN83rAX7At808XAPv1yCqUK3Du2IvK7eCyY3jsI77u4e5cak28307pYYHAo1JlO/Eu9 - -
The EC2 instance - I've seen that th= -ere tends to be odd and unrecommended settings on the Bitnami installs that= - I've checked out.
= - = -

= - = -
= - = - = -
= -From: Grizzly B via Discourse Meta
Sent: Wednesday, J= -une 19, 2013 19:02
To: aaron@breakingbad.com
= -Reply To: Grizzly B via Discourse Meta
Subject: [Disc= -ourse Meta] [PM] re: Regarding your post in "Site Customization
not wor= -king"

Grizzly B just sent you a private message

- -

Log in to our EC2 instance -or- log into a new DigitalOcean instanc= -e?

- -

Please visit this link to respond: http://= -meta.discourse.org/t/regarding-your-post-in-site-customization-not-working/= -7641/5

- -

To unsubscribe from these emails, visit your user preferences.

-
diff --git a/spec/fixtures/emails/html_paragraphs.eml b/spec/fixtures/emails/html_paragraphs.eml deleted file mode 100644 index 3fe37fb8b17..00000000000 --- a/spec/fixtures/emails/html_paragraphs.eml +++ /dev/null @@ -1,205 +0,0 @@ - -MIME-Version: 1.0 -Received: by 10.25.161.144 with HTTP; Tue, 7 Oct 2014 22:17:17 -0700 (PDT) -X-Originating-IP: [117.207.85.84] -In-Reply-To: <5434c8b52bb3a_623ff09fec70f049749@discourse-app.mail> -References: - <5434c8b52bb3a_623ff09fec70f049749@discourse-app.mail> -Date: Wed, 8 Oct 2014 10:47:17 +0530 -Delivered-To: arpit@techapj.com -Message-ID: -Subject: Re: [Discourse] [Meta] Welcome to techAPJ's Discourse! -From: Arpit Jalan -To: Discourse -Content-Type: multipart/alternative; boundary=001a114119d8f4e46e0504e26d5b - ---001a114119d8f4e46e0504e26d5b -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -Awesome! - -Pleasure to have you here! - -:boom: - -On Wed, Oct 8, 2014 at 10:46 AM, ajalan -wrote: - -> ajalan -> -> October 8 -> -> Nice to be here! Thanks! [image: smile] -> -> To respond, reply to this email or visit -> http://discourse.techapj.com/t/welcome-to-techapjs-discourse/35/2 -> -> in your browser. -> ------------------------------ -> Previous Replies techAPJ -> -> October 8 -> -> Welcome to techAPJ's Discourse! -> ------------------------------ -> -> To respond, reply to this email or visit -> http://discourse.techapj.com/t/welcome-to-techapjs-discourse/35/2 -> -> in your browser. -> -> To unsubscribe from these emails, visit your user preferences -> -> . -> - ---001a114119d8f4e46e0504e26d5b -Content-Type: text/html; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -
Awesome!

Pleasure to have you here!

:boom:

On Wed, Oct 8, 2014 at 10:46 AM, ajalan <info@unconfigured.discourse.org> wrote:
- - - - - - - - - - - -
- - - ajalan
- October 8 -

Nice to be here! Thanks! 3D"smile"

- - -
-

To respond, reply to this email or visit http://discourse= -.techapj.com/t/welcome-to-techapjs-discourse/35/2 in your browser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - techAPJ
- October 8 -

Welcome to techAPJ's Discourse!

- - -
- -
-

To respond, reply to this email or visit http://discourse.tec= -hapj.com/t/welcome-to-techapjs-discourse/35/2 in your browser.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
- -
= -
- ---001a114119d8f4e46e0504e26d5b-- diff --git a/spec/fixtures/emails/html_reply.eml b/spec/fixtures/emails/html_reply.eml new file mode 100644 index 00000000000..28e5feff851 --- /dev/null +++ b/spec/fixtures/emails/html_reply.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <18@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +
This is a HTML reply ;)
diff --git a/spec/fixtures/emails/inactive_sender.eml b/spec/fixtures/emails/inactive_sender.eml new file mode 100644 index 00000000000..d22e9507887 --- /dev/null +++ b/spec/fixtures/emails/inactive_sender.eml @@ -0,0 +1,9 @@ +Return-Path: +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <8@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/spec/fixtures/emails/inline_attachment.eml b/spec/fixtures/emails/inline_attachment.eml new file mode 100644 index 00000000000..52188b2a787 --- /dev/null +++ b/spec/fixtures/emails/inline_attachment.eml @@ -0,0 +1,76 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <28@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: multipart/related; boundary=001a114b2eccff183a052998ec68 + +--001a114b2eccff183a052998ec68 +Content-Type: multipart/alternative; boundary=001a114b2eccff1836052998ec67 + +--001a114b2eccff1836052998ec67 +Content-Type: text/plain; charset=UTF-8 + +Before + +[image: 内嵌图片 1] + +After + +--001a114b2eccff1836052998ec67 +Content-Type: text/html; charset=UTF-8 + +
Before

内嵌图片 1
+

After
+ +--001a114b2eccff1836052998ec67-- +--001a114b2eccff183a052998ec68 +Content-Type: image/png; name="logo.png" +Content-Disposition: inline; filename="logo.png" +Content-Transfer-Encoding: base64 +Content-ID: +X-Attachment-Id: ii_1525434659ddb4cb + +iVBORw0KGgoAAAANSUhEUgAAAPQAAABCCAMAAABXYgukAA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Eo6laGV/kPoAM2tvJCnWxOXejF/8iiIi3T4GJjN8qU7DBbm98jeLq4s +UGAlShVa2RUYG8zR0iGHCn20NTXbj3lZcbRTBE1IZwUeLN7Lu7r7t5brIczMtKWeT90e0EQpFBYY +tvpBzxye68e8GobSCIEVBqlhEFgA1Ft00HXgfTQGjMqyGcnYvA4RgQJelL3TO2MAKoPvpvK5XQA9 +P3GhR7FKmO+H4ZMlgKZF0LzbY5sAbTN1cGBzdJKC+mqbimkDakB2IndlaGBODRAPoKna7xOanINy +0GNflHefT4OUOXwmQDaGhtbCoFSXFkYhNnRKuaG8fOhlB0DdQA+MHEhNOmRjH0MDKqdU2kiEde1S +zWpylk2wlDx291YZ8tdBrOcx8wN0HEbQrkDye7QKDvQVWBbQYOmovBed1j3IezkxW4U++u0BqE0v +Dp0C4t3bCfKr16HKzEgBNMdrhHWVzke0wrtRco3ZBdD4tintb36+oOSxn9KMdXEhhny0/fTFi+3t +R0FHb2I3vz2Gh3758C5+y47o5WTY18xBhyW0aAyNDXC5bGJmBP3rbEq8+ubhu403r4JMq69j5PD2 +deTDokRGMTOeTObHw8RUrti43uNBJ4aGW4r7AV/Ho0gM/XtE/MfinY37t1fWtx6H4cbr5cVIz+/8 ++S6M9XYTxxmGhlkzDGpkEQfYPI7qp9X9DuMJF56JY3t6Ism+ZaLpNjYsPNfP1+nJv/7+59+t891T +4/X1t6GsJ5tLaN9I8q1Yvvo/eBl/EK7kL9mNIpFO+9hHZR+y8W+KXjq2vtIBf3J681luXFlfYc6h +eOV7GJkb/5d5+KCbjaGDZlZjiKChwA8RNEx1hwcanvIPGbThAPKQQBvQuQ4FtKeb8GrOQOg/pxLS +uIDrr6oAAAAASUVORK5CYII= +--001a114b2eccff183a052998ec68-- diff --git a/spec/fixtures/emails/inline_mixed.eml b/spec/fixtures/emails/inline_mixed.eml deleted file mode 100644 index f8be9c7a548..00000000000 --- a/spec/fixtures/emails/inline_mixed.eml +++ /dev/null @@ -1,37 +0,0 @@ -In-Reply-To: -References: - <5434ced4ee0f9_663fb0b5f76070593b@discourse-app.mail> -Date: Mon, 1 Dec 2014 20:48:40 +0530 -Delivered-To: someone@googlemail.com -Subject: Re: [Discourse] [Meta] Testing reply via email -From: Walter White -To: Discourse -Content-Type: multipart/alternative; boundary=20cf30363f8522466905092920a6 - ---20cf30363f8522466905092920a6 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -On Wed, Oct 8, 2014 at 11:12 AM, techAPJ wrote: - -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. - -> First paragraph. -> -> Second paragraph. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown diff --git a/spec/fixtures/emails/inline_mixed_replies.eml b/spec/fixtures/emails/inline_mixed_replies.eml new file mode 100644 index 00000000000..05c299e96aa --- /dev/null +++ b/spec/fixtures/emails/inline_mixed_replies.eml @@ -0,0 +1,19 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <24@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 + +On Tue, Jan 15, 2016 at 11:12 AM, Bar Foo wrote: + +> WAT November 28 +> +> This is the previous post. + +And this is *my* reply :+1: + +> This is another post. + +And this is **another** reply. diff --git a/spec/fixtures/emails/inline_reply.eml b/spec/fixtures/emails/inline_reply.eml index 39625a225da..b65518e2aa4 100644 --- a/spec/fixtures/emails/inline_reply.eml +++ b/spec/fixtures/emails/inline_reply.eml @@ -1,60 +1,15 @@ - -MIME-Version: 1.0 -In-Reply-To: -References: - <5434ced4ee0f9_663fb0b5f76070593b@discourse-app.mail> -Date: Mon, 1 Dec 2014 20:48:40 +0530 -Delivered-To: someone@googlemail.com -Subject: Re: [Discourse] [Meta] Testing reply via email -From: Walter White -To: Discourse -Content-Type: multipart/alternative; boundary=20cf30363f8522466905092920a6 - ---20cf30363f8522466905092920a6 +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <23@foo.bar.mail> +Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable -On Wed, Oct 8, 2014 at 11:12 AM, techAPJ -wrote: +On Tue, Jan 15, 2016 at 11:12 AM, Bar Foo wrote: -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> ------------------------------ -> Previous Replies codinghorror -> -> November 28 -> -> We're testing the latest GitHub email processing library which we are -> integrating now. -> -> https://github.com/github/email_reply_parser -> -> Go ahead and reply to this topic and I'll reply from various email clients -> for testing. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . +> WAT November 28 > +> This is the previous post. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. - ---20cf30363f8522466905092920a6-- +And this is *my* reply :+1: diff --git a/spec/fixtures/emails/insufficient_trust_level.eml b/spec/fixtures/emails/insufficient_trust_level.eml new file mode 100644 index 00000000000..4800b432bee --- /dev/null +++ b/spec/fixtures/emails/insufficient_trust_level.eml @@ -0,0 +1,11 @@ +Return-Path: +From: Foo Bar +To: category@bar.com +Subject: This is a topic from a complete stranger +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <32@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Hey, this is a topic from a complete stranger ;) diff --git a/spec/fixtures/emails/ios_default.eml b/spec/fixtures/emails/ios_default.eml deleted file mode 100644 index 8d4d58feb16..00000000000 --- a/spec/fixtures/emails/ios_default.eml +++ /dev/null @@ -1,136 +0,0 @@ -Delivered-To: reply@discourse.org -Return-Path: -From: Walter White -Content-Type: multipart/alternative; - boundary=Apple-Mail-B41C7F8E-3639-49B0-A5D5-440E125A7105 -Content-Transfer-Encoding: 7bit -Mime-Version: 1.0 (1.0) -Subject: Re: [Discourse Meta] [Lounge] Testing default email replies -Date: Fri, 28 Nov 2014 12:41:41 -0800 -References: -In-Reply-To: -To: Discourse Meta -X-Mailer: iPhone Mail (12B436) - - ---Apple-Mail-B41C7F8E-3639-49B0-A5D5-440E125A7105 -Content-Type: text/plain; - charset=us-ascii -Content-Transfer-Encoding: quoted-printable - -### this is a reply from iOS default mail - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over t= -he lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fo= -x jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The q= -uick brown fox jumps over the lazy dog. The quick brown fox jumps over the l= -azy dog.=20 - -Here's some **bold** markdown text. - -Here's a link http://example.com - - -> On Nov 28, 2014, at 12:35 PM, Arpit Jalan wrote: ->=20 ->=20 -> techAPJ -> November 28 -> Test reply. ->=20 -> First paragraph. ->=20 -> Second paragraph. ->=20 -> To respond, reply to this email or visit https://meta.discourse.org/t/test= -ing-default-email-replies/22638/3 in your browser. ->=20 -> Previous Replies ->=20 -> codinghorror -> November 28 -> We're testing the latest GitHub email processing library which we are inte= -grating now. ->=20 -> https://github.com/github/email_reply_parser ->=20 -> Go ahead and reply to this topic and I'll reply from various email clients= - for testing. ->=20 -> To respond, reply to this email or visit https://meta.discourse.org/t/test= -ing-default-email-replies/22638/3 in your browser. ->=20 -> To unsubscribe from these emails, visit your user preferences. - ---Apple-Mail-B41C7F8E-3639-49B0-A5D5-440E125A7105 -Content-Type: text/html; - charset=utf-8 -Content-Transfer-Encoding: 7bit - -
### this is a reply from iOS default mail

The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. 

Here's some **bold** markdown text.

Here's a link http://example.com


On Nov 28, 2014, at 12:35 PM, Arpit Jalan <info@discourse.org> wrote:

- - - - - - - - - - - -
- - - techAPJ
- November 28 -
-

Test reply.

- -

First paragraph.

- -

Second paragraph.

-
- - -
-

To respond, reply to this email or visit https://meta.discourse.org/t/testing-default-email-replies/22638/3 in your browser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - codinghorror
- November 28 -
-

We're testing the latest GitHub email processing library which we are integrating now.

- -

https://github.com/github/email_reply_parser

- -

Go ahead and reply to this topic and I'll reply from various email clients for testing.

-
- - -
- -
-

To respond, reply to this email or visit https://meta.discourse.org/t/testing-default-email-replies/22638/3 in your browser.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
-
---Apple-Mail-B41C7F8E-3639-49B0-A5D5-440E125A7105-- diff --git a/spec/fixtures/emails/iphone_signature.eml b/spec/fixtures/emails/iphone_signature.eml index d314ad1f1ea..79183b4a3f0 100644 --- a/spec/fixtures/emails/iphone_signature.eml +++ b/spec/fixtures/emails/iphone_signature.eml @@ -1,29 +1,11 @@ -Delivered-To: test@mail.com -Return-Path: -From: Walter White -Content-Type: multipart/alternative; - boundary=Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Transfer-Encoding: 7bit -Mime-Version: 1.0 (1.0) -Subject: Re: Signature in email replies! -Date: Thu, 23 Oct 2014 14:43:49 +0530 -References: <1234@mail.gmail.com> -In-Reply-To: <1234@mail.gmail.com> -To: Arpit Jalan -X-Mailer: iPhone Mail (12A405) +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <25@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +This is not the signature you're looking for. ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Type: text/plain; - charset=us-ascii -Content-Transfer-Encoding: 7bit - -This post should not include signature. - -Sent from my iPhone - -> On 23-Oct-2014, at 9:45 am, Arpit Jalan wrote: -> -> Signature in email replies! - ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 +Sent from my iMachine diff --git a/spec/fixtures/emails/like.eml b/spec/fixtures/emails/like.eml index 3bd9ae0fa7c..39829fcaab7 100644 --- a/spec/fixtures/emails/like.eml +++ b/spec/fixtures/emails/like.eml @@ -1,37 +1,10 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: FROM -To: TO -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <13@foo.bar.mail> Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 +Content-Type: text/plain Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 -LIKE - - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> ++1 diff --git a/spec/fixtures/emails/missing_message_id.eml b/spec/fixtures/emails/missing_message_id.eml new file mode 100644 index 00000000000..03405bed3cb --- /dev/null +++ b/spec/fixtures/emails/missing_message_id.eml @@ -0,0 +1,5 @@ +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit diff --git a/spec/fixtures/emails/multiple_destinations.eml b/spec/fixtures/emails/multiple_destinations.eml deleted file mode 100644 index 6d31bbf1974..00000000000 --- a/spec/fixtures/emails/multiple_destinations.eml +++ /dev/null @@ -1,40 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: finn@adventuretime.ooo, reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -I could not disagree more. I am obviously biased but adventure time is the -greatest show ever created. Everyone should watch it. - -- Jake out - - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> \ No newline at end of file diff --git a/spec/fixtures/emails/newlines.eml b/spec/fixtures/emails/newlines.eml deleted file mode 100644 index cf03b9d18bc..00000000000 --- a/spec/fixtures/emails/newlines.eml +++ /dev/null @@ -1,84 +0,0 @@ -In-Reply-To: -Date: Wed, 8 Oct 2014 10:36:19 +0530 -Delivered-To: walter.white@googlemail.com -Subject: Re: [Discourse] Welcome to Discourse -From: Walter White -To: Discourse -Content-Type: multipart/alternative; boundary=bcaec554078cc3d0c10504e24661 - ---bcaec554078cc3d0c10504e24661 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -This is my reply. -It is my best reply. -It will also be my *only* reply. - -On Wed, Oct 8, 2014 at 10:33 AM, ajalan -wrote: - -> ajalan -> -> October 8 -> -> Awesome! Thank You! [image: +1] -> -> To respond, reply to this email or visit -> http://discourse.techapj.com/t/welcome-to-discourse/8/2 -> -> in your browser. -> ------------------------------ -> Previous Replies system -> -> October 8 -> -> The first paragraph of this pinned topic will be visible as a welcome -> message to all new visitors on your homepage. It's important! -> -> *Edit this* into a brief description of your community: -> -> - Who is it for? -> - What can they find here? -> - Why should they come here? -> - Where can they read more (links, resources, etc)? -> -> You may want to close this topic via the wrench icon at the upper right, -> so that replies don't pile up on an announcement. -> ------------------------------ -> -> To respond, reply to this email or visit -> http://discourse.techapj.com/t/welcome-to-discourse/8/2 -> -> in your browser. -> -> To unsubscribe from these emails, visit your user preferences -> -> . -> - ---bcaec554078cc3d0c10504e24661 diff --git a/spec/fixtures/emails/no_body.eml b/spec/fixtures/emails/no_body.eml new file mode 100644 index 00000000000..02afbe73315 --- /dev/null +++ b/spec/fixtures/emails/no_body.eml @@ -0,0 +1,7 @@ +Return-Path: +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <5@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit diff --git a/spec/fixtures/emails/no_body_with_attachments.eml b/spec/fixtures/emails/no_body_with_attachments.eml new file mode 100644 index 00000000000..7e768d118dc --- /dev/null +++ b/spec/fixtures/emails/no_body_with_attachments.eml @@ -0,0 +1,75 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <6@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: multipart/mixed; + boundary="--==_mimepart_56990c8d3f66c_7cb53ffbb98602004746e"; + charset=UTF-8 +Content-Transfer-Encoding: 7bit + + +----==_mimepart_56990c8d3f66c_7cb53ffbb98602004746e +Content-Type: image/png; + charset=UTF-8; + filename=logo.png +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; + filename=logo.png +Content-ID: <56990c92d6c64_7cb53ffbb986020047616@foo.bar.mail> + +iVBORw0KGgoAAAANSUhEUgAAAPQAAABCCAMAAABXYgukAAABhlBMVEUAAAAj +HyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAj +HyAAqVAAru/lGyTxXCL/+a5UHiHZGyTqNyPtRCM7HyHwWCLrPCOEHSL95Z31 +g0W1HCMgs1wAqnghKC0Aq5YJirsAqm6oHCMPb5QArccUXnsSZ4hAvWj80ouP +1oXoKyR4HSL0eTz4q2j+76XsQCOf24vpLyNsHiJgHiEYTGHyZiucHSPzcDTf +76ILga7qMyMwuGIArdEaQ1T7yIJwzHn2l1f6vnovHyDuTCPNHCQfMTr3oV/w +VCL5tHEHk8gArKDnJyTvUCIAruUWVW4ArLMQrlYNeKEEnNVQwm0cOkcAq4KA +0X/mHyQAqVoArKkAq4wCpeIArdvnIyT1jU4AqmQUXV3v9KikRSHP6pwwIyBH +HiHKUSLxaDTtSCMCpLpgx3PaHyTtSSy/5Zetw3b83JSVSiT0i1egMSI+qVa2 +JCMrbVbiX0Ygs2YArL2LkGApkWQLf2kSZmpFMZD0AAAAEHRSTlMAEFCAv8+v +QCBw72CP358w5xEcGAAABxJJREFUeF7lmuW/uzoMh1eKrUApbMfd9efu7u5u +193d739+gbHQBtg49x3b99U5H7asD0mTNNAoE9GobohUukmtxqDLbhoCi5nO +ICNruigWc+0BRXY80UN8ELEtQ/QWo4OGTFzRX4Y/UMy+ISqpOUi7mYmK4oPD +LKpLJ4PBzMVOZAwEdVNgje6dmZ+fX5vZ+1mhrwcwto+stTKNnRgdxH3tq0B7 +r6W4d/fEirivHR24HE48Ja47yO+NX22nujlxuDU/ialrXq9NmWUmQd7TIQZN +TX9zBCczGYCymjVrmoxyIgnrDvLJS5d3jUSa3XXr/fbU+Ayipvi2mT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AAASUVORK5C +YII= + +----==_mimepart_56990c8d3f66c_7cb53ffbb98602004746e-- diff --git a/spec/fixtures/emails/no_content_reply.eml b/spec/fixtures/emails/no_content_reply.eml deleted file mode 100644 index 95eb2055ce6..00000000000 --- a/spec/fixtures/emails/no_content_reply.eml +++ /dev/null @@ -1,34 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> \ No newline at end of file diff --git a/spec/fixtures/emails/no_return_path.eml b/spec/fixtures/emails/no_return_path.eml new file mode 100644 index 00000000000..3fae2e6bc84 --- /dev/null +++ b/spec/fixtures/emails/no_return_path.eml @@ -0,0 +1,7 @@ +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <1@foo.bar.mail> +Precedence: list +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit diff --git a/spec/fixtures/emails/on_date_contact_wrote.eml b/spec/fixtures/emails/on_date_contact_wrote.eml new file mode 100644 index 00000000000..33f0527d934 --- /dev/null +++ b/spec/fixtures/emails/on_date_contact_wrote.eml @@ -0,0 +1,19 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <20@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 + +This is the actual reply. + +On Tue, Jan 14, 2016 at 0:42 AM, Bar Foo wrote: + +> This is the previous email. +> And it had +> +> a lot +> +> +> of lines ;) diff --git a/spec/fixtures/emails/on_wrote.eml b/spec/fixtures/emails/on_wrote.eml deleted file mode 100644 index feb59bd27bb..00000000000 --- a/spec/fixtures/emails/on_wrote.eml +++ /dev/null @@ -1,277 +0,0 @@ - -MIME-Version: 1.0 -Received: by 10.107.9.17 with HTTP; Tue, 9 Sep 2014 16:18:19 -0700 (PDT) -In-Reply-To: <540f16d4c08d9_4a3f9ff6d61890391c@tiefighter4-meta.mail> -References: - <540f16d4c08d9_4a3f9ff6d61890391c@tiefighter4-meta.mail> -Date: Tue, 9 Sep 2014 16:18:19 -0700 -Delivered-To: kanepyork@gmail.com -Message-ID: -Subject: Re: [Discourse Meta] Badge icons - where to find them? -From: Kane York -To: Discourse Meta -Content-Type: multipart/alternative; boundary=001a11c34c389e728f0502aa26a0 - ---001a11c34c389e728f0502aa26a0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -Sure, all you need to do is frobnicate the foobar and you'll be all set! - -On Tue, Sep 9, 2014 at 8:03 AM, gordon_ryan wrote: - -> gordon_ryan -> September 9 -> -> @riking - willing to step by -> step of the custom icon method for an admittedly ignorant admin? Seriousl= -y -> confused. -> -> Or anyone else who knows how to do this [image: smiley] -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/badge-icons-where-to-find-them/18058/9 in -> your browser. -> ------------------------------ -> Previous Replies riking -> July 25 -> -> Check out the "HTML Head" section in the "Content" tab of the admin panel= -. -> meglio -> July 25 -> -> How will it load the related custom font? -> riking -> July 25 -> -> Here's an example of the styles that FA applies. I'll use fa-heart"> as the example. -> -> .fa { -> display: inline-block; -> font-family: FontAwesome; -> font-style: normal; -> font-weight: normal; -> line-height: 1; -> -webkit-font-smoothing: antialiased; -> -moz-osx-font-smoothing: grayscale; -> } -> .fa-heart:before { -> content: "\f004"; -> } -> -> So you could do this in your site stylesheet: -> -> .fa-custom-burger:before { -> content: "\01f354"; -> font-family: inherit; -> } -> -> And get =F0=9F=8D=94 as your badge icon when you enter custom-burger. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/badge-icons-where-to-find-them/18058/9 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---001a11c34c389e728f0502aa26a0 -Content-Type: text/html; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -
Sure, all you need to do is frobnicate the foobar and you'll be all s= -et!


= -
On Tue, Sep 9, 2014 at 8:03 AM, gordon_ryan = -<info@discourse.org> wrote:
- - - - - - - - - - - - -
- - - gordon_ryan
- September 9 -
-

@riking- willing to step by step of the custom icon me= -thod for an admittedly ignorant admin? Seriously confused.

- -

Or anyone else who knows how to do this = -3D"smiley"

-
- - -
-

To respond, reply to this email or visit https:= -//meta.discourse.org/t/badge-icons-where-to-find-them/18058/9 in your b= -rowser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - riking
- July 25 -

Check out the "HTML Head" section in the "Content&= -quot; tab of the admin panel.

- - - - - - - - - - - -
- - - meglio
- July 25 -

How will it load the related custom font?

- - - - - - - - - - - -
- - - riking
- July 25 -
-

Here's an example of the styles that= - FA applies. I'll use <i class=3D"fa fa-heart"></i> as the e= -xample.

- -

-
.fa {
-  display: inline-block;
-  font-family: FontAwesome;
-  font-style: normal;
-  font-weight: normal;
-  line-height: 1;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-}
-.fa-heart:before {
-  content: "\f004";
-}
- -

So you could do this in your site styles= -heet:

- -

-
.fa-custom-burger:before {
-  content: "\01f354";
-  font-family: inherit;
-}
- -

And get =F0=9F=8D=94 as your badge icon = -when you enter cus= -tom-burger.

-
- - -
- -
-

To respond, reply to this email or visit https://me= -ta.discourse.org/t/badge-icons-where-to-find-them/18058/9 in your brows= -er.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
-

- ---001a11c34c389e728f0502aa26a0-- \ No newline at end of file diff --git a/spec/fixtures/emails/original_message.eml b/spec/fixtures/emails/original_message.eml new file mode 100644 index 00000000000..8dbc5d1820c --- /dev/null +++ b/spec/fixtures/emails/original_message.eml @@ -0,0 +1,12 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <27@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 + +This is a reply :) + +---Original Message--- +This part should not be included diff --git a/spec/fixtures/emails/original_message_context.eml b/spec/fixtures/emails/original_message_context.eml deleted file mode 100644 index 31088c16e6f..00000000000 --- a/spec/fixtures/emails/original_message_context.eml +++ /dev/null @@ -1,30 +0,0 @@ -Delivered-To: test@mail.com -Return-Path: -From: Walter White -Content-Type: multipart/alternative; - boundary=Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Transfer-Encoding: 7bit -Mime-Version: 1.0 (1.0) -Subject: Re: Signature in email replies! -Date: Thu, 23 Oct 2014 14:43:49 +0530 -References: <1234@mail.gmail.com> -In-Reply-To: <1234@mail.gmail.com> -To: Arpit Jalan -X-Mailer: iPhone Mail (12A405) - - ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Type: text/plain; - charset=us-ascii -Content-Transfer-Encoding: 7bit - -This post should not include signature. -----Original Message---- - -Context here. - -> On 23-Oct-2014, at 9:45 am, Arpit Jalan wrote: -> -> Signature in email replies! - ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 diff --git a/spec/fixtures/emails/outlook.eml b/spec/fixtures/emails/outlook.eml deleted file mode 100644 index fb1f590a30e..00000000000 --- a/spec/fixtures/emails/outlook.eml +++ /dev/null @@ -1,188 +0,0 @@ - -MIME-Version: 1.0 -Received: by 10.25.161.144 with HTTP; Tue, 7 Oct 2014 22:17:17 -0700 (PDT) -X-Originating-IP: [117.207.85.84] -In-Reply-To: <5434c8b52bb3a_623ff09fec70f049749@discourse-app.mail> -References: - <5434c8b52bb3a_623ff09fec70f049749@discourse-app.mail> -Date: Wed, 8 Oct 2014 10:47:17 +0530 -Delivered-To: arpit@techapj.com -Message-ID: -Subject: Re: [Discourse] [Meta] Welcome to techAPJ's Discourse! -From: Arpit Jalan -To: Discourse Accept-Language: en-US -Content-Language: en-US -X-MS-Has-Attach: -X-MS-TNEF-Correlator: -x-originating-ip: [134.68.31.227] -Content-Type: multipart/alternative; - boundary="_000_B0DFE1BEB3739743BC9B639D0E6BC8FF217A6341IUMSSGMBX104ads_" -MIME-Version: 1.0 - ---_000_B0DFE1BEB3739743BC9B639D0E6BC8FF217A6341IUMSSGMBX104ads_ -Content-Type: text/plain; charset="utf-8" -Content-Transfer-Encoding: base64 - -TWljcm9zb2Z0IE91dGxvb2sgMjAxMA0KDQpGcm9tOiBtaWNoYWVsIFttYWlsdG86dGFsa0BvcGVu -bXJzLm9yZ10N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Pg0KPC9kaXY+DQo8L2Rpdj4NCjxwIGNsYXNzPSJNc29Ob3JtYWwiPjxpbWcgYm9yZGVy -PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBpZD0iX3gwMDAwX2kxMDI2IiBzcmM9Imh0dHA6Ly9j -bC5vcGVubXJzLm9yZy90cmFjay9vcGVuLnBocD91PTMwMDM5OTA1JmFtcDtpZD1kNWJjMDdjZDQ0 -Y2Q0ODBjOGE4NjM5Y2ViNTc4M2JmNiI+PG86cD48L286cD48L3A+DQo8L2Rpdj4NCjwvYm9keT4N -CjwvaHRtbD4NCg== - ---_000_B0DFE1BEB3739743BC9B639D0E6BC8FF217A6341IUMSSGMBX104ads_-- diff --git a/spec/fixtures/emails/paragraphs.cooked b/spec/fixtures/emails/paragraphs.cooked deleted file mode 100644 index 2d44722107d..00000000000 --- a/spec/fixtures/emails/paragraphs.cooked +++ /dev/null @@ -1,7 +0,0 @@ -

Is there any reason the old candy can't be be kept in silos while the new candy -is imported into new silos?

- -

The thing about candy is it stays delicious for a long time -- we can just keep -it there without worrying about it too much, imo.

- -

Thanks for listening.

diff --git a/spec/fixtures/emails/paragraphs.eml b/spec/fixtures/emails/paragraphs.eml index 2d5b5283f7e..7fb2bd3733e 100644 --- a/spec/fixtures/emails/paragraphs.eml +++ b/spec/fixtures/emails/paragraphs.eml @@ -1,42 +1,12 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+59d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <22@foo.bar.mail> Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 +Content-Type: text/plain; charset=UTF-8 -Is there any reason the *old* candy can't be be kept in silos while the new candy -is imported into *new* silos? +Do you like liquorice? -The thing about candy is it stays delicious for a long time -- we can just keep -it there without worrying about it too much, imo. - -Thanks for listening. - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> +I really like them. One could even say that I am *addicted* to liquorice. Anf if +you can mix it up with some anise, then I'm in heaven ;) diff --git a/spec/fixtures/emails/plus_one.eml b/spec/fixtures/emails/plus_one.eml deleted file mode 100644 index a3255e9699c..00000000000 --- a/spec/fixtures/emails/plus_one.eml +++ /dev/null @@ -1,37 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: FROM -To: TO -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -+1 - - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> diff --git a/spec/fixtures/emails/previous.eml b/spec/fixtures/emails/previous.eml deleted file mode 100644 index 24ac5a63deb..00000000000 --- a/spec/fixtures/emails/previous.eml +++ /dev/null @@ -1,38 +0,0 @@ - -Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org -Received: by 10.194.216.104 with SMTP id op8csp80593wjc; - Wed, 24 Jul 2013 07:59:14 -0700 (PDT) -Return-Path: -References: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -From: Walter White -In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -Mime-Version: 1.0 (1.0) -Date: Wed, 24 Jul 2013 15:59:10 +0100 -Message-ID: <4597127794206131679@unknownmsgid> -Subject: Re: [Discourse] new reply to your post in 'Crystal Blue' -To: walter via Discourse -Content-Type: multipart/alternative; boundary=001a11c20edc15a39304e2432790 - -This will not include the previous discussion that is present in this email. - ------------------------------ -Previous discussion -skylerwhite July 24 - -This is a reply. - fring July 24 - -This is an older reply. - hank_schrader July 24 - -Of course another reply here. - walterwhite July 24 - - ------------------------------ - -To respond, reply to this email or visit -http://discourse.org/t/crystal-blue/5043/10in -your browser. - -To unsubscribe from these emails, visit your user -preferences -. diff --git a/spec/fixtures/emails/previous_replies.eml b/spec/fixtures/emails/previous_replies.eml index 3fd74482c07..8b4cbc7e77e 100644 --- a/spec/fixtures/emails/previous_replies.eml +++ b/spec/fixtures/emails/previous_replies.eml @@ -1,180 +1,23 @@ -Delivered-To: reply@discourse.org -MIME-Version: 1.0 -In-Reply-To: -References: - -Date: Fri, 28 Nov 2014 12:55:32 -0800 -Subject: Re: [Discourse Meta] [Lounge] Testing default email replies -From: Walter White -To: Discourse Meta -Content-Type: multipart/alternative; boundary=001a1137c9285318bb0508f17bc5 - ---001a1137c9285318bb0508f17bc5 +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <21@foo.bar.mail> +Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 -### this is a reply from iOS Gmail app +This will not include the previous discussion that is present in this email. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog. The quick brown fox jumps over the lazy -dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. +--- +*Previous Replies* -This is **bold** text in Markdown. +This is previous reply #1. -This is a link to http://example.com +Posted by foo bar on 01/15/2016 -On Friday, November 28, 2014, Arpit Jalan wrote: +--- +[Visit the Topic](https://bar.com/t/wat/1/1) to respond. -> techAPJ -> November 28 -> -> Test reply. -> -> First paragraph. -> -> Second paragraph. -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> ------------------------------ -> Previous Replies codinghorror -> -> November 28 -> -> We're testing the latest GitHub email processing library which we are -> integrating now. -> -> https://github.com/github/email_reply_parser -> -> Go ahead and reply to this topic and I'll reply from various email clients -> for testing. -> ------------------------------ -> -> To respond, reply to this email or visit -> https://meta.discourse.org/t/testing-default-email-replies/22638/3 in -> your browser. -> -> To unsubscribe from these emails, visit your user preferences -> . -> - ---001a1137c9285318bb0508f17bc5 -Content-Type: text/html; charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -### this is a reply from iOS Gmail app

The quick brown f= -ox jumps over the lazy dog.=C2=A0The quick brown fox jumps over the lazy dog.=C2=A0The quic= -k brown fox jumps over the lazy dog.=C2=A0The quick brown fox jumps over th= -e lazy dog.=C2=A0The quick brown fox jumps over the lazy dog.=C2=A0The quic= -k brown fox jumps over the lazy dog.=C2=A0The quick brown fox jumps over th= -e lazy dog.=C2=A0

This is **bold** text in Markdown.

This is a link to http://example.com

On Friday, November 28, 2014, Arpit Jalan <
info@discourse.org> wrote:
- - - - - - - - - - - -
- - - techAPJ
- November 28 -
-

Test reply.

- -

First paragraph.

- -

Second paragraph.

-
- - -
-

To respond, reply to this email or visit https:/= -/meta.discourse.org/t/testing-default-email-replies/22638/3 in your bro= -wser.

-
-
-

Previous Replies

- - - - - - - - - - - -
- - - codinghorror - November 28 -
-

We're testing the latest GitHub emai= -l processing library which we are integrating now.

- -

https://github.com/github/email_reply_parser

- -

Go ahead and reply to this topic and I&#= -39;ll reply from various email clients for testing.

-
- - -
- -
-

To respond, reply to this email or visit https://met= -a.discourse.org/t/testing-default-email-replies/22638/3 in your browser= -.

-
-
-

To unsubscribe from these emails, visit your user preferences.

-
-
-
- ---001a1137c9285318bb0508f17bc5-- +To stop receiving notifications for this particular topic, [click here](h= +ttps://bar.com/t/wat/1/unsubscribe). To unsubscribe from these emails, ch= +ange your [user preferences](https://bar.com/my/preferences). diff --git a/spec/fixtures/emails/readonly.eml b/spec/fixtures/emails/readonly.eml new file mode 100644 index 00000000000..7572bff6685 --- /dev/null +++ b/spec/fixtures/emails/readonly.eml @@ -0,0 +1,11 @@ +Return-Path: +From: Foo Bar +To: category@bar.com +Subject: This is a topic from a restricted user +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <33@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Hey, this is a topic from a restricted user ;) diff --git a/spec/fixtures/emails/reply_user_matching.eml b/spec/fixtures/emails/reply_user_matching.eml new file mode 100644 index 00000000000..caead84676e --- /dev/null +++ b/spec/fixtures/emails/reply_user_matching.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <11@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/spec/fixtures/emails/reply_user_not_matching.eml b/spec/fixtures/emails/reply_user_not_matching.eml new file mode 100644 index 00000000000..c6523f966e4 --- /dev/null +++ b/spec/fixtures/emails/reply_user_not_matching.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <10@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/spec/fixtures/emails/signature.eml b/spec/fixtures/emails/signature.eml index 01a0dd78748..5352f48a259 100644 --- a/spec/fixtures/emails/signature.eml +++ b/spec/fixtures/emails/signature.eml @@ -1,29 +1,12 @@ -Delivered-To: test@mail.com -Return-Path: -From: Walter White -Content-Type: multipart/alternative; - boundary=Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Transfer-Encoding: 7bit -Mime-Version: 1.0 (1.0) -Subject: Re: Signature in email replies! -Date: Thu, 23 Oct 2014 14:43:49 +0530 -References: <1234@mail.gmail.com> -In-Reply-To: <1234@mail.gmail.com> -To: Arpit Jalan -X-Mailer: iPhone Mail (12A405) +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <26@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +You shall not sign! ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 -Content-Type: text/plain; - charset=us-ascii -Content-Transfer-Encoding: 7bit - -This post should not include signature. - -----Arpit - -> On 23-Oct-2014, at 9:45 am, Arpit Jalan wrote: -> -> Signature in email replies! - ---Apple-Mail-8E182EEF-9DBC-41DE-A593-DF2E5EBD3975 +--- +Foo Bar diff --git a/spec/fixtures/emails/staged_sender.eml b/spec/fixtures/emails/staged_sender.eml new file mode 100644 index 00000000000..6ee856614ec --- /dev/null +++ b/spec/fixtures/emails/staged_sender.eml @@ -0,0 +1,9 @@ +Return-Path: +From: Foo Bar +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <9@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/spec/fixtures/emails/stranger_not_allowed.eml b/spec/fixtures/emails/stranger_not_allowed.eml new file mode 100644 index 00000000000..1464e8ddd84 --- /dev/null +++ b/spec/fixtures/emails/stranger_not_allowed.eml @@ -0,0 +1,11 @@ +Return-Path: +From: Foo Bar +To: category@bar.com +Subject: This is a topic from a complete stranger +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <31@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Hey, this is a topic from a complete stranger ;) diff --git a/spec/fixtures/emails/sufficient_trust_level.eml b/spec/fixtures/emails/sufficient_trust_level.eml new file mode 100644 index 00000000000..cee56f11be4 --- /dev/null +++ b/spec/fixtures/emails/sufficient_trust_level.eml @@ -0,0 +1,11 @@ +Return-Path: +From: Foo Bar +To: category@bar.com +Subject: This is a topic from a know user +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <33@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Hey, this is a topic from a known user ;) diff --git a/spec/fixtures/emails/text_and_html_reply.eml b/spec/fixtures/emails/text_and_html_reply.eml new file mode 100644 index 00000000000..5fb87780abe --- /dev/null +++ b/spec/fixtures/emails/text_and_html_reply.eml @@ -0,0 +1,19 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <19@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: multipart/alternative; boundary=001a11469b1296cf8d052963bde5 + +--001a11469b1296cf8d052963bde5 +Content-Type: text/plain; charset=UTF-8 + +This is the *text* part. + +--001a11469b1296cf8d052963bde5 +Content-Type: text/html; charset=UTF-8 + +
This is the html part.
+ +--001a11469b1296cf8d052963bde5-- diff --git a/spec/fixtures/emails/text_reply.eml b/spec/fixtures/emails/text_reply.eml new file mode 100644 index 00000000000..1d295a3f233 --- /dev/null +++ b/spec/fixtures/emails/text_reply.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <15@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +This is a text reply :) diff --git a/spec/fixtures/emails/too_many_mentions.eml b/spec/fixtures/emails/too_many_mentions.eml index 9cc7b75c94f..6940955f9cf 100644 --- a/spec/fixtures/emails/too_many_mentions.eml +++ b/spec/fixtures/emails/too_many_mentions.eml @@ -1,31 +1,10 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+636ca428858779856c226bb145ef4fad@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <14@foo.bar.mail> Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 +Content-Type: text/plain Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -@user1 -@user2 -@user3 -@user4 -@user5 -@user6 -@user7 -@user8 -@user9 -@user10 -@user11 \ No newline at end of file +@user1 @user2 diff --git a/spec/fixtures/emails/too_short.eml b/spec/fixtures/emails/too_short.eml deleted file mode 100644 index 69f59769787..00000000000 --- a/spec/fixtures/emails/too_short.eml +++ /dev/null @@ -1,21 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: TO -Message-ID: -Subject: SUBJECT -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - - -ok diff --git a/spec/fixtures/emails/too_small.eml b/spec/fixtures/emails/too_small.eml new file mode 100644 index 00000000000..fbc5c8d8853 --- /dev/null +++ b/spec/fixtures/emails/too_small.eml @@ -0,0 +1,10 @@ +Return-Path: +From: Foo Bar +To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com +Date: Fri, 15 Jan 2016 00:12:43 +0100 +Message-ID: <12@foo.bar.mail> +Mime-Version: 1.0 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Ok! diff --git a/spec/fixtures/emails/valid_incoming.cooked b/spec/fixtures/emails/valid_incoming.cooked deleted file mode 100644 index 2bf35825373..00000000000 --- a/spec/fixtures/emails/valid_incoming.cooked +++ /dev/null @@ -1,5 +0,0 @@ -

Hey folks,

- -

I was thinking. Wouldn't it be great if we could post topics via email? Yes it would!

- -

Jakie

diff --git a/spec/fixtures/emails/valid_incoming.eml b/spec/fixtures/emails/valid_incoming.eml deleted file mode 100644 index cad475d662e..00000000000 --- a/spec/fixtures/emails/valid_incoming.eml +++ /dev/null @@ -1,26 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: -Cc: -Message-ID: -Subject: We should have a post-by-email-feature. -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -Hey folks, - -I was thinking. Wouldn't it be great if we could post topics via email? Yes it would! - -Jakie - diff --git a/spec/fixtures/emails/valid_reply.cooked b/spec/fixtures/emails/valid_reply.cooked deleted file mode 100644 index 4bce79ad12a..00000000000 --- a/spec/fixtures/emails/valid_reply.cooked +++ /dev/null @@ -1,4 +0,0 @@ -

I could not disagree more. I am obviously biased but adventure time is the -greatest show ever created. Everyone should watch it.

- -
  • Jake out
diff --git a/spec/fixtures/emails/valid_reply.eml b/spec/fixtures/emails/valid_reply.eml deleted file mode 100644 index 786b1d85169..00000000000 --- a/spec/fixtures/emails/valid_reply.eml +++ /dev/null @@ -1,40 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: FROM -To: TO -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -I could not disagree more. I am obviously biased but adventure time is the -greatest show ever created. Everyone should watch it. - -- Jake out - - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> diff --git a/spec/fixtures/emails/via_line.eml b/spec/fixtures/emails/via_line.eml deleted file mode 100644 index 0b2947ff954..00000000000 --- a/spec/fixtures/emails/via_line.eml +++ /dev/null @@ -1,25 +0,0 @@ - -Delivered-To: discourse-reply+cd480e301683c9902891f15968bf07a5@discourse.org -Received: by 10.194.216.104 with SMTP id op8csp80593wjc; - Wed, 24 Jul 2013 07:59:14 -0700 (PDT) -Return-Path: -References: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -From: Walter White -In-Reply-To: <51efeb9b36c34_66dc2dfce6811866@discourse.mail> -Mime-Version: 1.0 (1.0) -Date: Wed, 24 Jul 2013 15:59:10 +0100 -Message-ID: <4597127794206131679@unknownmsgid> -Subject: Re: [Discourse] new reply to your post in 'Crystal Blue' -To: walter via Discourse -Content-Type: multipart/alternative; boundary=001a11c20edc15a39304e2432790 - -Hello this email has content! - -codinghorror via Discourse wrote: -> [codinghorror] codinghorror -> -> August 7 -> -> It wouldn't be great at the moment for 100% email, since there's no -> way to be notified of new topics via email. (you can get notified of -> new replies to your posts and topics via email, and reply to them.) diff --git a/spec/fixtures/emails/windows_8_metro.eml b/spec/fixtures/emails/windows_8_metro.eml deleted file mode 100644 index 67d204af562..00000000000 --- a/spec/fixtures/emails/windows_8_metro.eml +++ /dev/null @@ -1,173 +0,0 @@ -Delivered-To: reply@discourse.org -Return-Path: -MIME-Version: 1.0 -From: -To: - =?utf-8?Q?Discourse_Meta?= - -Subject: - =?utf-8?Q?Re:_[Discourse_Meta]_[Lounge]_Testing_default_email_replies?= -Importance: Normal -Date: Fri, 28 Nov 2014 21:29:10 +0000 -In-Reply-To: -References: - , -Content-Type: multipart/alternative; - boundary="_866E2678-BB4F-4DD8-BE18-81B04AD8D1BC_" - ---_866E2678-BB4F-4DD8-BE18-81B04AD8D1BC_ -Content-Transfer-Encoding: base64 -Content-Type: text/plain; charset="utf-8" - -IyMjIHJlcGx5IGZyb20gZGVmYXVsdCBtYWlsIGNsaWVudCBpbiBXaW5kb3dzIDguMSBNZXRybw0K -DQoNClRoZSBxdWljayBicm93biBmb3gganVtcHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWlj -ayBicm93biBmb3gganVtcHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWljayBicm93biBmb3gg -anVtcHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWljayBicm93biBmb3gganVtcHMgb3ZlciB0 -aGUgbGF6eSBkb2cuIFRoZSBxdWljayBicm93biBmb3gganVtcHMgb3ZlciB0aGUgbGF6eSBkb2cu -IFRoZSBxdWljayBicm93biBmb3gganVtcHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWljayBi -cm93biBmb3gganVtcHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWljayBicm93biBmb3gganVt -cHMgb3ZlciB0aGUgbGF6eSBkb2cuIFRoZSBxdWljayBicm93biBmb3gganVtcHMgb3ZlciB0aGUg -bGF6eSBkb2cuDQoNCg0KVGhpcyBpcyBhICoqYm9sZCoqIHdvcmQgaW4gTWFya2Rvd24NCg0KDQpU -aGlzIGlzIGEgbGluayBodHRwOi8vZXhhbXBsZS5jb20NCiANCg0KDQoNCg0KDQpGcm9tOiBBcnBp -dCBKYWxhbg0KU2VudDog4oCORnJpZGF54oCOLCDigI5Ob3ZlbWJlcuKAjiDigI4yOOKAjiwg4oCO -MjAxNCDigI4xMuKAjjrigI4zNeKAjiDigI5QTQ0KVG86IGplZmYgYXR3b29kDQoNCg0KDQoNCg0K -DQogdGVjaEFQSg0KTm92ZW1iZXIgMjggDQoNClRlc3QgcmVwbHkuDQoNCkZpcnN0IHBhcmFncmFw -aC4NCg0KU2Vjb25kIHBhcmFncmF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cGxpZXMvMjI2MzgvMyIgdGFyZ2V0PSJf -cGFyZW50Ij5odHRwczovL21ldGEuZGlzY291cnNlLm9yZy90L3Rlc3RpbmctZGVmYXVsdC1lbWFp -bC1yZXBsaWVzLzIyNjM4LzM8L2E+IGluIHlvdXIgYnJvd3Nlci48L3A+CjwvZGl2Pgo8ZGl2IHN0 -eWxlPSJjb2xvcjogcmdiKDEwMiwgMTAyLCAxMDIpOyI+CjxwPlRvIHVuc3Vic2NyaWJlIGZyb20g -dGhlc2UgZW1haWxzLCB2aXNpdCB5b3VyIDxhIHN0eWxlPSJjb2xvcjogcmdiKDEwMiwgMTAyLCAx -MDIpOyBmb250LXdlaWdodDogYm9sZDsgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgaHJlZj0iaHR0 -cHM6Ly9tZXRhLmRpc2NvdXJzZS5vcmcvbXkvcHJlZmVyZW5jZXMiIHRhcmdldD0iX3BhcmVudCI+ -dXNlciBwcmVmZXJlbmNlczwvYT4uPC9wPgo8L2Rpdj4KPC9kaXY+CjwvZGl2PjxkaXYgc3R5bGU9 -ImZvbnQtc2l6ZTogMTRwdDsiPjxicj48L2Rpdj48L2Rpdj4KPC9ib2R5Pgo8L2h0bWw+Cg== - ---_866E2678-BB4F-4DD8-BE18-81B04AD8D1BC_-- diff --git a/spec/fixtures/emails/wrong_reply_key.eml b/spec/fixtures/emails/wrong_reply_key.eml deleted file mode 100644 index 1c30cfc51fc..00000000000 --- a/spec/fixtures/emails/wrong_reply_key.eml +++ /dev/null @@ -1,40 +0,0 @@ -Return-Path: -Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400 -Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 13 Jun 2013 17:03:50 -0400 -Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for ; Thu, 13 Jun 2013 14:03:48 -0700 -Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700 -Date: Thu, 13 Jun 2013 17:03:48 -0400 -From: Jake the Dog -To: reply+03d8df8370b7e95c5a49fbf86aeb2c93@appmail.adventuretime.ooo -Message-ID: -Subject: re: [Discourse Meta] eviltrout posted in 'Adventure Time Sux' -Mime-Version: 1.0 -Content-Type: text/plain; - charset=ISO-8859-1 -Content-Transfer-Encoding: 7bit -X-Sieve: CMU Sieve 2.2 -X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu, - 13 Jun 2013 14:03:48 -0700 (PDT) -X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1 - -I could not disagree more. I am obviously biased but adventure time is the -greatest show ever created. Everyone should watch it. - -- Jake out - - -On Sun, Jun 9, 2013 at 1:39 PM, eviltrout via Discourse Meta - wrote: -> -> -> -> eviltrout posted in 'Adventure Time Sux' on Discourse Meta: -> -> --- -> hey guys everyone knows adventure time sucks! -> -> --- -> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3 -> -> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences). -> diff --git a/spec/jobs/poll_mailbox_spec.rb b/spec/jobs/poll_mailbox_spec.rb index 563bfab82cf..451cf07e355 100644 --- a/spec/jobs/poll_mailbox_spec.rb +++ b/spec/jobs/poll_mailbox_spec.rb @@ -3,25 +3,20 @@ require_dependency 'jobs/regular/process_post' describe Jobs::PollMailbox do - let!(:poller) { Jobs::PollMailbox.new } + let(:poller) { Jobs::PollMailbox.new } describe ".execute" do it "does no polling if pop3_polling_enabled is false" do - SiteSetting.expects(:pop3_polling_enabled?).returns(false) + SiteSetting.expects(:pop3_polling_enabled).returns(false) poller.expects(:poll_pop3).never - poller.execute({}) end - describe "with pop3_polling_enabled" do - - it "calls poll_pop3" do - SiteSetting.expects(:pop3_polling_enabled?).returns(true) - poller.expects(:poll_pop3).once - - poller.execute({}) - end + it "polls when pop3_polling_enabled is true" do + SiteSetting.expects(:pop3_polling_enabled).returns(true) + poller.expects(:poll_pop3).once + poller.execute({}) end end @@ -29,13 +24,8 @@ describe Jobs::PollMailbox do describe ".poll_pop3" do it "logs an error on pop authentication error" do - error = Net::POPAuthenticationError.new - data = { limit_once_per: 1.hour, message_params: { error: error }} - - Net::POP3.any_instance.expects(:start).raises(error) - + Net::POP3.any_instance.expects(:start).raises(Net::POPAuthenticationError.new) Discourse.expects(:handle_job_exception) - poller.poll_pop3 end @@ -43,275 +33,15 @@ describe Jobs::PollMailbox do SiteSetting.pop3_polling_ssl = true Net::POP3.any_instance.stubs(:start) Net::POP3.any_instance.expects(:enable_ssl) - poller.poll_pop3 end - it "does not call enable_ssl when the setting is off" do + it "does not call enable_ssl when the setting is disabled" do SiteSetting.pop3_polling_ssl = false Net::POP3.any_instance.stubs(:start) Net::POP3.any_instance.expects(:enable_ssl).never - poller.poll_pop3 end end - # Testing mock for the email objects that you get - # from Net::POP3.start { |pop| pop.mails } - class MockPop3EmailObject - def initialize(mail_string) - @message = mail_string - @delete_called = 0 - end - - def pop - @message - end - - def delete - @delete_called += 1 - end - - # call 'assert email.deleted?' at the end of the test - def deleted? - @delete_called == 1 - end - end - - def expect_success - poller.expects(:handle_failure).never - end - - def expect_exception(clazz) - poller.expects(:handle_failure).with(anything, instance_of(clazz)) - end - - describe "processing emails" do - let(:category) { Fabricate(:category) } - let(:user) { Fabricate(:user) } - - before do - SiteSetting.email_in = true - SiteSetting.reply_by_email_address = "reply+%{reply_key}@appmail.adventuretime.ooo" - category.email_in = 'incoming+amazing@appmail.adventuretime.ooo' - category.save - user.change_trust_level! 2 - user.username = 'Jake' - user.email = 'jake@adventuretime.ooo' - user.save - end - - describe "a valid incoming email" do - let(:email) { - # this string replacing is kinda dumb - str = fixture_file('emails/valid_incoming.eml') - str = str.gsub("FROM", 'jake@adventuretime.ooo').gsub("TO", 'incoming+amazing@appmail.adventuretime.ooo') - MockPop3EmailObject.new str - } - let(:expected_post) { fixture_file('emails/valid_incoming.cooked') } - - it "posts a new topic with the correct content" do - expect_success - - poller.handle_mail(email) - - topic = Topic.where(category: category).where.not(id: category.topic_id).last - expect(topic).to be_present - expect(topic.title).to eq("We should have a post-by-email-feature") - - post = topic.posts.first - expect(post.cooked.strip).to eq(expected_post.strip) - - expect(email).to be_deleted - end - - describe "with insufficient trust" do - before do - user.change_trust_level! 0 - end - - it "raises a UserNotSufficientTrustLevelError" do - expect_exception Email::Receiver::UserNotSufficientTrustLevelError - - poller.handle_mail(email) - end - - it "posts the topic if allow_strangers is true" do - begin - category.email_in_allow_strangers = true - category.save - - expect_success - poller.handle_mail(email) - topic = Topic.where(category: category).where.not(id: category.topic_id).last - expect(topic).to be_present - expect(topic.title).to eq("We should have a post-by-email-feature") - ensure - category.email_in_allow_strangers = false - category.save - end - end - end - - describe "user in restricted group" do - - it "raises InvalidAccess error" do - restricted_group = Fabricate(:group) - restricted_group.add(user) - restricted_group.save - - category.set_permissions(restricted_group => :readonly) - category.save - - expect_exception Discourse::InvalidAccess - - poller.handle_mail(email) - expect(email).to be_deleted - end - end - end - - describe "a valid reply" do - let(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:raw_email) { fill_email(fixture_file("emails/valid_reply.eml"), user.email, to) } - let(:email) { MockPop3EmailObject.new(raw_email) } - let(:expected_post) { fixture_file('emails/valid_reply.cooked') } - let(:topic) { Fabricate(:topic) } - let(:first_post) { Fabricate(:post, user: user, topic: topic, post_number: 1) } - - before do - first_post.save - EmailLog.create(to_address: user.email, - email_type: 'user_posted', - reply_key: reply_key, - user: user, - post: first_post, - topic: topic) - end - - it "creates a new post" do - expect_success - - poller.handle_mail(email) - - new_post = Post.find_by(topic: topic, post_number: 2) - assert new_post.present? - assert_equal expected_post.strip, new_post.cooked.strip - - expect(email).to be_deleted - end - - it "works with multiple To addresses" do - email = MockPop3EmailObject.new fixture_file('emails/multiple_destinations.eml') - expect_success - - poller.handle_mail(email) - - new_post = Post.find_by(topic: topic, post_number: 2) - assert new_post.present? - assert_equal expected_post.strip, new_post.cooked.strip - - expect(email).to be_deleted - end - - describe "with the wrong reply key" do - let(:email) { MockPop3EmailObject.new fixture_file('emails/wrong_reply_key.eml') } - - it "raises an EmailLogNotFound error" do - expect_exception Email::Receiver::EmailLogNotFound - - poller.handle_mail(email) - expect(email).to be_deleted - end - end - end - - describe "when topic is closed" do - let(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:raw_email) { fill_email(fixture_file("emails/valid_reply.eml"), user.email, to) } - let(:email) { MockPop3EmailObject.new(raw_email) } - let(:topic) { Fabricate(:topic, closed: true) } - let(:first_post) { Fabricate(:post, user: user, topic: topic, post_number: 1) } - - before do - first_post.save - EmailLog.create(to_address: user.email, - email_type: 'user_posted', - reply_key: reply_key, - user: user, - post: first_post, - topic: topic) - end - - describe "should not create post" do - it "raises a TopicClosedError" do - expect_exception Email::Receiver::TopicClosedError - - poller.handle_mail(email) - expect(email).to be_deleted - end - end - end - - describe "when topic is deleted" do - let(:reply_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } - let(:to) { SiteSetting.reply_by_email_address.gsub("%{reply_key}", reply_key) } - let(:raw_email) { fill_email(fixture_file("emails/valid_reply.eml"), user.email, to) } - let(:email) { MockPop3EmailObject.new(raw_email) } - let(:deleted_topic) { Fabricate(:deleted_topic) } - let(:first_post) { Fabricate(:post, user: user, topic: deleted_topic, post_number: 1)} - - before do - first_post.save - EmailLog.create(to_address: user.email, - email_type: 'user_posted', - reply_key: reply_key, - user: user, - post: first_post, - topic: deleted_topic) - end - - describe "should not create post" do - it "raises a TopicNotFoundError" do - expect_exception Email::Receiver::TopicNotFoundError - - poller.handle_mail(email) - expect(email).to be_deleted - end - end - end - - describe "in failure conditions" do - - it "a valid reply without an email log raises an EmailLogNotFound error" do - to = SiteSetting.reply_by_email_address.gsub("%{reply_key}", '59d8df8370b7e95c5a49fbf86aeb2c93') - raw_email = fill_email(fixture_file("emails/valid_reply.eml"), user.email, to) - email = MockPop3EmailObject.new(raw_email) - expect_exception Email::Receiver::EmailLogNotFound - - poller.handle_mail(email) - expect(email).to be_deleted - end - - it "a no content reply raises an EmptyEmailError" do - email = MockPop3EmailObject.new fixture_file('emails/no_content_reply.eml') - expect_exception Email::Receiver::EmptyEmailError - - poller.handle_mail(email) - expect(email).to be_deleted - end - - it "a fully empty email raises an EmptyEmailError" do - email = MockPop3EmailObject.new fixture_file('emails/empty.eml') - expect_exception Email::Receiver::EmptyEmailError - - poller.handle_mail(email) - expect(email).to be_deleted - end - - end - end - end