Skip to content

Commit

Permalink
Merge pull request #818 from participedia/pan-809
Browse files Browse the repository at this point in the history
  • Loading branch information
paninee committed Jan 6, 2020
2 parents 2e55cf5 + df7694a commit 6aaf769
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions api/controllers/case.js
Expand Up @@ -256,10 +256,10 @@ async function postCaseUpdateHttp(req, res) {

if (!er.hasErrors()) {
if (updatedText) {
await db.tx("update-case", t => {
t.none(INSERT_AUTHOR, author),
t.none(INSERT_LOCALIZED_TEXT, updatedText),
t.none(UPDATE_CASE, updatedCase)
await db.tx("update-case", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(INSERT_LOCALIZED_TEXT, updatedText);
await t.none(UPDATE_CASE, updatedCase);
});
//if this is a new case, set creator id to userid and isAdmin
if (user.isadmin){
Expand All @@ -272,15 +272,15 @@ async function postCaseUpdateHttp(req, res) {
thingid: params.articleid,
updated_date: newCase.updated_date || 'now'
};
await db.tx("update-case", t => {
t.none(UPDATE_AUTHOR_FIRST, creator),
t.none(UPDATE_AUTHOR_LAST, updatedBy)
await db.tx("update-case", async t => {
await t.none(UPDATE_AUTHOR_FIRST, creator);
await t.none(UPDATE_AUTHOR_LAST, updatedBy);
});
}
} else {
await db.tx("update-case", t => {
t.none(INSERT_AUTHOR, author),
t.none(UPDATE_CASE, updatedCase)
await db.tx("update-case", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(UPDATE_CASE, updatedCase);
});
}
// the client expects this request to respond with json
Expand Down
20 changes: 10 additions & 10 deletions api/controllers/method.js
Expand Up @@ -203,10 +203,10 @@ async function postMethodUpdateHttp(req, res) {

if (!er.hasErrors()) {
if (updatedText) {
await db.tx("update-method", t => {
t.none(INSERT_AUTHOR, author),
t.none(INSERT_LOCALIZED_TEXT, updatedText),
t.none(UPDATE_METHOD, updatedMethod)
await db.tx("update-method", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(INSERT_LOCALIZED_TEXT, updatedText);
await t.none(UPDATE_METHOD, updatedMethod);
});
//if this is a new method, set creator id to userid and isAdmin
if (user.isadmin){
Expand All @@ -219,15 +219,15 @@ async function postMethodUpdateHttp(req, res) {
thingid: params.articleid,
updated_date: newMethod.updated_date || 'now'
};
await db.tx("update-method", t => {
t.none(UPDATE_AUTHOR_FIRST, creator),
t.none(UPDATE_AUTHOR_LAST, updatedBy)
await db.tx("update-method", async t => {
await t.none(UPDATE_AUTHOR_FIRST, creator);
await t.none(UPDATE_AUTHOR_LAST, updatedBy);
});
}
} else {
await db.tx("update-method", t => {
t.none(INSERT_AUTHOR, author),
t.none(UPDATE_METHOD, updatedMethod)
await db.tx("update-method", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(UPDATE_METHOD, updatedMethod);
});
}
// the client expects this request to respond with json
Expand Down
20 changes: 10 additions & 10 deletions api/controllers/organization.js
Expand Up @@ -198,10 +198,10 @@ async function postOrganizationUpdateHttp(req, res) {
updatedOrganization.updated_date = !user.isadmin ? 'now' : updatedOrganization.updated_date;
if (!er.hasErrors()) {
if (updatedText) {
await db.tx("update-organization", t => {
t.none(INSERT_AUTHOR, author),
t.none(INSERT_LOCALIZED_TEXT, updatedText),
t.none(UPDATE_ORGANIZATION, updatedOrganization)
await db.tx("update-organization", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(INSERT_LOCALIZED_TEXT, updatedText);
await t.none(UPDATE_ORGANIZATION, updatedOrganization);
});
//if this is a new organization, set creator id to userid and isAdmin
if (user.isadmin){
Expand All @@ -214,15 +214,15 @@ async function postOrganizationUpdateHttp(req, res) {
thingid: params.articleid,
updated_date: newOrganization.updated_date || 'now'
};
await db.tx("update-organization", t => {
t.none(UPDATE_AUTHOR_FIRST, creator),
t.none(UPDATE_AUTHOR_LAST, updatedBy)
await db.tx("update-organization", async t => {
await t.none(UPDATE_AUTHOR_FIRST, creator);
await t.none(UPDATE_AUTHOR_LAST, updatedBy);
});
}
} else {
await db.tx("update-organization", t => {
t.none(INSERT_AUTHOR, author),
t.none(UPDATE_ORGANIZATION, updatedOrganization)
await db.tx("update-organization", async t => {
await t.none(INSERT_AUTHOR, author);
await t.none(UPDATE_ORGANIZATION, updatedOrganization);
});
}
const freshArticle = await getOrganization(params, res);
Expand Down

0 comments on commit 6aaf769

Please sign in to comment.