Lets increment/set badges on all _Installations (#3970)
* Lets increment/set badges on all _Installations * Makes sure PG update where query is properly formed with empty query
This commit is contained in:
@@ -1091,7 +1091,8 @@ export class PostgresStorageAdapter {
|
||||
const where = buildWhereClause({ schema, index, query })
|
||||
values.push(...where.values);
|
||||
|
||||
const qs = `UPDATE $1:name SET ${updatePatterns.join(',')} WHERE ${where.pattern} RETURNING *`;
|
||||
const whereClause = where.pattern.length > 0 ? `WHERE ${where.pattern}` : '';
|
||||
const qs = `UPDATE $1:name SET ${updatePatterns.join(',')} ${whereClause} RETURNING *`;
|
||||
debug('update: ', qs, values);
|
||||
return this._client.any(qs, values);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ export class PushController {
|
||||
const updateWhere = deepcopy(where);
|
||||
|
||||
badgeUpdate = () => {
|
||||
updateWhere.deviceType = 'ios';
|
||||
// Build a real RestQuery so we can use it in RestWrite
|
||||
const restQuery = new RestQuery(config, master(config), '_Installation', updateWhere);
|
||||
return restQuery.buildRestWhere().then(() => {
|
||||
|
||||
@@ -14,10 +14,7 @@ const UNSUPPORTED_BADGE_KEY = "unsupported";
|
||||
|
||||
function groupByBadge(installations) {
|
||||
return installations.reduce((map, installation) => {
|
||||
let badge = installation.badge + '';
|
||||
if (installation.deviceType != "ios") {
|
||||
badge = UNSUPPORTED_BADGE_KEY;
|
||||
}
|
||||
const badge = installation.badge + '';
|
||||
map[badge] = map[badge] || [];
|
||||
map[badge].push(installation);
|
||||
return map;
|
||||
|
||||
Reference in New Issue
Block a user