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
9343dcd5
Commit
9343dcd5
authored
Jul 16, 2020
by
David O'Regan
Committed by
Gabriel Mazetto
Jul 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove alert endpoint dropdown user callout
parent
8224727b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
26 deletions
+59
-26
app/helpers/user_callouts_helper.rb
app/helpers/user_callouts_helper.rb
+0
-5
app/models/user_callout_enums.rb
app/models/user_callout_enums.rb
+0
-1
db/post_migrate/20200710102418_delete_user_callout_alerts_moved.rb
...igrate/20200710102418_delete_user_callout_alerts_moved.rb
+28
-0
db/structure.sql
db/structure.sql
+1
-0
spec/helpers/user_callouts_helper_spec.rb
spec/helpers/user_callouts_helper_spec.rb
+0
-20
spec/migrations/delete_user_callout_alerts_moved_spec.rb
spec/migrations/delete_user_callout_alerts_moved_spec.rb
+30
-0
No files found.
app/helpers/user_callouts_helper.rb
View file @
9343dcd5
...
...
@@ -7,7 +7,6 @@ module UserCalloutsHelper
SUGGEST_POPOVER_DISMISSED
=
'suggest_popover_dismissed'
TABS_POSITION_HIGHLIGHT
=
'tabs_position_highlight'
WEBHOOKS_MOVED
=
'webhooks_moved'
ALERTS_MOVED
=
'alerts_moved'
def
show_admin_integrations_moved?
!
user_dismissed?
(
ADMIN_INTEGRATIONS_MOVED
)
...
...
@@ -44,10 +43,6 @@ module UserCalloutsHelper
!
user_dismissed?
(
WEBHOOKS_MOVED
)
end
def
show_alerts_moved_alert?
!
user_dismissed?
(
ALERTS_MOVED
)
end
private
def
user_dismissed?
(
feature_name
,
ignore_dismissal_earlier_than
=
nil
)
...
...
app/models/user_callout_enums.rb
View file @
9343dcd5
...
...
@@ -18,7 +18,6 @@ module UserCalloutEnums
tabs_position_highlight:
10
,
webhooks_moved:
13
,
admin_integrations_moved:
15
,
alerts_moved:
20
,
personal_access_token_expiry:
21
# EE-only
}
end
...
...
db/post_migrate/20200710102418_delete_user_callout_alerts_moved.rb
0 → 100644
View file @
9343dcd5
# frozen_string_literal: true
class
DeleteUserCalloutAlertsMoved
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
class
UserCallout
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'user_callouts'
end
BATCH_SIZE
=
1_000
# Inlined from UserCalloutEnums.feature_names
FEATURE_NAME_ALERTS_MOVED
=
20
def
up
UserCallout
.
each_batch
(
of:
BATCH_SIZE
,
column: :user_id
)
do
|
callout
|
callout
.
where
(
feature_name:
FEATURE_NAME_ALERTS_MOVED
).
delete_all
end
end
def
down
# no-op
end
end
db/structure.sql
View file @
9343dcd5
...
...
@@ -23851,6 +23851,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200707095849
20200708080631
20200709101408
20200710102418
20200710102846
20200710105332
20200710130234
...
...
spec/helpers/user_callouts_helper_spec.rb
View file @
9343dcd5
...
...
@@ -67,26 +67,6 @@ RSpec.describe UserCalloutsHelper do
end
end
describe
'.show_alerts_moved_alert?'
do
subject
{
helper
.
show_alerts_moved_alert?
}
context
'when user has not dismissed'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
ALERTS_MOVED
)
{
false
}
end
it
{
is_expected
.
to
be
true
}
end
context
'when user dismissed'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
ALERTS_MOVED
)
{
true
}
end
it
{
is_expected
.
to
be
false
}
end
end
describe
'.render_flash_user_callout'
do
it
'renders the flash_user_callout partial'
do
expect
(
helper
).
to
receive
(
:render
)
...
...
spec/migrations/delete_user_callout_alerts_moved_spec.rb
0 → 100644
View file @
9343dcd5
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20200710102418_delete_user_callout_alerts_moved.rb'
)
RSpec
.
describe
DeleteUserCalloutAlertsMoved
do
let
(
:users
)
{
table
(
:users
)
}
let
(
:user_callouts
)
{
table
(
:user_callouts
)
}
let
(
:alerts_moved_feature
)
{
described_class
::
FEATURE_NAME_ALERTS_MOVED
}
let
(
:unrelated_feature
)
{
1
}
let!
(
:user1
)
{
users
.
create!
(
email:
'1'
,
projects_limit:
0
)
}
let!
(
:user2
)
{
users
.
create!
(
email:
'2'
,
projects_limit:
0
)
}
subject
(
:migration
)
{
described_class
.
new
}
before
do
user_callouts
.
create!
(
user_id:
user1
.
id
,
feature_name:
alerts_moved_feature
)
user_callouts
.
create!
(
user_id:
user1
.
id
,
feature_name:
unrelated_feature
)
user_callouts
.
create!
(
user_id:
user2
.
id
,
feature_name:
alerts_moved_feature
)
end
describe
'#up'
do
it
'deletes `alerts_moved` user callouts'
do
migration
.
up
expect
(
user_callouts
.
all
.
map
(
&
:feature_name
)).
to
eq
([
unrelated_feature
])
end
end
end
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