Commit Graph

206 Commits

Author SHA1 Message Date
Robert Speicher c8b802471b Enable the RSpec/HookArgument cop and auto-correct offenses 2017-08-10 19:29:42 -04:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Alexis Reigel c1281982bd notification email on add new gpg key 2017-07-27 15:40:41 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Robert Speicher a6ec5121f0 Correct RSpec/SingleLineHook cop offenses 2017-06-14 13:18:56 -05:00
Ruben Davila 5c921809cd Bugfix: Always use the default language when generating emails.
There was a race condition issue when the application was generating an
email and was using a language that was previously being used in other
request.
2017-05-25 10:22:45 -05:00
Valery Sizov 387c4b2c21 Backport of multiple_assignees_feature [ci skip] 2017-05-04 17:11:53 +03:00
Robert Speicher d49768296c Auto-correct `RSpec/DescribedClass` violations 2017-05-01 11:13:33 -04:00
Sean McGivern 5069682d8e Enable RSpec/FilePath cop
- Ignore JS fixtures
- Ignore qa directory
- Rewrite concern specs to put concern name first
2017-04-26 12:50:32 +01:00
Luke "Jared" Bennett 9cee280d70
Merge branch 'update-droplab-to-webpack-version' into new-resolvable-discussion 2017-04-06 13:47:52 +01:00
Toon Claes 4bc70127e4 Make it possible to preview pipeline success/failed emails
Visit `/rails/mailers/notify` on your local running GitLab instance to
show a preview pipeline success emails.
2017-04-06 07:07:54 +02:00
Douwe Maan 3ff708f723
Remove unused code 2017-04-05 17:44:14 +01:00
Douwe Maan c319f21141
Address review comments 2017-04-05 17:44:14 +01:00
Douwe Maan afa53810de
Fix specs 2017-04-05 17:44:14 +01:00
Douwe Maan 79889a6aa3
Add specs 2017-04-05 17:44:14 +01:00
Douwe Maan f6f6aaf593
Better notification emails for notes and (diff) discussions 2017-04-05 17:44:14 +01:00
Rémy Coutable 4e3516788f Don't use FFaker in factories, use sequences instead
FFaker can generate data that randomly break our test suite. This
simplifies our factories and use sequences which are more predictive.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-03 18:54:48 +02:00
Robert Speicher 8ec8aa1471 Use `:empty_project` where possible in mailer specs 2017-03-27 18:45:36 -04:00
Robert Speicher a6e43aa2b4 Combine redundant `it` blocks in Notify spec
We perform a bunch of setup for most of these cases, and it didn't make
sense to do an entirely new costly setup just to test a different string
in the same body of the email we just generated in the last test.
2017-03-21 19:21:03 -04:00
Robert Speicher 4abca08f14 Move the `a new user email` shared example to the Emails::Profile spec
This shared example was only used by this spec so having it in a
separate file provided no benefit, at the cost of clarity. This also
reduces the three `it` blocks into a single test with
`aggregate_failures`.
2017-03-21 16:07:52 -04:00
Kamil Trzciński 12dd5ac221 All CI offline migrations 2017-03-17 23:06:11 +00:00
Rémy Coutable 517598ba10 Add a new have_html_escaped_body_text that match an HTML-escaped text
This solves transient failures when a text contains HTML-escapable
characters such as `'`.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-17 12:20:54 +01:00
Nick Thomas 283789c509 Fix intermittent spec failures in notify_spec.rb 2017-03-14 14:49:46 +00:00
Sean McGivern d8eee8ed73 Merge branch '24880-configurable-plaintext-emails' into 'master'
Add setting to enable/disable HTML emails

Closes #24880

See merge request !7749
2016-11-29 12:05:23 +00:00
Ruben Davila b62e2bedbf Add new configuration setting to enable/disable HTML emails.
This new global setting will allow admins to specify if HTML emails should be sent or not,
this is basically useful when system administrators want to save some disk space by avoiding
emails in HTML format and using only the Plain Text version.
2016-11-28 17:00:03 -05:00
Sean McGivern b8917eb75e Fix spec style 2016-11-28 19:40:48 +00:00
Sean McGivern 854fbbfb07 Tidy up text emails 2016-11-28 19:40:48 +00:00
hhoopes c093172250 Clean up rubocop complaint 2016-11-25 15:23:49 +00:00
hhoopes a761c59a6b Add keyword arguments to truncated_diff method
* Added keyword arguments to truncated_diff_lines method to allow for using highlighting or not (html templates vs. text)
* Tweaked templates for consistency and format appropriateness
2016-11-25 15:23:49 +00:00
hhoopes f928dba99b Change diff highlight/truncate for reusability
Previously the `truncated_diff_lines` method for outputting a discussion diff took in already highlighted lines, which meant it wasn't reuseable for truncating ANY lines. In the way it was used, it also meant that for any email truncation, the whole diff was being highlighted before being truncated, meaning wasted time highlighting lines that wouldn't even be used (granted, they were being memoized, so perhaps this wasn't that great of an issue). I refactored truncation away from highlighting, in order to truncate formatted diffs for text templates in email, using `>`s to designate each line, but otherwise retaining the parsing already done to create `diff_lines`.

Additionally, while notes on merge requests or commits had already been tested, there was no existing test for notes on a diff on an MR or commit. Added mailer tests for such, and a unit test for truncating diff lines.
2016-11-25 15:23:49 +00:00
hhoopes 24070bac45 Add new template to handle both commit & mr notes
Currently comments on commits and merge requests do not require merge request- or commit-specific information, but can use the same template. Rather than change the method which calls the template, I opted to keep the templates separate and create a new template to highlight their identicality, while preserving the option to distinguish them from each other in the future.

Also removed some of the inconsistencies between text and html email versions.

Still needed is a text-only version of git diffs and testing.
2016-11-25 15:23:49 +00:00
hhoopes 38ed96e9b1 Add diff hunks to notification emails on MR
Added diff hunks to notification emails of messages on merge requests. This
provides code context to the note. Uses existing template for formatting
a diff for email (from repository push notifications).
2016-11-25 15:23:49 +00:00
Lin Jen-Shin 9c4e0d6445 Use `Gitlab.config.gitlab.host` over `'localhost'`
This would fix long standing failures running tests on
my development machine, which set `Gitlab.config.gitlab.host`
to another host because it's not my local computer. Now I
finally cannot withstand it and decided to fix them once and
for all.
2016-11-18 20:17:10 +08:00
Nick Thomas d211011698 Make access request specs explicitly enable or disable access requests as required 2016-11-11 15:45:47 +00:00
Jared Ready 204da00ea0 Move spec/mailers/shared/notify.rb to spec/support 2016-10-22 17:51:50 -05:00
tiagonbotelho c90483406e refactors tests because of gitlab-test repository changes 2016-10-11 16:33:06 +01:00
Fu Xu 76463c2cb4 override subject method in devise mailer 2016-10-03 18:07:28 +08:00
Fu Xu 064eb2caa6 follow the styleguide: Don't use parentheses around a literal 2016-10-03 18:07:28 +08:00
Fu Xu 048f124a08 move spec back into shared example `an email sent from GitLab` 2016-10-03 18:07:28 +08:00
Fu Xu 2a438f452c stub config settings in spec 2016-10-03 18:07:28 +08:00
Fu Xu 89dc70df46 remove empty line at block body end 2016-10-03 18:07:28 +08:00
Fu Xu 785094e201 create new test in `spec/mailers/notify_spec.rb` 2016-10-03 18:07:28 +08:00
Fu Xu 74c8e091f4 add configurable email subject suffix 2016-10-03 18:07:28 +08:00
Robert Speicher e64594ac44 Merge branch '21983-member-add_user-doesn-t-detect-existing-members-that-have-requested-access' into 'master'
Resolve "`Member.add_user`doesn't detect existing members that have requested access"

## What does this MR do?

This merge request handle the case when an access requester is added to a group or project (via the members page or the API).

In `Member.add_user`, if an access requester already exists, we simply accept their request (and set the `created_by`, `access_level` and `expires_at` attributes if given).

## Are there points in the code the reviewer needs to double check?

I've taken the opportunity to cleanup the whole `{Group,Project}Member.add_user*` methods since it was quite a mess.

## What are the relevant issue numbers?

Closes #21983

See merge request !6393
2016-10-02 11:42:57 +00:00
Robert Speicher 076e040639 Merge branch 'rc-new-members-request-access-service' into 'master'
New `Members::RequestAccessService`

Part of #21979.

See merge request !6265
2016-10-02 11:33:06 +00:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Sean McGivern 20de47235e Wrap List-Unsubscribe link in angle brackets 2016-09-26 16:01:17 +01:00
Rémy Coutable 178e2758f6 Fix specs that requires an access request
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-22 11:12:17 +02:00
Maximiliano Perez Coto b335730817 Fix "Unsubscribe" link in notification emails that is triggered by anti-virus
* Created a force=true param that will continue with the previous
  behaviour of the unsubscribe method
* Created a filter for not-logged users so they see a unsubsribe
  confirmation page
* Added the List-Unsubscribe header on emails so the email client can
  display it on top
2016-09-20 09:52:57 +02:00