mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #9922 from rainzm/notify/mobile_lang
fix(notify): remote 'lang' filter when contact type is 'mobile'
This commit is contained in:
@@ -237,7 +237,14 @@ func (tm *STemplateManager) NotifyFilter(contactType, topic, msg, lang string) (
|
||||
return
|
||||
}
|
||||
templates := make([]STemplate, 0, 3)
|
||||
q := tm.Query().Equals("topic", strings.ToUpper(topic)).Equals("lang", lang).In("contact_type", []string{CONTACTTYPE_ALL, contactType})
|
||||
var q *sqlchemy.SQuery
|
||||
if contactType == api.MOBILE {
|
||||
// hack
|
||||
// ingore lang when contactType is mobile
|
||||
q = tm.Query().Equals("topic", strings.ToUpper(topic)).In("contact_type", []string{CONTACTTYPE_ALL, contactType})
|
||||
} else {
|
||||
q = tm.Query().Equals("topic", strings.ToUpper(topic)).Equals("lang", lang).In("contact_type", []string{CONTACTTYPE_ALL, contactType})
|
||||
}
|
||||
err = db.FetchModelObjects(tm, q, &templates)
|
||||
if errors.Cause(err) == sql.ErrNoRows || len(templates) == 0 {
|
||||
// no such template, return as is
|
||||
|
||||
Reference in New Issue
Block a user