Skip to content

Commit

Permalink
Merge pull request #4803 from bcgov/dev-RQ-4548
Browse files Browse the repository at this point in the history
bug fix and code cleanup
  • Loading branch information
richard-aot authored Nov 30, 2023
2 parents 96bf970 + 2a367c7 commit aea3ee6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,5 @@ def __mutenotification(self, requesttype, notificationtype, request):
if notificationtype.upper() in (_notificationtype.upper() for _notificationtype in mutenotifications[bcgovcode]["type_exceptions"]):
return False
return True
else:
return False
else:
return False

return False
2 changes: 1 addition & 1 deletion notification-manager/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ NOTIFICATION_REDIS_PORT=
NOTIFICATION_REDIS_PASSWORD=
NOTIFICATION_REDIS_HEALTHCHECK_INT=10
NOTIFICATION_STREAM_KEY=FOINOTIFICATION
MUTE_NOTIFICATION={"MCF": {"request_types": ["Personal"], "state_exceptions": ["Call For Record", "Ministry Signoff"], "type_exceptions":["Reply User Comments", "Tagged User Comments"]}}
MUTE_NOTIFICATION={"MCF": {"request_types": ["Personal"], "state_exceptions": ["Call For Records", "Ministry Sign Off"], "type_exceptions":["Reply User Comments", "Tagged User Comments"]}}
24 changes: 10 additions & 14 deletions request-management-api/request_api/services/notificationservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,17 @@ def __mutenotification(self, requesttype, notificationtype, request):
#get mute conditions from env
mutenotifications = notificationconfig().getmutenotifications()
if "programarea.bcgovcode" in request:
return False
bcgovcode = request["programarea.bcgovcode"].upper()
if requesttype == "ministryrequest"and bcgovcode in mutenotifications:
foirequest = FOIRequest.getrequest(request["foirequest_id"])
if foirequest["requesttype"].upper() in (_requesttype.upper() for _requesttype in mutenotifications[bcgovcode]["request_types"]):
if request["requeststatus.name"].upper() in (_state.upper() for _state in mutenotifications[bcgovcode]["state_exceptions"]):
return False
if notificationtype.upper() in (_notificationtype.upper() for _notificationtype in mutenotifications[bcgovcode]["type_exceptions"]):
return False
return True

bcgovcode = request["programarea.bcgovcode"].upper()
if requesttype == "ministryrequest"and bcgovcode in mutenotifications:
foirequest = FOIRequest.getrequest(request["foirequest_id"])
if foirequest["requesttype"].upper() in (_requesttype.upper() for _requesttype in mutenotifications[bcgovcode]["request_types"]):
if request["requeststatus.name"].upper() in (_state.upper() for _state in mutenotifications[bcgovcode]["state_exceptions"]):
return False
if notificationtype.upper() in (_notificationtype.upper() for _notificationtype in mutenotifications[bcgovcode]["type_exceptions"]):
return False
return True
else:
return False
else:
return False
return False

def getrequest(self, requestid, requesttype):
if requesttype == "ministryrequest":
Expand Down
2 changes: 1 addition & 1 deletion sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ DISABLE_REDACT_WEBLINK=false
DISABLE_GATHERINGRECORDS_TAB=false
KC_SRC_ACC_TOKEN_EXPIRY=60

MUTE_NOTIFICATION={"MCF": {"request_types": ["Personal"], "state_exceptions": ["Call For Record", "Ministry Signoff"], "type_exceptions":["Reply User Comments", "Tagged User Comments"]}}
MUTE_NOTIFICATION={"MCF": {"request_types": ["Personal"], "state_exceptions": ["Call For Records", "Ministry Sign Off"], "type_exceptions":["Reply User Comments", "Tagged User Comments"]}}

0 comments on commit aea3ee6

Please sign in to comment.