Commit 78ce1e6e authored by Kerri Miller's avatar Kerri Miller Committed by Mayra Cabrera

Revert "Merge branch 'prevent_diff_in_email' into 'master'"

This reverts merge request !79229
Changelog: other
parent 42657392
...@@ -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"
......
...@@ -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
] ]
......
...@@ -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
......
...@@ -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
......
# 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: {
......
...@@ -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
......
...@@ -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'
......
...@@ -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 -%>
......
...@@ -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 ""
......
...@@ -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
......
...@@ -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', () => {
......
...@@ -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
) )
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment