Commit Graph

55 Commits

Author SHA1 Message Date
GitLab Bot a880341a7b Add latest changes from gitlab-org/gitlab@master 2021-05-25 18:10:42 +00:00
GitLab Bot 06d5641a54 Add latest changes from gitlab-org/gitlab@master 2021-05-10 00:10:37 +00:00
GitLab Bot d5098d9fe3 Add latest changes from gitlab-org/gitlab@master 2020-08-21 15:10:03 +00:00
GitLab Bot c6c7437861 Add latest changes from gitlab-org/gitlab@master 2020-03-04 12:07:52 +00:00
GitLab Bot e0fa0638a4 Add latest changes from gitlab-org/gitlab@master 2020-02-27 18:09:21 +00:00
GitLab Bot a5ab3467a7 Add latest changes from gitlab-org/gitlab@master 2020-01-13 15:07:53 +00:00
GitLab Bot 185f428fa5 Add latest changes from gitlab-org/gitlab@master 2019-10-07 12:06:18 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Rémy Coutable 32bf2667d2 Merge branch 'frozen-string-lib-gitlab-more' into 'master'
Enable even more frozen string in lib/gitlab

See merge request gitlab-org/gitlab-ce!22863
2018-11-09 17:26:46 +00:00
Bob Van Landuyt 6fbdc5ed52 Apply patches when creating MR via email
This allows users to add patches as attachments to merge request
created via email.

When an email to create a merge request is sent, all the attachments
ending in `.patch` will be applied to the branch specified in the
subject of the email. If the branch did not exist, it will be created
from the HEAD of the repository.

When the patches could not be applied, the error message will be
replied to the user.

The patches can have a maximum combined size of 2MB for now.
2018-11-07 16:27:55 +01:00
gfyoung 7e6f6e1603 Enable even more frozen string in lib/gitlab
Enables frozens string for the following:

* lib/gitlab/conflict/**/*.rb
* lib/gitlab/cross_project_access/**/*.rb
* lib/gitlab/cycle_analytics/**/*.rb
* lib/gitlab/data_builder/**/*.rb
* lib/gitlab/database/**/*.rb
* lib/gitlab/dependency_linker/**/*.rb
* lib/gitlab/diff/**/*.rb
* lib/gitlab/downtime_check/**/*.rb
* lib/gitlab/email/**/*.rb
* lib/gitlab/etag_caching/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-06 22:47:32 -08:00
Jan Provaznik 8cce70730c Create merge request from email
* new merge request can be created by sending an email to the specific
email address (similar to creating issues by email)
* for the first iteration, source branch must be specified in the mail
subject, other merge request parameters can not be set yet
* user should enable "Receive notifications about your own activity" in
user settings to receive a notification about created merge request

Part of #32878
2017-12-05 08:41:58 +01:00
Lin Jen-Shin 86e1f41b83 Check against "Auto-Submitted: no" instead
This would be much more accurate. We assume this is an
auto-generated email if such header is provided, and
the value is not "no". It could also be: "auto-generated",
"auto-replied", or other values from extension. It seems
that only "no" could mean that this is sent by a human.

See: https://tools.ietf.org/html/rfc3834
2017-08-03 19:29:18 +08:00
Lin Jen-Shin f097e4dbcd Don't send rejection mails for all auto-generated mails
Also make it easier to have mailer helper
2017-08-03 00:40:10 +08:00
Sean McGivern eb490365b5 Handle incoming emails from aliases correctly
These set the 'actual' destination email in one of the Delivered-To lines, so
check those too.
2017-05-03 20:51:10 +01:00
Sean McGivern 08b1380ff7 Don't blow up when email has no References header
If an email doesn't match our incoming email patterns on the To header, we fall
back to the References header. If there was no References header, we'd raise an
exception, when we'd be better off acting as if it was empty.
2017-05-01 14:25:04 +01:00
Sean McGivern 0bb31e54d1 Make handler metric params more explicit 2017-04-21 16:11:21 +01:00
Sean McGivern 57edc23385 Add metrics events for incoming emails
This lets us track how many incoming emails a GitLab instance is processing, by
email type (handler) and by project (where applicable).
2017-04-20 11:32:10 +01:00
Sean McGivern 811e598f60 Enable and autocorrect the CustomErrorClass cop 2017-03-01 15:28:10 +00:00
Lin Jen-Shin 849d09cfd6 Use references variable
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8620#note_22020035
2017-02-03 17:30:54 +08:00
Lin Jen-Shin 7fcbe37df3 Specify that iOS app would also do this 2017-01-20 20:20:40 +08:00
Lin Jen-Shin d15b7db121 Fix References header parser for Microsoft Exchange
Microsoft Exchange would append a comma and another
message id into the References header, therefore we'll
need to fallback and parse the header by ourselves.

Closes #26567
2017-01-20 20:19:22 +08:00
Lin Jen-Shin ec298011f2 Rails prefers require_dependency so that it won't require twice:
Closes #20724
2016-08-09 06:48:23 +00:00
Lin Jen-Shin 5608e1a159 Raise first like an input check 2016-06-15 16:23:41 +08:00
Lin Jen-Shin a01623882e Avoid assignment in if 2016-06-15 16:18:40 +08:00
Lin Jen-Shin 1f5d55907a Merge the places where exceptions could be raised 2016-05-24 01:23:07 +08:00
Lin Jen-Shin 863d8e5ae5 use split and try to unify error raising 2016-05-23 22:16:40 +08:00
Lin Jen-Shin 75415663f8 Rename handlers and introduce Handler.for 2016-05-21 09:40:08 -07:00
Lin Jen-Shin ee548b6ed0 Only set @raw for receiver, and handle the rest in execute 2016-05-20 19:03:39 -05:00
Lin Jen-Shin 32eae15f2f It's for Message-ID so it should be message_id 2016-05-20 18:23:04 -05:00
Lin Jen-Shin c337e748d3 so we use separate classes to handle different tasks 2016-05-18 17:25:45 -05:00
Lin Jen-Shin 3f4a6412dc We should totally cache it 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 8156475ea5 Report better errors. TODO: Enable skipped test 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 30b3443779 Now we would be validating authentication token 2016-05-16 21:27:16 +00:00
Lin Jen-Shin a065c8d5d8 Create a new issue via: incoming+group/project+AUTH_TOKEN@... 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 634c9f403b process_reply -> process_create_note; handle_reply -> process_reply 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 869de96eea bang to indicate that this method could raise an exception 2016-05-16 21:27:16 +00:00
Lin Jen-Shin aac297adba Update style as create_note 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 68b5ded056 No need to check project because:
sent_notification.project would never be nil, and
we also have already checked message_project before
entering process_create_issue.
2016-05-16 21:27:16 +00:00
Lin Jen-Shin 87ff0107c1 Raise one by one instead of if checks 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 347ee6cc91 Alloy empty reply for new issues, but not response 2016-05-16 21:27:16 +00:00
Lin Jen-Shin a61bf17fce Try to give better names 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 0e4c2b6ec4 enable Style/MethodDefParentheses and fix parentheses 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 4f5027042a Add another TODO that we need to verify identity better 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 6cfd028278 Implement #3243 New Issue by email
So we extend Gitlab::Email::Receiver for this new behaviour,
however we might want to split it into another class for better
testing it.

Another issue is that, currently it's using this to parse project
identifier:

    Gitlab::IncomingEmail.key_from_address

Which is using:

    Gitlab.config.incoming_email.address

for the receiver name. This is probably `reply` because it's used
for replying to a specific issue. We might want to introduce another
config for this, or just use `reply` instead of `incoming`.

I'll prefer to introduce a new config for this, or just change
`reply` to `incoming` because it would make sense for replying to
there, too.

The email template used in tests were copied and modified from:
`emails/valid_reply.eml` which I hope is ok.
2016-05-16 21:27:16 +00:00
Rémy Coutable 9f218fc184 Improve and finish the fallback to the In-Reply-To and References header for the reply-by-email feature
A few things to note:
- The IncomingEmail feature is now enabled even without a
  correctly-formatted sub-address
- Message-ID for new thread mail are kept the same so that subsequent
  notifications to this thread are grouped in the thread by the email
  service that receives the notification
  (i.e. In-Reply-To of the answer == Message-ID of the first thread message)
- To maximize our chance to be able to retrieve the reply key, we look
  for it in the In-Reply-To header and the References header
- The pattern for the fallback reply message id is "reply-[key]@[gitlab_host]"
- Improve docs thanks to Axil
2016-03-25 13:05:15 +01:00
David Padilla 31e76baf61 Fix #2364. Fall back to In-Reply-To header when reply key not available 2016-03-25 13:05:15 +01:00
Lin Jen-Shin 9374b7eb0b Avoid using the same name between methods and variables 2016-03-23 20:05:31 +08:00
Douwe Maan 1886d727f7 Add API project upload endpoint 2016-01-07 13:37:14 +01:00
Douwe Maan ee028d9d60 Rename reply_by_email to incoming_email to prepare for the future. 2015-09-21 10:35:37 +02:00