@things-factory/announcement 10.1.259 → 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/client/index.ts +1 -0
- package/client/pages/announcement-list.ts +28 -43
- package/client/utils/announcement-list-query.ts +8 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +1 -0
- package/dist-client/index.js.map +1 -1
- package/dist-client/pages/announcement-list.d.ts +0 -4
- package/dist-client/pages/announcement-list.js +28 -48
- package/dist-client/pages/announcement-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/announcement-list-query.d.ts +5 -0
- package/dist-client/utils/announcement-list-query.js +8 -0
- package/dist-client/utils/announcement-list-query.js.map +1 -0
- 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/test/list-query-state.test.ts +25 -0
- package/translations/en.json +3 -3
- package/translations/es.json +3 -3
- package/translations/ja.json +3 -3
- package/translations/ko.json +3 -3
- package/translations/ms.json +3 -3
- package/translations/zh.json +3 -3
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 })
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The announcement list's query is its grid's - the period a filter of the grid, kept in the address with search and
|
|
3
|
+
* page (FOOTER-BUTTON-REVIEW G09), so a shared link, coming back and reloading read the same list.
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync } from 'fs'
|
|
6
|
+
import { join } from 'path'
|
|
7
|
+
|
|
8
|
+
import { announcementPeriodOf } from '../client/utils/announcement-list-query'
|
|
9
|
+
|
|
10
|
+
const page = readFileSync(join(__dirname, '..', 'client', 'pages', 'announcement-list.ts'), 'utf8')
|
|
11
|
+
|
|
12
|
+
test('★ the period is past only when the grid says so - none, or a cleared choice, is the current ones', () => {
|
|
13
|
+
expect(announcementPeriodOf([{ name: 'period', value: 'past' }])).toBe('past')
|
|
14
|
+
expect(announcementPeriodOf([{ name: 'period', value: 'current' }])).toBe('current')
|
|
15
|
+
expect(announcementPeriodOf([{ name: 'period', value: '' }])).toBe('current')
|
|
16
|
+
expect(announcementPeriodOf([{ name: 'category', value: 'past' }])).toBe('current')
|
|
17
|
+
expect(announcementPeriodOf(undefined)).toBe('current')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('★ the list keeps its query in the address and narrows by the grid, never by a page choice that re-reads by hand', () => {
|
|
21
|
+
expect(page).toMatch(/\?url-params-sensitive=\$\{this\.active\}/)
|
|
22
|
+
expect(page).toMatch(/name: 'period',[\s\S]*?hidden: true,[\s\S]*?filter: \{[\s\S]*?value: 'current'/)
|
|
23
|
+
expect(page).not.toMatch(/@state\(\) period|ox-select|this\.grist\.fetch\(\)\s*\n\s*\}\}/)
|
|
24
|
+
expect(page).toMatch(/value: announcementPeriodOf\(filters\)/)
|
|
25
|
+
})
|
package/translations/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "Announcements",
|
|
3
3
|
"announcement.title.manage": "Manage announcements",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "Write announcement",
|
|
5
5
|
"announcement.title.edit": "Edit announcement",
|
|
6
6
|
"announcement.title.view": "Announcement",
|
|
7
7
|
"announcement.title.popup": "Announcements",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "Copy",
|
|
13
13
|
"announcement.button.delete": "Delete",
|
|
14
14
|
"announcement.button.edit": "Edit",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "Write announcement",
|
|
16
16
|
"announcement.button.next": "Next",
|
|
17
17
|
"announcement.button.open": "Open",
|
|
18
18
|
"announcement.button.previous": "Previous",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "Name",
|
|
94
94
|
"announcement.text.link-url": "Address",
|
|
95
95
|
"announcement.text.manage-empty": "No announcements.",
|
|
96
|
-
"announcement.text.manage-empty-description": "Write
|
|
96
|
+
"announcement.text.manage-empty-description": "Press Write announcement to write one.",
|
|
97
97
|
"announcement.text.markdown-hint": "Markdown: **bold**, - list, [link](address)",
|
|
98
98
|
"announcement.text.new-version": "Saving makes version {version}.",
|
|
99
99
|
"announcement.text.no-audience": "No audience yet.",
|
package/translations/es.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "Avisos",
|
|
3
3
|
"announcement.title.manage": "Gestionar avisos",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "Redactar aviso",
|
|
5
5
|
"announcement.title.edit": "Editar aviso",
|
|
6
6
|
"announcement.title.view": "Aviso",
|
|
7
7
|
"announcement.title.popup": "Avisos",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "Copiar",
|
|
13
13
|
"announcement.button.delete": "Eliminar",
|
|
14
14
|
"announcement.button.edit": "Editar",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "Redactar aviso",
|
|
16
16
|
"announcement.button.next": "Siguiente",
|
|
17
17
|
"announcement.button.open": "Abrir",
|
|
18
18
|
"announcement.button.previous": "Anterior",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "Nombre",
|
|
94
94
|
"announcement.text.link-url": "Dirección",
|
|
95
95
|
"announcement.text.manage-empty": "No hay avisos.",
|
|
96
|
-
"announcement.text.manage-empty-description": "
|
|
96
|
+
"announcement.text.manage-empty-description": "Pulse Redactar aviso para redactar uno.",
|
|
97
97
|
"announcement.text.markdown-hint": "Markdown: **negrita**, - lista, [enlace](dirección)",
|
|
98
98
|
"announcement.text.new-version": "Al guardar será la versión {version}.",
|
|
99
99
|
"announcement.text.no-audience": "Aún sin destinatarios.",
|
package/translations/ja.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "お知らせ",
|
|
3
3
|
"announcement.title.manage": "お知らせ管理",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "お知らせを作成",
|
|
5
5
|
"announcement.title.edit": "お知らせ編集",
|
|
6
6
|
"announcement.title.view": "お知らせ",
|
|
7
7
|
"announcement.title.popup": "お知らせ",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "複製",
|
|
13
13
|
"announcement.button.delete": "削除",
|
|
14
14
|
"announcement.button.edit": "編集",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "お知らせを作成",
|
|
16
16
|
"announcement.button.next": "次へ",
|
|
17
17
|
"announcement.button.open": "詳細",
|
|
18
18
|
"announcement.button.previous": "前へ",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "名前",
|
|
94
94
|
"announcement.text.link-url": "アドレス",
|
|
95
95
|
"announcement.text.manage-empty": "お知らせはありません。",
|
|
96
|
-
"announcement.text.manage-empty-description": "
|
|
96
|
+
"announcement.text.manage-empty-description": "「お知らせを作成」を押して作成してください。",
|
|
97
97
|
"announcement.text.markdown-hint": "Markdown: **太字**, - リスト, [リンク](アドレス)",
|
|
98
98
|
"announcement.text.new-version": "保存すると第{version}版になります。",
|
|
99
99
|
"announcement.text.no-audience": "宛先が指定されていません。",
|
package/translations/ko.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "공지사항",
|
|
3
3
|
"announcement.title.manage": "공지 관리",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "공지 작성",
|
|
5
5
|
"announcement.title.edit": "공지 수정",
|
|
6
6
|
"announcement.title.view": "공지사항",
|
|
7
7
|
"announcement.title.popup": "공지사항",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "복제",
|
|
13
13
|
"announcement.button.delete": "삭제",
|
|
14
14
|
"announcement.button.edit": "수정",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "공지 작성",
|
|
16
16
|
"announcement.button.next": "다음",
|
|
17
17
|
"announcement.button.open": "자세히 보기",
|
|
18
18
|
"announcement.button.previous": "이전",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "이름",
|
|
94
94
|
"announcement.text.link-url": "주소",
|
|
95
95
|
"announcement.text.manage-empty": "공지가 없습니다.",
|
|
96
|
-
"announcement.text.manage-empty-description": "
|
|
96
|
+
"announcement.text.manage-empty-description": "「공지 작성」을 눌러 공지를 작성하세요.",
|
|
97
97
|
"announcement.text.markdown-hint": "마크다운: **굵게**, - 목록, [링크](주소)",
|
|
98
98
|
"announcement.text.new-version": "저장하면 {version} 버전이 됩니다.",
|
|
99
99
|
"announcement.text.no-audience": "받는 사람을 지정하지 않았습니다.",
|
package/translations/ms.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "Pengumuman",
|
|
3
3
|
"announcement.title.manage": "Urus pengumuman",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "Tulis pengumuman",
|
|
5
5
|
"announcement.title.edit": "Sunting pengumuman",
|
|
6
6
|
"announcement.title.view": "Pengumuman",
|
|
7
7
|
"announcement.title.popup": "Pengumuman",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "Salin",
|
|
13
13
|
"announcement.button.delete": "Padam",
|
|
14
14
|
"announcement.button.edit": "Sunting",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "Tulis pengumuman",
|
|
16
16
|
"announcement.button.next": "Seterusnya",
|
|
17
17
|
"announcement.button.open": "Buka",
|
|
18
18
|
"announcement.button.previous": "Sebelumnya",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "Nama",
|
|
94
94
|
"announcement.text.link-url": "Alamat",
|
|
95
95
|
"announcement.text.manage-empty": "Tiada pengumuman.",
|
|
96
|
-
"announcement.text.manage-empty-description": "Tulis
|
|
96
|
+
"announcement.text.manage-empty-description": "Tekan Tulis pengumuman untuk menulisnya.",
|
|
97
97
|
"announcement.text.markdown-hint": "Markdown: **tebal**, - senarai, [pautan](alamat)",
|
|
98
98
|
"announcement.text.new-version": "Simpan menjadikannya versi {version}.",
|
|
99
99
|
"announcement.text.no-audience": "Belum ada penerima.",
|
package/translations/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"announcement.title.list": "公告",
|
|
3
3
|
"announcement.title.manage": "公告管理",
|
|
4
|
-
"announcement.title.new": "
|
|
4
|
+
"announcement.title.new": "撰写公告",
|
|
5
5
|
"announcement.title.edit": "编辑公告",
|
|
6
6
|
"announcement.title.view": "公告",
|
|
7
7
|
"announcement.title.popup": "公告",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"announcement.button.copy": "复制",
|
|
13
13
|
"announcement.button.delete": "删除",
|
|
14
14
|
"announcement.button.edit": "编辑",
|
|
15
|
-
"announcement.button.new": "
|
|
15
|
+
"announcement.button.new": "撰写公告",
|
|
16
16
|
"announcement.button.next": "下一条",
|
|
17
17
|
"announcement.button.open": "查看详情",
|
|
18
18
|
"announcement.button.previous": "上一条",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"announcement.text.link-label": "名称",
|
|
94
94
|
"announcement.text.link-url": "地址",
|
|
95
95
|
"announcement.text.manage-empty": "没有公告。",
|
|
96
|
-
"announcement.text.manage-empty-description": "
|
|
96
|
+
"announcement.text.manage-empty-description": "请点击“撰写公告”撰写公告。",
|
|
97
97
|
"announcement.text.markdown-hint": "Markdown:**加粗**、- 列表、[链接](地址)",
|
|
98
98
|
"announcement.text.new-version": "保存后成为第 {version} 版。",
|
|
99
99
|
"announcement.text.no-audience": "尚未指定接收人。",
|