Skip to content

Commit

Permalink
Merge pull request #327 from julianpoy/fix-pending-changes-warning
Browse files Browse the repository at this point in the history
Fix pending changes warning & Pepperplate image servers
  • Loading branch information
julianpoy authored Oct 6, 2019
2 parents 5025815 + 404a50a commit 9b0e341
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var cors = require('cors');
var fs = require('fs');
var Raven = require('raven');

var RS_VERSION = JSON.parse(fs.readFileSync('./package.json')).version;

var testMode = process.env.NODE_ENV === 'test';
var verboseMode = process.env.VERBOSE === 'true';

Expand All @@ -22,7 +24,7 @@ var devMode = appConfig.environment === 'dev';

Raven.config(appConfig.sentry.dsn, {
environment: appConfig.environment,
release: '2.0.0'
release: RS_VERSION
}).install();

// Routes
Expand Down
4 changes: 3 additions & 1 deletion Backend/fdxzimport.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var Recipe_Label = require('./models').Recipe_Label;

var UtilService = require('./services/util');

var RS_VERSION = JSON.parse(fs.readFileSync('./package.json')).version;

let runConfig = {
path: process.argv[2],
userId: process.argv[3],
Expand All @@ -34,7 +36,7 @@ var devMode = appConfig.environment === 'dev';

Raven.config(appConfig.sentry.dsn, {
environment: appConfig.environment,
release: '2.0.0'
release: RS_VERSION
}).install();

let logError = async err => {
Expand Down
4 changes: 3 additions & 1 deletion Backend/lcbimport.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var Recipe_Label = require('./models').Recipe_Label;

var UtilService = require('./services/util');

var RS_VERSION = JSON.parse(fs.readFileSync('./package.json')).version;

let runConfig = {
path: process.argv[2],
userId: process.argv[3],
Expand All @@ -38,7 +40,7 @@ var devMode = appConfig.environment === 'dev';

Raven.config(appConfig.sentry.dsn, {
environment: appConfig.environment,
release: '2.0.0'
release: RS_VERSION
}).install();

let logError = async err => {
Expand Down
2 changes: 1 addition & 1 deletion Backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chefbook-backend",
"version": "0.0.0",
"version": "2.0.2",
"private": true,
"scripts": {
"start": "node ./bin/www",
Expand Down
4 changes: 3 additions & 1 deletion Backend/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ function saveRecipes(userId, recipes) {
return Promise.all(recipes.map(function (recipe) {
return new Promise(function (resolve, reject) {
if (recipe.imageURL) {
UtilService.sendURLToS3(recipe.imageURL).then(resolve).catch(reject)
UtilService.sendURLToS3(recipe.imageURL).then(resolve).catch(() => {
resolve(null);
});
} else resolve(null);
}).then(function (image) {
return Recipe.create({
Expand Down
5 changes: 3 additions & 2 deletions Frontend/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ const routes: Routes = [
canDeactivate: [UnsavedChangesGuardService]
},
// Legacy route redirects
{ path: 'about-details', redirectTo: RouteMap.AboutDetailsPage.getPath(), pathMatch: 'full' },
{ path: 'login', redirectTo: RouteMap.AuthPage.getPath(AuthType.Login), pathMatch: 'full' }
{ path: 'about-details', redirectTo: '/about/details', pathMatch: 'full' },
{ path: 'login', redirectTo: '/auth/login', pathMatch: 'full' },
{ path: 'edit-recipe', redirectTo: '/', pathMatch: 'full' }
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@

<br />

<b>v2.0.2</b><br />
- Pepperplate import will now still work even if Pepperplate image servers are down
(they are now almost always down, unfortunately)<br />

<br />

<b>v2.0.1</b><br />
- Fixed several cases where app would crash due to old cached versions<br />
- Added warning when leaving the edit recipe page with unsaved changes<br />
- Added handler for old urls to redirect to new url format<br />
- Fix thumbnail sizing<br />
- Fix push notifications<br />

<br />

<b>v2.0.0</b><br />
- Performance & under-the-hood improvements<br />
- New theme options available in settings (dark & black oled). Defaults to system theme on supported browsers<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export class EditRecipePage {

if (this.recipe.id) {
this.recipeService.update(this.recipe).then(response => {
this.markAsClean();

this.navCtrl.navigateRoot(RouteMap.RecipePage.getPath(this.recipe.id));

loading.dismiss();
Expand Down Expand Up @@ -204,6 +206,8 @@ export class EditRecipePage {
});
} else {
this.recipeService.create(this.recipe).then(response => {
this.markAsClean();

this.navCtrl.navigateRoot(RouteMap.RecipePage.getPath(response.id));

loading.dismiss();
Expand Down Expand Up @@ -256,4 +260,8 @@ export class EditRecipePage {
markAsDirty() {
this.unsavedChangesService.setPendingChanges();
}

markAsClean() {
this.unsavedChangesService.clearPendingChanges();
}
}
6 changes: 5 additions & 1 deletion Frontend/src/app/services/unsaved-changes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class UnsavedChangesService {
// Reset pending changes after every navigation event
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.pendingChanges = false;
this.clearPendingChanges();
}
});

Expand All @@ -39,4 +39,8 @@ export class UnsavedChangesService {
hasPendingChanges() {
return this.pendingChanges;
}

clearPendingChanges() {
this.pendingChanges = false;
}
}
2 changes: 1 addition & 1 deletion Frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</script>

<script>
window.version = '2.0.0';
window.version = '2.0.2';
</script>

<!-- Matomo -->
Expand Down

0 comments on commit 9b0e341

Please sign in to comment.