Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
865
Issues
865
List
Boards
Labels
Service Desk
Milestones
Merge Requests
46
Merge Requests
46
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
4273e29dadb27005e37d1139d8a89acafa9edf0a...146c77a096fd842a0e80e3bddf25b9333e87fa25
Source
146c77a096fd842a0e80e3bddf25b9333e87fa25
Select Git revision
...
Target
4273e29dadb27005e37d1139d8a89acafa9edf0a
Select Git revision
Compare
Commits (2)
(fix): show backend errors when saving a blog
· a7ba96f3
Marcelo Rivera
authored
23 hours ago
a7ba96f3
(fix): e2e test
· 146c77a0
Marcelo Rivera
authored
22 hours ago
146c77a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
blogs.spec.js
cypress/integration/blogs.spec.js
+3
-9
edit.ts
src/app/modules/blogs/edit/edit.ts
+11
-4
No files found.
cypress/integration/blogs.spec.js
View file @
146c77a0
...
...
@@ -6,7 +6,7 @@ context('Blogs', () => {
.
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
})
it
(
'
should not be able to create a new blog if no title or banner are specified
'
,
()
=>
{
it
(
'
should not be able to create a new blog if no title or banner are specified
'
,
()
=>
{
cy
.
visit
(
'
/blog/edit/new
'
);
cy
.
get
(
'
.m-button--submit
'
).
click
();
...
...
@@ -46,17 +46,11 @@ context('Blogs', () => {
cy
.
wait
(
1000
);
cy
.
server
();
cy
.
route
(
"
POST
"
,
"
**/api/v1/blog/new
"
).
as
(
"
newBlog
"
);
cy
.
route
(
"
POST
"
,
"
**
!
/api/v1/blog/new
"
).
as
(
"
newBlog
"
);
cy
.
get
(
'
.m-button--submit
'
).
click
({
force
:
true
});
// TODO: Investigate why disabled flag is being detected
cy
.
wait
(
'
@newBlog
'
,
{
requestTimeout
:
2000
}).
then
((
xhr
)
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
expect
(
xhr
.
response
.
body
).
to
.
deep
.
equal
({
status
:
'
error
'
,
message
:
'
Please ensure your channel has an avatar before creating a blog
'
});
});
cy
.
get
(
'
h1.m-blog--edit--error
'
).
contains
(
'
Error: Please ensure your channel has an avatar before creating a blog
'
);
});
it
(
'
should be able to create a new blog
'
,
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.ts
View file @
146c77a0
...
...
@@ -185,7 +185,7 @@ export class BlogEdit {
this
.
blog
=
response
.
blog
;
this
.
guid
=
response
.
blog
.
guid
;
this
.
title
.
setTitle
(
this
.
blog
.
title
);
if
(
this
.
blog
.
thumbnail_src
)
this
.
existingBanner
=
true
;
//this.hashtagsSelector.setTags(this.blog.tags);
...
...
@@ -235,6 +235,8 @@ export class BlogEdit {
if
(
!
this
.
validate
())
return
;
this
.
error
=
''
;
this
.
inlineEditor
.
prepareForSave
().
then
(()
=>
{
const
blog
=
Object
.
assign
({},
this
.
blog
);
...
...
@@ -248,9 +250,14 @@ export class BlogEdit {
this
.
check_for_banner
().
then
(()
=>
{
this
.
upload
.
post
(
'
api/v1/blog/
'
+
this
.
guid
,
[
this
.
banner
],
blog
)
.
then
((
response
:
any
)
=>
{
this
.
router
.
navigate
(
response
.
route
?
[
'
/
'
+
response
.
route
]:
[
'
/blog/view
'
,
response
.
guid
]);
this
.
canSave
=
true
;
this
.
inProgress
=
false
;
this
.
canSave
=
true
;
if
(
response
.
status
!==
'
success
'
)
{
this
.
error
=
response
.
message
;
return
;
}
this
.
router
.
navigate
(
response
.
route
?
[
'
/
'
+
response
.
route
]:
[
'
/blog/view
'
,
response
.
guid
]);
})
.
catch
((
e
)
=>
{
this
.
canSave
=
true
;
...
...
@@ -275,7 +282,7 @@ export class BlogEdit {
if
(
!
this
.
banner
)
this
.
banner_prompt
=
true
;
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
banner
)
return
resolve
(
true
);
...
...
This diff is collapsed.
Click to expand it.