Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
78ce1e6e
Commit
78ce1e6e
authored
Feb 11, 2022
by
Kerri Miller
Committed by
Mayra Cabrera
Feb 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'prevent_diff_in_email' into 'master'"
This reverts merge request !79229 Changelog: other
parent
42657392
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
7 additions
and
74 deletions
+7
-74
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
...projects/shared/permissions/components/settings_panel.vue
+0
-19
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+0
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+0
-1
app/models/project.rb
app/models/project.rb
+0
-1
app/models/project_setting.rb
app/models/project_setting.rb
+4
-0
app/policies/project_policy.rb
app/policies/project_policy.rb
+0
-1
app/views/notify/_note_email.html.haml
app/views/notify/_note_email.html.haml
+2
-1
app/views/notify/_note_email.text.erb
app/views/notify/_note_email.text.erb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+0
-6
spec/features/projects/settings/project_settings_spec.rb
spec/features/projects/settings/project_settings_spec.rb
+0
-30
spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
...ects/shared/permissions/components/settings_panel_spec.js
+0
-11
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+0
-1
spec/requests/api/project_attributes.yml
spec/requests/api/project_attributes.yml
+0
-1
No files found.
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
View file @
78ce1e6e
...
@@ -199,7 +199,6 @@ export default {
...
@@ -199,7 +199,6 @@ export default {
requestAccessEnabled
:
true
,
requestAccessEnabled
:
true
,
highlightChangesClass
:
false
,
highlightChangesClass
:
false
,
emailsDisabled
:
false
,
emailsDisabled
:
false
,
showDiffPreviewInEmail
:
true
,
cveIdRequestEnabled
:
true
,
cveIdRequestEnabled
:
true
,
featureAccessLevelEveryone
,
featureAccessLevelEveryone
,
featureAccessLevelMembers
,
featureAccessLevelMembers
,
...
@@ -761,24 +760,6 @@ export default {
...
@@ -761,24 +760,6 @@ export default {
s__('ProjectSettings|Override user notification preferences for all project members.')
s__('ProjectSettings|Override user notification preferences for all project members.')
}}
</span>
}}
</span>
</project-setting-row>
</project-setting-row>
<project-setting-row
class=
"mb-3"
>
<input
:value=
"showDiffPreviewInEmail"
type=
"hidden"
name=
"project[project_setting_attributes][show_diff_preview_in_email]"
/>
<gl-form-checkbox
v-model=
"showDiffPreviewInEmail"
name=
"project[project_setting_attributes][show_diff_preview_in_email]"
>
{{ s__('ProjectSettings|Include diff preview in merge request notification emails') }}
<
template
#help
>
{{
s__
(
'
ProjectSettings|Include the code diff preview on comment threads in merge request notification emails.
'
,
)
}}
</
template
>
</gl-form-checkbox>
</project-setting-row>
<project-setting-row
class=
"mb-3"
>
<project-setting-row
class=
"mb-3"
>
<input
<input
:value=
"showDefaultAwardEmojis"
:value=
"showDefaultAwardEmojis"
...
...
app/controllers/projects_controller.rb
View file @
78ce1e6e
...
@@ -427,7 +427,6 @@ class ProjectsController < Projects::ApplicationController
...
@@ -427,7 +427,6 @@ class ProjectsController < Projects::ApplicationController
%i[
%i[
show_default_award_emojis
show_default_award_emojis
squash_option
squash_option
show_diff_preview_in_email
mr_default_target_self
mr_default_target_self
warn_about_potentially_unwanted_characters
warn_about_potentially_unwanted_characters
]
]
...
...
app/helpers/projects_helper.rb
View file @
78ce1e6e
...
@@ -586,7 +586,6 @@ module ProjectsHelper
...
@@ -586,7 +586,6 @@ module ProjectsHelper
metricsDashboardAccessLevel:
feature
.
metrics_dashboard_access_level
,
metricsDashboardAccessLevel:
feature
.
metrics_dashboard_access_level
,
operationsAccessLevel:
feature
.
operations_access_level
,
operationsAccessLevel:
feature
.
operations_access_level
,
showDefaultAwardEmojis:
project
.
show_default_award_emojis?
,
showDefaultAwardEmojis:
project
.
show_default_award_emojis?
,
showDiffPreviewInEmail:
project
.
show_diff_preview_in_email?
,
warnAboutPotentiallyUnwantedCharacters:
project
.
warn_about_potentially_unwanted_characters?
,
warnAboutPotentiallyUnwantedCharacters:
project
.
warn_about_potentially_unwanted_characters?
,
securityAndComplianceAccessLevel:
project
.
security_and_compliance_access_level
,
securityAndComplianceAccessLevel:
project
.
security_and_compliance_access_level
,
containerRegistryAccessLevel:
feature
.
container_registry_access_level
containerRegistryAccessLevel:
feature
.
container_registry_access_level
...
...
app/models/project.rb
View file @
78ce1e6e
...
@@ -433,7 +433,6 @@ class Project < ApplicationRecord
...
@@ -433,7 +433,6 @@ class Project < ApplicationRecord
alias_method
:container_registry_enabled
,
:container_registry_enabled?
alias_method
:container_registry_enabled
,
:container_registry_enabled?
delegate
:show_default_award_emojis
,
:show_default_award_emojis
=
,
:show_default_award_emojis?
,
delegate
:show_default_award_emojis
,
:show_default_award_emojis
=
,
:show_default_award_emojis?
,
:warn_about_potentially_unwanted_characters
,
:warn_about_potentially_unwanted_characters
=
,
:warn_about_potentially_unwanted_characters?
,
:warn_about_potentially_unwanted_characters
,
:warn_about_potentially_unwanted_characters
=
,
:warn_about_potentially_unwanted_characters?
,
:show_diff_preview_in_email
,
:show_diff_preview_in_email
=
,
:show_diff_preview_in_email?
,
to: :project_setting
,
allow_nil:
true
to: :project_setting
,
allow_nil:
true
delegate
:scheduled?
,
:started?
,
:in_progress?
,
:failed?
,
:finished?
,
delegate
:scheduled?
,
:started?
,
:in_progress?
,
:failed?
,
:finished?
,
prefix: :import
,
to: :import_state
,
allow_nil:
true
prefix: :import
,
to: :import_state
,
allow_nil:
true
...
...
app/models/project_setting.rb
View file @
78ce1e6e
# frozen_string_literal: true
# frozen_string_literal: true
class
ProjectSetting
<
ApplicationRecord
class
ProjectSetting
<
ApplicationRecord
include
IgnorableColumns
ignore_column
:show_diff_preview_in_email
,
remove_with:
'14.10'
,
remove_after:
'2022-03-22'
belongs_to
:project
,
inverse_of: :project_setting
belongs_to
:project
,
inverse_of: :project_setting
enum
squash_option:
{
enum
squash_option:
{
...
...
app/policies/project_policy.rb
View file @
78ce1e6e
...
@@ -229,7 +229,6 @@ class ProjectPolicy < BasePolicy
...
@@ -229,7 +229,6 @@ class ProjectPolicy < BasePolicy
enable
:set_note_created_at
enable
:set_note_created_at
enable
:set_emails_disabled
enable
:set_emails_disabled
enable
:set_show_default_award_emojis
enable
:set_show_default_award_emojis
enable
:set_show_diff_preview_in_email
enable
:set_warn_about_potentially_unwanted_characters
enable
:set_warn_about_potentially_unwanted_characters
end
end
...
...
app/views/notify/_note_email.html.haml
View file @
78ce1e6e
...
@@ -20,7 +20,8 @@
...
@@ -20,7 +20,8 @@
discussion on
#{
link_to
(
discussion
.
file_path
,
target_url
)
}
discussion on
#{
link_to
(
discussion
.
file_path
,
target_url
)
}
-
else
-
else
=
link_to
'discussion'
,
target_url
=
link_to
'discussion'
,
target_url
-
if
discussion
&
.
diff_discussion?
&&
discussion
.
on_text?
&&
@project
.
show_diff_preview_in_email?
-
if
discussion
&
.
diff_discussion?
&&
discussion
.
on_text?
=
content_for
:head
do
=
content_for
:head
do
=
stylesheet_link_tag
'mailers/highlighted_diff_email'
=
stylesheet_link_tag
'mailers/highlighted_diff_email'
...
...
app/views/notify/_note_email.text.erb
View file @
78ce1e6e
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<%
end
-%>
<%
end
-%>
<%
if
discussion
&
.
diff_discussion?
&&
discussion
.
on_text?
&&
@project
.
show_diff_preview_in_email?
-%>
<%
if
discussion
&
.
diff_discussion?
&&
discussion
.
on_text?
-%>
<%
discussion
.
truncated_diff_lines
(
highlight:
false
,
diff_limit:
diff_limit
).
each
do
|
line
|
-%>
<%
discussion
.
truncated_diff_lines
(
highlight:
false
,
diff_limit:
diff_limit
).
each
do
|
line
|
-%>
<%=
">
#{
line
.
text
}
\n
"
-%>
<%=
">
#{
line
.
text
}
\n
"
-%>
<%
end
-%>
<%
end
-%>
...
...
locale/gitlab.pot
View file @
78ce1e6e
...
@@ -28407,12 +28407,6 @@ msgstr ""
...
@@ -28407,12 +28407,6 @@ msgstr ""
msgid "ProjectSettings|If merge trains are enabled, merging is only possible if the branch can be rebased without conflicts."
msgid "ProjectSettings|If merge trains are enabled, merging is only possible if the branch can be rebased without conflicts."
msgstr ""
msgstr ""
msgid "ProjectSettings|Include diff preview in merge request notification emails"
msgstr ""
msgid "ProjectSettings|Include the code diff preview on comment threads in merge request notification emails."
msgstr ""
msgid "ProjectSettings|Internal"
msgid "ProjectSettings|Internal"
msgstr ""
msgstr ""
...
...
spec/features/projects/settings/project_settings_spec.rb
View file @
78ce1e6e
...
@@ -85,36 +85,6 @@ RSpec.describe 'Projects settings' do
...
@@ -85,36 +85,6 @@ RSpec.describe 'Projects settings' do
end
end
end
end
context
'show diffs in emails'
,
:js
do
it
'does not hide diffs by default'
do
visit
edit_project_path
(
project
)
show_diff_preview_in_email_input
=
find
(
'input[name="project[project_setting_attributes][show_diff_preview_in_email]"]'
,
visible: :hidden
)
expect
(
show_diff_preview_in_email_input
.
value
).
to
eq
(
'true'
)
end
it
'hides diffs in emails when toggled'
do
visit
edit_project_path
(
project
)
show_diff_preview_in_email_input
=
find
(
'input[name="project[project_setting_attributes][show_diff_preview_in_email]"]'
,
visible: :hidden
)
show_diff_preview_in_email_checkbox
=
find
(
'input[name="project[project_setting_attributes][show_diff_preview_in_email]"][type=checkbox]'
)
expect
(
show_diff_preview_in_email_input
.
value
).
to
eq
(
'true'
)
show_diff_preview_in_email_checkbox
.
click
expect
(
show_diff_preview_in_email_input
.
value
).
to
eq
(
'false'
)
page
.
within
(
'.sharing-permissions'
)
do
find
(
'[data-testid="project-features-save-button"]'
).
click
end
wait_for_requests
expect
(
show_diff_preview_in_email_input
.
value
).
to
eq
(
'false'
)
end
end
def
expect_toggle_state
(
state
)
def
expect_toggle_state
(
state
)
is_collapsed
=
state
==
:collapsed
is_collapsed
=
state
==
:collapsed
...
...
spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
View file @
78ce1e6e
...
@@ -28,7 +28,6 @@ const defaultProps = {
...
@@ -28,7 +28,6 @@ const defaultProps = {
emailsDisabled
:
false
,
emailsDisabled
:
false
,
packagesEnabled
:
true
,
packagesEnabled
:
true
,
showDefaultAwardEmojis
:
true
,
showDefaultAwardEmojis
:
true
,
showDiffPreviewInEmail
:
true
,
warnAboutPotentiallyUnwantedCharacters
:
true
,
warnAboutPotentiallyUnwantedCharacters
:
true
,
},
},
isGitlabCom
:
true
,
isGitlabCom
:
true
,
...
@@ -102,9 +101,6 @@ describe('Settings Panel', () => {
...
@@ -102,9 +101,6 @@ describe('Settings Panel', () => {
const
findEmailSettings
=
()
=>
wrapper
.
find
({
ref
:
'
email-settings
'
});
const
findEmailSettings
=
()
=>
wrapper
.
find
({
ref
:
'
email-settings
'
});
const
findShowDefaultAwardEmojis
=
()
=>
const
findShowDefaultAwardEmojis
=
()
=>
wrapper
.
find
(
'
input[name="project[project_setting_attributes][show_default_award_emojis]"]
'
);
wrapper
.
find
(
'
input[name="project[project_setting_attributes][show_default_award_emojis]"]
'
);
const
findShowDiffPreviewInEmail
=
()
=>
wrapper
.
find
(
'
input[name="project[project_setting_attributes][show_diff_preview_in_email]"]
'
);
const
findWarnAboutPuc
=
()
=>
const
findWarnAboutPuc
=
()
=>
wrapper
.
find
(
wrapper
.
find
(
'
input[name="project[project_setting_attributes][warn_about_potentially_unwanted_characters]"]
'
,
'
input[name="project[project_setting_attributes][warn_about_potentially_unwanted_characters]"]
'
,
...
@@ -589,13 +585,6 @@ describe('Settings Panel', () => {
...
@@ -589,13 +585,6 @@ describe('Settings Panel', () => {
expect
(
findShowDefaultAwardEmojis
().
exists
()).
toBe
(
true
);
expect
(
findShowDefaultAwardEmojis
().
exists
()).
toBe
(
true
);
});
});
});
});
describe
(
'
Hide diffs in email
'
,
()
=>
{
it
(
'
should show the "Hide Diffs in email" input
'
,
()
=>
{
wrapper
=
mountComponent
();
expect
(
findShowDiffPreviewInEmail
().
exists
()).
toBe
(
true
);
});
});
describe
(
'
Warn about potentially unwanted characters
'
,
()
=>
{
describe
(
'
Warn about potentially unwanted characters
'
,
()
=>
{
it
(
'
should have a "Warn about Potentially Unwanted Characters" input
'
,
()
=>
{
it
(
'
should have a "Warn about Potentially Unwanted Characters" input
'
,
()
=>
{
...
...
spec/helpers/projects_helper_spec.rb
View file @
78ce1e6e
...
@@ -964,7 +964,6 @@ RSpec.describe ProjectsHelper do
...
@@ -964,7 +964,6 @@ RSpec.describe ProjectsHelper do
metricsDashboardAccessLevel:
project
.
project_feature
.
metrics_dashboard_access_level
,
metricsDashboardAccessLevel:
project
.
project_feature
.
metrics_dashboard_access_level
,
operationsAccessLevel:
project
.
project_feature
.
operations_access_level
,
operationsAccessLevel:
project
.
project_feature
.
operations_access_level
,
showDefaultAwardEmojis:
project
.
show_default_award_emojis?
,
showDefaultAwardEmojis:
project
.
show_default_award_emojis?
,
showDiffPreviewInEmail:
project
.
show_diff_preview_in_email?
,
securityAndComplianceAccessLevel:
project
.
security_and_compliance_access_level
,
securityAndComplianceAccessLevel:
project
.
security_and_compliance_access_level
,
containerRegistryAccessLevel:
project
.
project_feature
.
container_registry_access_level
containerRegistryAccessLevel:
project
.
project_feature
.
container_registry_access_level
)
)
...
...
spec/requests/api/project_attributes.yml
View file @
78ce1e6e
...
@@ -145,7 +145,6 @@ project_setting:
...
@@ -145,7 +145,6 @@ project_setting:
-
project_id
-
project_id
-
push_rule_id
-
push_rule_id
-
show_default_award_emojis
-
show_default_award_emojis
-
show_diff_preview_in_email
-
updated_at
-
updated_at
-
cve_id_request_enabled
-
cve_id_request_enabled
-
mr_default_target_self
-
mr_default_target_self
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment