Skip to content

Commit

Permalink
Merge pull request #922 from ONEARMY/fix-pr920
Browse files Browse the repository at this point in the history
Fix pr920 - clear indexDB local cache before automated test
  • Loading branch information
BenGamma authored Mar 28, 2020
2 parents caad9bf + d16cf93 commit 65a0728
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cypress/support/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Firestore } from './db/firebase'
*/

before(() => {
indexedDB.deleteDatabase('OneArmyCache')
cy.clearLocalStorage()
cy.wrap('Initialising Database').then({ timeout: 60000 }, doc => {
// large initial timeout in case server slow to respond
return new Cypress.Promise(async resolve => {
Expand Down
3 changes: 2 additions & 1 deletion functions/src/Integrations/firebase-discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const notifyPinAccepted = functions.firestore
.onWrite(async (change, context) => {
const info = change.after.exists ? change.after.data() : null
const prevInfo = change.before.exists ? change.before.data() : null
const beenAccepted = (prevInfo !== null) ? prevInfo.hasBeenAccepted : null;
const beenAccepted =
prevInfo !== null ? prevInfo.moderation === 'accepted' : null
if (info === null || info.moderation !== 'accepted' || beenAccepted) {
return
}
Expand Down
1 change: 0 additions & 1 deletion src/models/common.models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export type IModerationStatus =

export interface IModerable {
moderation: IModerationStatus
hasBeenAccepted?: boolean
_createdBy?: string
_id?: string
}
Expand Down
3 changes: 0 additions & 3 deletions src/stores/Maps/maps.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ export class MapsStore extends ModuleStore {
if (!hasAdminRights(this.activeUser)) {
return false
}
if (pin.moderation === 'accepted') {
pin.hasBeenAccepted = true
}
this.setPin(pin)
}
public needsModeration(pin: IMapPin) {
Expand Down

0 comments on commit 65a0728

Please sign in to comment.