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
7190b362
Commit
7190b362
authored
Mar 01, 2021
by
wortschi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused helper methods
parent
19afbc58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
62 deletions
+0
-62
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+0
-46
spec/helpers/notifications_helper_spec.rb
spec/helpers/notifications_helper_spec.rb
+0
-16
No files found.
app/helpers/notifications_helper.rb
View file @
7190b362
...
...
@@ -72,52 +72,6 @@ module NotificationsHelper
end
end
def
notification_list_item
(
level
,
setting
)
title
=
notification_title
(
level
)
data
=
{
notification_level:
level
,
notification_title:
title
}
content_tag
(
:li
,
role:
"menuitem"
)
do
link_to
'#'
,
class:
"update-notification
#{
(
'is-active'
if
setting
.
level
==
level
)
}
"
,
data:
data
do
link_output
=
content_tag
(
:strong
,
title
,
class:
'dropdown-menu-inner-title'
)
link_output
<<
content_tag
(
:span
,
notification_description
(
level
),
class:
'dropdown-menu-inner-content'
)
end
end
end
# Identifier to trigger individually dropdowns and custom settings modals in the same view
def
notifications_menu_identifier
(
type
,
notification_setting
)
"
#{
type
}
-
#{
notification_setting
.
user_id
}
-
#{
notification_setting
.
source_id
}
-
#{
notification_setting
.
source_type
}
"
end
# Create hidden field to send notification setting source to controller
def
hidden_setting_source_input
(
notification_setting
)
return
unless
notification_setting
.
source_type
hidden_field_tag
"
#{
notification_setting
.
source_type
.
downcase
}
_id"
,
notification_setting
.
source_id
end
def
notification_event_name
(
event
)
# All values from NotificationSetting.email_events
case
event
when
:success_pipeline
s_
(
'NotificationEvent|Successful pipeline'
)
else
event_name
=
"NotificationEvent|
#{
event
.
to_s
.
humanize
}
"
s_
(
event_name
)
end
end
def
notification_setting_icon
(
notification_setting
=
nil
)
sprite_icon
(
!
notification_setting
.
present?
||
notification_setting
.
disabled?
?
"notifications-off"
:
"notifications"
,
css_class:
"icon notifications-icon js-notifications-icon"
)
end
def
show_unsubscribe_title?
(
noteable
)
can?
(
current_user
,
"read_
#{
noteable
.
to_ability_name
}
"
.
to_sym
,
noteable
)
end
...
...
spec/helpers/notifications_helper_spec.rb
View file @
7190b362
...
...
@@ -19,22 +19,6 @@ RSpec.describe NotificationsHelper do
it
{
expect
(
notification_title
(
:global
)).
to
match
(
'Global'
)
}
end
describe
'#notification_event_name'
do
context
'for success_pipeline'
do
it
'returns the custom name'
do
expect
(
FastGettext
).
to
receive
(
:cached_find
).
with
(
'NotificationEvent|Successful pipeline'
)
expect
(
notification_event_name
(
:success_pipeline
)).
to
eq
(
'Successful pipeline'
)
end
end
context
'for everything else'
do
it
'returns a humanized name'
do
expect
(
FastGettext
).
to
receive
(
:cached_find
).
with
(
'NotificationEvent|Failed pipeline'
)
expect
(
notification_event_name
(
:failed_pipeline
)).
to
eq
(
'Failed pipeline'
)
end
end
end
describe
'#notification_icon_level'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:global_setting
)
{
user
.
global_notification_setting
}
...
...
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