Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

Commit

Permalink
fix: do not duplicate action extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Aug 13, 2021
1 parent ae4a205 commit 8697fee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/snjs/lib/models/app/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ConflictStrategy } from './../../protocol/payloads/deltas/strategies';
import { HistoryEntry } from './../../services/history/entries/history_entry';
import { PurePayload } from './../../protocol/payloads/pure_payload';
import { ItemMutator, SNItem } from '@Models/core/item';
import { Action } from './action';
Expand Down Expand Up @@ -34,6 +36,18 @@ export class SNActionsExtension extends SNItem {
return action.context === item.content_type || action.context === 'Item';
});
}

/** Do not duplicate. Always keep original */
strategyWhenConflictingWithItem(
item: SNItem,
previousRevision?: HistoryEntry
): ConflictStrategy {
if (this.errorDecrypting) {
return super.strategyWhenConflictingWithItem(item, previousRevision);
}

return ConflictStrategy.KeepLeft;
}
}

export class ActionsExtensionMutator extends ItemMutator {
Expand Down
2 changes: 1 addition & 1 deletion packages/snjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/snjs",
"version": "2.7.22",
"version": "2.7.23",
"engines": {
"node": ">=14.0.0 <16.0.0"
},
Expand Down

0 comments on commit 8697fee

Please sign in to comment.