Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/push/api/send/data/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,22 @@ class Message extends Mongoable {

/**
* Filter contents for given lang-platform combination
*
*
* @param {Content[]|object[]} contents array of contents to filter
* @param {string} p platform key
* @param {string} la language key
* @returns {Content[]} array of contents which are applicable for this p/l case
*/
static filterContents(contents, p, la) {
return (contents || []).filter(c => (!p || (!c.p || c.p === p)) && (!la || (!c.la || c.la === la)));
return (contents || []).filter(
c => (!p || (!c.p || c.p === p || (c.p === "a" && p === "h")))
&& (!la || (!c.la || c.la === la))
);
}

/**
* Get Content instance by p & l given. `content()` returns default content.
*
*
* @param {string} p platform key
* @param {string} la language key
* @returns {Content|undefined} Content instance if one with given p & l exists or undefined
Expand Down
Loading