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
d399c7f3
Commit
d399c7f3
authored
Mar 22, 2022
by
Brandon Labuschagne
Committed by
Frédéric Caplette
Mar 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve topic avatar copy
Include the name in the copy Changelog: fixed
parent
0ace2cfe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
13 deletions
+25
-13
app/assets/javascripts/admin/topics/components/remove_avatar.vue
...ets/javascripts/admin/topics/components/remove_avatar.vue
+8
-5
app/assets/javascripts/admin/topics/index.js
app/assets/javascripts/admin/topics/index.js
+2
-1
app/views/admin/topics/_form.html.haml
app/views/admin/topics/_form.html.haml
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+6
-3
spec/frontend/admin/topics/components/remove_avatar_spec.js
spec/frontend/admin/topics/components/remove_avatar_spec.js
+8
-3
No files found.
app/assets/javascripts/admin/topics/components/remove_avatar.vue
View file @
d399c7f3
<
script
>
import
{
uniqueId
}
from
'
lodash
'
;
import
{
GlButton
,
GlModal
,
GlModalDirective
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlModal
,
GlModalDirective
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
import
csrf
from
'
~/lib/utils/csrf
'
;
...
...
@@ -8,11 +8,12 @@ export default {
components
:
{
GlButton
,
GlModal
,
GlSprintf
,
},
directives
:
{
GlModal
:
GlModalDirective
,
},
inject
:
[
'
path
'
],
inject
:
[
'
path
'
,
'
name
'
],
data
()
{
return
{
modalId
:
uniqueId
(
'
remove-topic-avatar-
'
),
...
...
@@ -25,8 +26,8 @@ export default {
},
i18n
:
{
remove
:
__
(
'
Remove avatar
'
),
title
:
__
(
'
Confirm remove
avatar
'
),
body
:
__
(
'
Avatar will be removed. Are you sure?
'
),
title
:
__
(
'
Remove topic
avatar
'
),
body
:
__
(
'
Topic avatar for %{name} will be removed. This cannot be undone.
'
),
},
modal
:
{
actionPrimary
:
{
...
...
@@ -57,7 +58,9 @@ export default {
:modal-id=
"modalId"
size=
"sm"
@
primary=
"deleteApplication"
>
{{
$options
.
i18n
.
body
}}
><gl-sprintf
:message=
"$options.i18n.body"
><template
#name
>
{{
name
}}
</
template
></gl-sprintf
>
<form
ref=
"deleteForm"
method=
"post"
:action=
"path"
>
<input
type=
"hidden"
name=
"_method"
value=
"delete"
/>
<input
type=
"hidden"
name=
"authenticity_token"
:value=
"$options.csrf.token"
/>
...
...
app/assets/javascripts/admin/topics/index.js
View file @
d399c7f3
...
...
@@ -8,12 +8,13 @@ export default () => {
return
false
;
}
const
{
path
}
=
el
.
dataset
;
const
{
path
,
name
}
=
el
.
dataset
;
return
new
Vue
({
el
,
provide
:
{
path
,
name
,
},
render
(
h
)
{
return
h
(
RemoveAvatar
);
...
...
app/views/admin/topics/_form.html.haml
View file @
d399c7f3
...
...
@@ -27,7 +27,7 @@
=
topic_icon
(
@topic
,
alt:
_
(
'Topic avatar'
),
class:
'avatar topic-avatar s90'
)
=
render
'shared/choose_avatar_button'
,
f:
f
-
if
@topic
.
avatar?
.js-remove-topic-avatar
{
data:
{
path:
admin_topic_avatar_path
(
@topic
)
}
}
.js-remove-topic-avatar
{
data:
{
path:
admin_topic_avatar_path
(
@topic
)
,
name:
@topic
.
name
}
}
-
if
@topic
.
new_record?
.form-actions
...
...
locale/gitlab.pot
View file @
d399c7f3
...
...
@@ -9424,9 +9424,6 @@ msgstr ""
msgid "Confirm new password"
msgstr ""
msgid "Confirm remove avatar"
msgstr ""
msgid "Confirm user"
msgstr ""
...
...
@@ -30947,6 +30944,9 @@ msgstr ""
msgid "Remove time estimate"
msgstr ""
msgid "Remove topic avatar"
msgstr ""
msgid "Remove user"
msgstr ""
...
...
@@ -39156,6 +39156,9 @@ msgstr ""
msgid "Topic avatar"
msgstr ""
msgid "Topic avatar for %{name} will be removed. This cannot be undone."
msgstr ""
msgid "Topic name"
msgstr ""
...
...
spec/frontend/admin/topics/components/remove_avatar_spec.js
View file @
d399c7f3
import
{
GlButton
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlModal
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
RemoveAvatar
from
'
~/admin/topics/components/remove_avatar.vue
'
;
const
modalID
=
'
fake-id
'
;
const
path
=
'
topic/path/1
'
;
const
name
=
'
Topic 1
'
;
jest
.
mock
(
'
lodash/uniqueId
'
,
()
=>
()
=>
'
fake-id
'
);
jest
.
mock
(
'
~/lib/utils/csrf
'
,
()
=>
({
token
:
'
mock-csrf-token
'
}));
...
...
@@ -16,10 +17,14 @@ describe('RemoveAvatar', () => {
wrapper
=
shallowMount
(
RemoveAvatar
,
{
provide
:
{
path
,
name
,
},
directives
:
{
GlModal
:
createMockDirective
(),
},
stubs
:
{
GlSprintf
,
},
});
};
...
...
@@ -55,8 +60,8 @@ describe('RemoveAvatar', () => {
const
modal
=
findModal
();
expect
(
modal
.
exists
()).
toBe
(
true
);
expect
(
modal
.
props
(
'
title
'
)).
toBe
(
'
Confirm remove
avatar
'
);
expect
(
modal
.
text
()).
toBe
(
'
Avatar will be removed. Are you sure?
'
);
expect
(
modal
.
props
(
'
title
'
)).
toBe
(
'
Remove topic
avatar
'
);
expect
(
modal
.
text
()).
toBe
(
`Topic avatar for
${
name
}
will be removed. This cannot be undone.`
);
});
it
(
'
contains the correct modal ID
'
,
()
=>
{
...
...
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