Skip to content

Commit

Permalink
Remove mention/reply event on edit. (#34)
Browse files Browse the repository at this point in the history
* #15 Remove self notifications.

* #19 Fresh by type (not tested).

* #19 History by types.

* #19 Update docs.

* #19 Update core.

* #19 Update main classes to core 2.x.

* #19 Remove unused counter from model.

* #19 Update services to core 2.

* #19 Change event-notification format.

* #19 Change event-notification format #2.

* #19 Update core.

* #19 Fix emitter duplication (mass convert from static).

* #19 Implement freshOnly + summary.

* #19 Docs.

* #23 Fix Cleaner timeout type.

* Change block listener to stable legacy.

* Fix virtual ops for block listener.

* #26, #27, #28 Black list api.

* #26, #27, #28 Black list api 2.

* #28 Black list filtration.

* #28 Black list doc.

* #28 Black list fix.

* #32 Core update.

* #32 Prettier.

* #32 Remove duplicate notify on reply/mention.
  • Loading branch information
Format-X22 authored and NickShtefan committed Dec 20, 2018
1 parent a366085 commit 88e26fd
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 59 deletions.
117 changes: 68 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "notify-service",
"version": "1.2.0",
"version": "1.3.0",
"description": "",
"main": "./scr/index.js",
"scripts": {
Expand All @@ -24,9 +24,9 @@
},
"homepage": "https://github.com/GolosChain/golos-notifications#readme",
"devDependencies": {
"prettier": "^1.14.3"
"prettier": "^1.15.3"
},
"dependencies": {
"gls-core-service": "^2.3.1"
"gls-core-service": "^2.13.4"
}
}
4 changes: 4 additions & 0 deletions src/controllers/registrator/Mention.js
Expand Up @@ -20,6 +20,10 @@ class Mention extends Abstract {
continue;
}

if (await Event.findOne({ eventType: 'mention', permlink, fromUsers: author, user })) {
return;
}

if (await this._isInBlackList(author, user)) {
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/registrator/Reply.js
Expand Up @@ -10,6 +10,10 @@ class Reply extends Abstract {
return;
}

if (await Event.findOne({ eventType: 'reply', permlink, fromUsers: author })) {
return;
}

if (await this._isInBlackList(author, user)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/eventTypes.js
Expand Up @@ -12,4 +12,4 @@ module.exports = [
'message',
'witnessVote',
'witnessCancelVote',
];
];
12 changes: 9 additions & 3 deletions src/models/Event.js
Expand Up @@ -56,12 +56,12 @@ module.exports = MongoDB.makeModel(
},
// curatorReward
curatorReward: {
type: String
type: String,
},
// curatorReward
curatorTargetAuthor: {
type: String
}
type: String,
},
},
{
index: [
Expand Down Expand Up @@ -92,6 +92,12 @@ module.exports = MongoDB.makeModel(
blockNum: -1,
},
},
// Edit comment filtration
{
eventTypes: 1,
permlink: 1,
fromUsers: 1,
},
],
}
);
6 changes: 3 additions & 3 deletions src/models/User.js
Expand Up @@ -9,15 +9,15 @@ module.exports = MongoDB.makeModel(
required: true,
},
blackList: {
type: Array
}
type: Array,
},
},
{
index: [
{
fields: {
user: 1,
}
},
},
],
}
Expand Down

0 comments on commit 88e26fd

Please sign in to comment.