Merge pull request #9771 from hrwX/ep_notification_fix

fix: use db.set_value while resetting _seen value
This commit is contained in:
mergify[bot] 2020-03-24 05:26:21 +00:00 committed by GitHub
commit 60d433d7fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -978,7 +978,7 @@ class Document(BaseDocument):
def reset_seen(self):
"""Clear _seen property and set current user as seen"""
if getattr(self.meta, 'track_seen', False):
self.db_set('_seen', json.dumps([frappe.session.user]), update_modified=False)
frappe.db.set_value(self.doctype, self.name, "_seen", json.dumps([frappe.session.user]), update_modified=False)
def notify_update(self):
"""Publish realtime that the current document is modified"""

View file

@ -10,7 +10,6 @@ from frappe.model.document import Document
from frappe.social.doctype.energy_point_settings.energy_point_settings import is_energy_point_enabled
from frappe.social.doctype.energy_point_log.energy_point_log import \
create_energy_points_log
from frappe.utils import extract_email_id
class EnergyPointRule(Document):
def on_update(self):
@ -48,7 +47,7 @@ class EnergyPointRule(Document):
if not user or user == 'Administrator': continue
create_energy_points_log(reference_doctype, reference_name, {
'points': points,
'user': extract_email_id(user),
'user': user,
'rule': rule
}, self.apply_only_once)
except Exception as e: