@things-factory/announcement 10.1.260 → 10.1.261
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.
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/announcement/announcement-service.js +1 -7
- package/dist-server/service/announcement/announcement-service.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/server/service/announcement/announcement-service.ts +2 -7
- package/test/announcement-persistence.test.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/announcement",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.261",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"@operato/shell": "^10.29.69",
|
|
37
37
|
"@operato/styles": "^10.29.1",
|
|
38
38
|
"@operato/utils": "^10.0.0",
|
|
39
|
-
"@things-factory/ai-assistant": "^10.1.
|
|
40
|
-
"@things-factory/attachment-base": "^10.1.
|
|
41
|
-
"@things-factory/auth-base": "^10.1.
|
|
39
|
+
"@things-factory/ai-assistant": "^10.1.261",
|
|
40
|
+
"@things-factory/attachment-base": "^10.1.261",
|
|
41
|
+
"@things-factory/auth-base": "^10.1.261",
|
|
42
42
|
"@things-factory/env": "^10.1.149",
|
|
43
|
-
"@things-factory/i18n-base": "^10.1.
|
|
44
|
-
"@things-factory/notification": "^10.1.
|
|
45
|
-
"@things-factory/organization": "^10.1.
|
|
46
|
-
"@things-factory/shell": "^10.1.
|
|
43
|
+
"@things-factory/i18n-base": "^10.1.261",
|
|
44
|
+
"@things-factory/notification": "^10.1.261",
|
|
45
|
+
"@things-factory/organization": "^10.1.261",
|
|
46
|
+
"@things-factory/shell": "^10.1.261",
|
|
47
47
|
"graphql-scalars": "^1.22.0",
|
|
48
48
|
"graphql-tag": "^2.12.6",
|
|
49
49
|
"graphql-upload": "^15.0.2",
|
|
50
50
|
"lit": "^3.1.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "06537757f8708e6a511c6232e8792f18fdd6a986"
|
|
53
53
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { EntityManager, In, IsNull, LessThanOrEqual } from 'typeorm'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { requestHolds, User, UserStatus } from '@things-factory/auth-base'
|
|
8
8
|
import { logger } from '@things-factory/env'
|
|
9
9
|
import { translatorFor } from '@things-factory/i18n-base/translator'
|
|
10
10
|
import { keepNoticeDelivery, noticeDeliveryOf, noticeLinkOf, sendNotice, sendNoticeWhenCommitted, type Notice } from '@things-factory/notification'
|
|
@@ -19,12 +19,7 @@ export const ANNOUNCEMENT_REF_TYPE = 'Announcement'
|
|
|
19
19
|
|
|
20
20
|
/** Whether the request writes announcements - the one privilege of the module (`announcement.writing`). */
|
|
21
21
|
export async function isWriter(context: any): Promise<boolean> {
|
|
22
|
-
|
|
23
|
-
const { domain, user, unsafeIP, prohibitedPrivileges } = state
|
|
24
|
-
if (!domain || !user) return false
|
|
25
|
-
/* Asked once per request - a list asks it for each row. */
|
|
26
|
-
state.__announcementWriter ??= checkPermission({ category: 'announcement', privilege: 'mutation', owner: true } as any, user, domain, unsafeIP, prohibitedPrivileges).then(Boolean)
|
|
27
|
-
return await state.__announcementWriter
|
|
22
|
+
return await requestHolds(context, 'announcement', 'mutation')
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
/** The request's person as an audience sees them - asked once per request. */
|
|
@@ -107,7 +107,7 @@ beforeEach(async () => {
|
|
|
107
107
|
})
|
|
108
108
|
|
|
109
109
|
const ids = (...names: string[]) => names.map(name => people[name].id).sort()
|
|
110
|
-
const contextOf = (who: string, writer = false) => ({ state: { domain, user: people[who],
|
|
110
|
+
const contextOf = (who: string, writer = false) => ({ state: { domain, user: people[who], __privilegesHeld: new Map([['announcement:mutation', Promise.resolve(writer)]]) } })
|
|
111
111
|
|
|
112
112
|
async function draft(audiences: { scope: string; targetId: string }[], extra: any = {}) {
|
|
113
113
|
const one = await dataSource.getRepository(Announcement).save({ domain, title: '연말 휴무', body: '**12월 31일** 휴무', status: 'DRAFT', creator: people.writer, ...extra })
|