sumba 2.33.0 → 2.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@ async function country (opts = {}) {
|
|
|
7
7
|
type: 'string',
|
|
8
8
|
maxLength: 2,
|
|
9
9
|
index: opts.index ?? true,
|
|
10
|
-
required: opts.required,
|
|
10
|
+
required: opts.required ?? true,
|
|
11
11
|
values: 'sumba:getCountriesValues',
|
|
12
12
|
rules: opts.enforceRule ? ['uppercase', { rule: 'length', params: 2 }] : [],
|
|
13
13
|
rulesMsg: opts.enforceRule ? { 'any.only': 'validCountryCodeRequired' } : undefined
|
|
@@ -29,7 +29,7 @@ const id = {
|
|
|
29
29
|
schema.view.format = {
|
|
30
30
|
createdAt: async function (val, rec) {
|
|
31
31
|
const message = this.app.bajoMarkdown ? this.app.bajoMarkdown.parseContent(rec.message) : rec.message
|
|
32
|
-
const isMe = rec.userId === req.user.id
|
|
32
|
+
const isMe = rec.userId === req.user.id + ''
|
|
33
33
|
const sentence = `<c:div margin="bottom-3"><c:badge background="color:${isMe ? 'primary' : 'secondary'}" t:content="${isMe ? 'you' : 'us'}" /> <small>${req.format(val, 'datetime')}</small></c:div>`
|
|
34
34
|
return (await this.component.buildSentence(sentence)) + message
|
|
35
35
|
}
|
package/index.js
CHANGED
|
@@ -745,7 +745,6 @@ async function factory (pkgName) {
|
|
|
745
745
|
const { merge, isEmpty, camelCase, get } = this.app.lib._
|
|
746
746
|
const { routePath } = this.app.waibu
|
|
747
747
|
const userId = get(req, 'session.userId')
|
|
748
|
-
|
|
749
748
|
const setUser = async () => {
|
|
750
749
|
if (!userId) return
|
|
751
750
|
try {
|
|
@@ -806,7 +805,8 @@ async function factory (pkgName) {
|
|
|
806
805
|
checkXSite = async (req, reply) => {
|
|
807
806
|
const { get } = this.app.lib._
|
|
808
807
|
if (!this.config.multiSite.enabled) return
|
|
809
|
-
|
|
808
|
+
const config = get(req, 'routeOptions.config')
|
|
809
|
+
if (!get(config, 'xSite') || ['/dashboard'].includes(config.pathSrc)) return
|
|
810
810
|
if (!get(req, 'user.isXSiteAdmin')) throw this.error('accessDenied', { statusCode: 403 })
|
|
811
811
|
}
|
|
812
812
|
|
package/lib/get-site.js
CHANGED
|
@@ -23,7 +23,7 @@ async function getSite (input, byId = false) {
|
|
|
23
23
|
}
|
|
24
24
|
site.setting = defaultsDeep({}, nsSetting, defSetting)
|
|
25
25
|
// additional fields
|
|
26
|
-
const country = await this.app.dobo.getModel('CdbCountry').getRecord(site.country, {
|
|
26
|
+
const country = await this.app.dobo.getModel('CdbCountry').getRecord(site.country, { noMagic: true })
|
|
27
27
|
site.countryName = (country ?? {}).name ?? site.country
|
|
28
28
|
}
|
|
29
29
|
|
package/lib/get-user.js
CHANGED
|
@@ -2,12 +2,14 @@ export async function mergeTeam (user, req) {
|
|
|
2
2
|
const { map, pick } = this.app.lib._
|
|
3
3
|
const { getModel } = this.app.dobo
|
|
4
4
|
user.teams = []
|
|
5
|
-
const query = { userId: user.id, siteId: user.siteId, status: 'ACTIVE' }
|
|
5
|
+
const query = { userId: user.id + '', siteId: user.siteId, status: 'ACTIVE' }
|
|
6
6
|
let mdl = getModel('SumbaTeamUser')
|
|
7
7
|
const userTeam = await mdl.findAllRecord({ query })
|
|
8
8
|
if (userTeam.length === 0) return
|
|
9
9
|
delete query.userId
|
|
10
|
-
|
|
10
|
+
const idProp = mdl.getProperty('id')
|
|
11
|
+
const $in = userTeam.map(item => ['integer', 'smallint'].includes(idProp.type) ? parseInt(item.teamId) : item.teamId)
|
|
12
|
+
query.id = { $in }
|
|
11
13
|
mdl = getModel('SumbaTeam')
|
|
12
14
|
const teams = await mdl.findAllRecord({ query })
|
|
13
15
|
if (teams.length > 0) {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
- [2.33.0] Add ```Site Setting``` in ```Cross-Site```
|
|
6
6
|
- [2.33.0] Bug fix in ```hook.js```
|
|
7
|
-
- [2.33.0] Bug fix in ```
|
|
7
|
+
- [2.33.0] Bug fix in ```sumba:siteId``` feature
|
|
8
|
+
- [2.33.1] Bug fix in ```checkUser()```, ```checkTeam()``` & ```checkXSite()```
|
|
9
|
+
- [2.33.1] Bug fix in ```sumba:country``` feature
|
|
8
10
|
|
|
9
11
|
## 2026-06-15
|
|
10
12
|
|