gitlab-mail-receiver 0.0.4 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1598efc387f3f2baee9a458f08d61a3be4fad7f5
4
- data.tar.gz: 96511d8191638b07aa0bc2b1b1c57056aa69ac19
3
+ metadata.gz: a5feff9f3eb9d17463c81e009831299793eaac57
4
+ data.tar.gz: 67f84701048b70b30a99a03b2fde6947beec0e4e
5
5
  SHA512:
6
- metadata.gz: 9a376a049021dfb61f56bfcc111970efd08452348375e16d56b2833be5bd96f9f6dc510e30e8c40694c0f209aa4f7ea8431dac6a68fa3f4adf2ad5fca39995ea
7
- data.tar.gz: 1f989e4a1cbe8dd1022dae7adb43042382afed1d3f48eeb7f01ad22d75bae831000177c0748b9a03ea86f658130b2b45cca3ee389a60767e154433e5d9f735ab
6
+ metadata.gz: 1598df2b81255591d59a53f45a6ce9e7aed690fb531584db516ae1ff8cbb468e18c002b8073726228816d81cb38b0df13e6b94571c91903075527d775d60a357
7
+ data.tar.gz: 1666262aafe8ffa5afb0a6e753749835d832d419152475cf54c73e2871562d793df701c2056a2fc717fb7700d0fcb4114327c63365e64afe8002ad4f16940a1f
data/README.md CHANGED
@@ -6,6 +6,10 @@ The way of allow your GitLab support Email receive and parse the email content,
6
6
 
7
7
  [中文介绍](https://ruby-china.org/topics/27143)
8
8
 
9
+ ------------
10
+
11
+ > PS: After my created this gem, GitLab have released 8.0, and it included same feature. So you don't need this.
12
+
9
13
  ## Features
10
14
 
11
15
  - Receive Email reply to check Issue/MergeRequest and create comment.
@@ -3,9 +3,11 @@ require_relative './mail-receiver/body_parser'
3
3
  require_relative './mail-receiver/receiver'
4
4
  require_relative './mail-receiver/reply_to'
5
5
 
6
- require "mailman"
6
+ require 'mailman'
7
+ require 'email_reply_parser'
7
8
  require 'active_support/core_ext'
8
9
 
10
+ # Extend Mailman config to add sender attribute
9
11
  module MailmanConfig
10
12
  extend ActiveSupport::Concern
11
13
 
@@ -16,6 +18,7 @@ end
16
18
 
17
19
  Mailman::Configuration.send(:include, MailmanConfig)
18
20
 
21
+ # MailReceiver
19
22
  module MailReceiver
20
23
  def self.config
21
24
  Mailman.config
@@ -1,22 +1,15 @@
1
- # Mail body context parser
2
1
  module MailReceiver
2
+ # Mail body context parser
3
3
  module BodyParser
4
4
  def extract
5
- self.decoded_part.
6
- # Most providers start it off with that "On" date line.
7
- reverse.split(' nO')[-1].reverse.
8
- # Fancy sigs and sigs need to be discarded
9
- chomp.
10
- # Strip leading and trailing whitespace
11
- strip.force_encoding('utf-8')
12
- end
13
-
14
- def decoded_part
15
- self.part.decoded
5
+ EmailReplyParser.read(part.to_s)
6
+ .fragments.map(&:to_s)
7
+ .join("\n").rstrip
8
+ .force_encoding('utf-8')
16
9
  end
17
10
 
18
11
  def part
19
- self.mail.multipart? ? self.mail.parts.first.body : self.mail.body
12
+ mail.multipart? ? mail.parts.first.body : mail.body
20
13
  end
21
14
  end
22
15
  end
@@ -40,6 +40,10 @@ module MailReceiver
40
40
  end
41
41
 
42
42
  def convert_able(model)
43
+ if %W(Issue MergeRequest).index(model.class.name) == -1
44
+ return nil
45
+ end
46
+
43
47
  res = { id: model.iid }
44
48
  if defined?(@note)
45
49
  # gitlab/app/mailers/emails/notes.rb 里面会声明 @note
@@ -1,7 +1,7 @@
1
1
  module MailReceiver
2
2
  class << self
3
3
  def version
4
- '0.0.4'
4
+ '0.1.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-mail-receiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mailman
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.17.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: email_reply_parser
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.5.8
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.5.8
69
83
  description: The way of allow your GitLab support Email receive and parse the email
70
84
  content, and find Issue/MergeRequest to create reply.
71
85
  email:
@@ -106,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
120
  version: 1.3.6
107
121
  requirements: []
108
122
  rubyforge_project:
109
- rubygems_version: 2.4.7
123
+ rubygems_version: 2.4.8
110
124
  signing_key:
111
125
  specification_version: 4
112
126
  summary: Allow your GitLab receive mails to create Issue comment
113
127
  test_files: []
114
- has_rdoc: