...
 
Commits (7)
cypress/fixtures/avatar.jpeg

8.1 KB

......@@ -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();
......@@ -24,7 +24,49 @@ context('Blogs', () => {
cy.get('.m-blog--edit--error').contains('Error: You must upload a banner');
})
it("should not be able to create a new blog if the channel doesn't have an avatar", () => {
cy.visit('/blog/edit/new');
cy.uploadFile('minds-banner #file', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
cy.get('minds-textarea .m-editor').type('Title');
cy.get('m-inline-editor .medium-editor-element').type('Content\n');
// click on plus button
cy.get('.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show').click();
// click on camera
cy.get('ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child').contains('photo_camera').click();
// upload the image
cy.uploadFile('.medium-media-file-input', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
// open license dropdown & select first license
cy.get('.m-license-info select').select('All rights reserved');
cy.wait(1000);
cy.server();
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.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', () => {
// upload avatar first
cy.visit(`/${Cypress.env().username}`);
cy.get('.m-channel--name .minds-button-edit button:first-child').click();
cy.wait(100);
cy.uploadFile('.minds-avatar input[type=file]', '../fixtures/avatar.jpeg', 'image/jpg');
cy.get('.m-channel--name .minds-button-edit button:last-child').click();
// create blog
cy.visit('/blog/edit/new');
cy.uploadFile('minds-banner #file', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
......@@ -75,9 +117,7 @@ context('Blogs', () => {
cy.get('.m-button--submit').click({ force: true }); // TODO: Investigate why disabled flag is being detected
// Blogs will not save, nor return error, if a user doesn't have an avatar
cy.location('pathname', { timeout: 30000})
cy.location('pathname', { timeout: 30000 })
.should('contains', `/${Cypress.env().username}/blog`);
cy.get('.m-blog--title').contains('Title');
......
......@@ -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);
......
......@@ -468,9 +468,9 @@ export class BoostCreatorComponent implements AfterViewInit {
if (this.boost.currency === 'onchain'
&& (this.boost.amount < this.rates.min
|| this.boost.amount > (this.rates.cap * 2)
|| this.boost.amount > (this.rates.cap)
)) {
throw new VisibleBoostError(`You must boost between ${this.rates.min} and ${this.rates.cap * 2} views.`);
throw new VisibleBoostError(`You must boost between ${this.rates.min} and ${this.rates.cap} views.`);
}
......
......@@ -37,7 +37,7 @@
</span>
<ul class="m-boostCreatorSelector__bullets">
<li>Max 10k per boost</li>
<!-- <li>Max 10k per boost</li> -->
<li>Stored on the blockchain</li>
<li>Stand out in the feeds</li>
<li>Gain "OnChain" badge</li>
......@@ -78,7 +78,7 @@
</span>
<ul class="m-boostCreatorSelector__bullets">
<li>Max 5k per boost</li>
<!-- <li>Max 5k per boost</li> -->
<li>Stored on Minds servers</li>
<li>No transaction fee</li>
<li style="list-style:none">&nbsp;</li>
......
......@@ -106,6 +106,12 @@ export class GroupProfileFeedSortedComponent {
}
loadMore() {
if (this.feedsService.canFetchMore
&& !this.feedsService.inProgress.getValue()
&& this.feedsService.offset.getValue()
) {
this.feedsService.fetch(); // load the next 150 in the background
}
this.feedsService.loadMore();
}
......