Skip to content

Commit 76eba71

Browse files
authored
Release v2.2.2 (#1613)
* fix: set content to reference doctype when text not available * chore(deps): bump packages * feat: allow notifications without document previews (#1612) * feat: allow notifications without document previews * chore: bump version to 2.2.2
2 parents fba191f + ac88b20 commit 76eba71

12 files changed

Lines changed: 965 additions & 1023 deletions

File tree

frontend/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "raven-web",
33
"private": true,
44
"license": "AGPL-3.0-only",
5-
"version": "2.2.1",
5+
"version": "2.2.2",
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
@@ -64,7 +64,7 @@
6464
"turndown": "^7.2.0",
6565
"use-double-tap": "^1.3.7",
6666
"vaul": "^1.1.1",
67-
"vite": "^6.2.4",
67+
"vite": "^6.2.6",
6868
"vite-plugin-pwa": "^1.0.0",
6969
"vite-plugin-svgr": "^4.2.0"
7070
},
@@ -74,8 +74,5 @@
7474
"@types/react-dom": "^18.2.19",
7575
"@types/turndown": "^5.0.4",
7676
"typescript": "^5.3.3"
77-
},
78-
"resolutions": {
79-
"@radix-ui/react-dialog": "1.1.5"
8077
}
8178
}

frontend/src/components/feature/chat/ChatInput/DocumentLinkButton.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Box, Button, Dialog, Flex, IconButton, Tooltip } from '@radix-ui/themes'
1+
import { Box, Button, Dialog, Flex, IconButton, Text, TextArea, Tooltip } from '@radix-ui/themes'
22
import { DEFAULT_BUTTON_STYLE, ICON_PROPS } from './ToolPanel'
33
import { LuFileBox } from 'react-icons/lu'
44
import { FormProvider, useForm } from 'react-hook-form'
55
import LinkFormField from '@/components/common/LinkField/LinkFormField'
6-
import { ErrorText } from '@/components/common/Form'
6+
import { ErrorText, Label } from '@/components/common/Form'
77
import { useBoolean } from '@/hooks/useBoolean'
88
import clsx from 'clsx'
99
import { useFrappeCreateDoc } from 'frappe-react-sdk'
@@ -43,7 +43,8 @@ const DocumentLinkButton = ({ channelID }: { channelID: string }) => {
4343

4444
interface DocumentLinkFormData {
4545
doctype: string
46-
docname: string
46+
docname: string,
47+
message: string
4748
}
4849

4950
const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose: () => void }) => {
@@ -71,6 +72,7 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
7172
createDoc('Raven Message', {
7273
message_type: 'Text',
7374
channel_id: channelID,
75+
text: data.message,
7476
link_doctype: data.doctype,
7577
link_document: data.docname
7678
} as RavenMessage)
@@ -88,6 +90,7 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
8890
<FormProvider {...methods}>
8991
<Stack gap='2'>
9092
{error && <ErrorBanner error={error} />}
93+
9194
<Box width='100%'>
9295
<Flex direction='column' gap='2'>
9396
<LinkFormField
@@ -127,6 +130,13 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
127130
{doctype && docname && <DoctypeLinkRenderer doctype={doctype} docname={docname} />}
128131
</div>
129132

133+
<Box width='100%'>
134+
<Flex direction='column' gap='0'>
135+
<Label>Message <Text as='span' size='1' color='gray'>(Optional)</Text></Label>
136+
<TextArea {...methods.register('message')} placeholder='Enter a message to send with the document' />
137+
</Flex>
138+
</Box>
139+
130140
<Flex gap="3" mt="6" justify="end" align='center'>
131141
<Dialog.Close disabled={loading}>
132142
<Button variant="soft" color="gray">Cancel</Button>

frontend/src/components/feature/document-notifications/DocumentNotificationForm.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const GeneralTab = ({ isEdit }: { isEdit: boolean }) => {
137137
</Stack>
138138

139139
</Grid>
140-
<Stack>
140+
<Stack width={'fit-content'} gap='4'>
141141
<Text as="label" size="2">
142142
<HStack>
143143
<Controller
@@ -153,6 +153,29 @@ const GeneralTab = ({ isEdit }: { isEdit: boolean }) => {
153153
Enabled
154154
</HStack>
155155
</Text>
156+
157+
<Text as="label" size="2">
158+
<HStack>
159+
<Controller
160+
control={control}
161+
name='do_not_attach_doc'
162+
render={({ field }) => (
163+
<Checkbox
164+
checked={field.value ? true : false}
165+
onCheckedChange={(v) => field.onChange(v ? 1 : 0)}
166+
/>
167+
)} />
168+
169+
<Stack gap='1'>
170+
Hide document preview in the notification message
171+
<HelperText>
172+
If checked, the document preview will not be attached to the notification message.
173+
</HelperText>
174+
</Stack>
175+
176+
</HStack>
177+
178+
</Text>
156179
</Stack>
157180

158181
<Separator size='4' />

frontend/src/components/feature/threads/ThreadDrawer/ThreadFirstMessage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MdOutlineBarChart } from 'react-icons/md'
1111
import { getFileExtension, getFileName } from '@/utils/operations'
1212
import { FileExtensionIcon } from '@/utils/layout/FileExtIcon'
1313
import { DateTooltip } from '../../chat/ChatMessage/Renderers/DateTooltip'
14+
import { DoctypeLinkRenderer } from '../../chat/ChatMessage/Renderers/DoctypeLinkRenderer'
1415

1516
type MessageContentProps = BoxProps & {
1617
user?: UserFields
@@ -68,6 +69,11 @@ export const ThreadFirstMessage = ({ message, user, ...props }: MessageContentPr
6869
: null
6970
}
7071

72+
{message.link_doctype && message.link_document && <DoctypeLinkRenderer
73+
doctype={message.link_doctype}
74+
docname={message.link_document}
75+
/>}
76+
7177
</Box>
7278
{showButton &&
7379
<Button size='1'

frontend/src/types/RavenIntegrations/RavenDocumentNotification.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export interface RavenDocumentNotification{
2121
send_alert_on: "New Document" | "Update" | "Submit" | "Cancel" | "Delete"
2222
/** Document Type : Link - DocType */
2323
document_type: string
24+
/** Do not attach document with message : Check - If enabled, the message won't have a document preview */
25+
do_not_attach_doc?: 0 | 1
2426
/** Condition : Code - Optional: The alert will be sent if this expression is true */
2527
condition?: string
2628
/** Recipients : Table - Raven Document Notification Recipients */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "raven",
4-
"version": "2.2.1",
4+
"version": "2.2.2",
55
"description": "Messaging Application",
66
"workspaces": [
77
"frontend",

raven/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.2.1"
1+
__version__ = "2.2.2"

raven/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven-app",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

raven/raven_integrations/doctype/raven_document_notification/raven_document_notification.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"send_alert_on",
1515
"column_break_rxyz",
1616
"document_type",
17+
"do_not_attach_doc",
1718
"conditions_tab",
1819
"condition",
1920
"recipients_tab",
@@ -106,11 +107,19 @@
106107
"label": "Sender",
107108
"options": "Raven Bot",
108109
"reqd": 1
110+
},
111+
{
112+
"default": "0",
113+
"description": "If enabled, the message won't have a document preview",
114+
"fieldname": "do_not_attach_doc",
115+
"fieldtype": "Check",
116+
"label": "Do not attach document with message"
109117
}
110118
],
119+
"grid_page_length": 50,
111120
"index_web_pages_for_search": 1,
112121
"links": [],
113-
"modified": "2024-12-15 19:21:43.452516",
122+
"modified": "2025-04-13 16:44:11.691220",
114123
"modified_by": "Administrator",
115124
"module": "Raven Integrations",
116125
"name": "Raven Document Notification",
@@ -142,7 +151,8 @@
142151
"write": 1
143152
}
144153
],
154+
"row_format": "Dynamic",
145155
"sort_field": "creation",
146156
"sort_order": "DESC",
147157
"states": []
148-
}
158+
}

raven/raven_integrations/doctype/raven_document_notification/raven_document_notification.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
class RavenDocumentNotification(Document):
1616
# begin: auto-generated types
17+
# ruff: noqa
18+
1719
# This code is auto-generated. Do not modify anything in this block.
1820

1921
from typing import TYPE_CHECKING
@@ -26,13 +28,15 @@ class RavenDocumentNotification(Document):
2628
)
2729

2830
condition: DF.Code | None
31+
do_not_attach_doc: DF.Check
2932
document_type: DF.Link
3033
enabled: DF.Check
3134
message: DF.Code
3235
notification_name: DF.Data
3336
recipients: DF.Table[RavenDocumentNotificationRecipients]
3437
send_alert_on: DF.Literal["New Document", "Update", "Submit", "Cancel", "Delete"]
3538
sender: DF.Link
39+
# ruff: noqa
3640
# end: auto-generated types
3741

3842
def validate(self):
@@ -109,8 +113,8 @@ def send_notification(self, context, link_doctype, link_document):
109113
bot.send_message(
110114
channel_id=channel,
111115
text=message,
112-
link_doctype=link_doctype,
113-
link_document=link_document,
116+
link_doctype=link_doctype if not self.do_not_attach_doc else None,
117+
link_document=link_document if not self.do_not_attach_doc else None,
114118
markdown=True,
115119
notification_name=self.name,
116120
)
@@ -119,8 +123,8 @@ def send_notification(self, context, link_doctype, link_document):
119123
bot.send_direct_message(
120124
user_id=user,
121125
text=message,
122-
link_doctype=link_doctype,
123-
link_document=link_document,
126+
link_doctype=link_doctype if not self.do_not_attach_doc else None,
127+
link_document=link_document if not self.do_not_attach_doc else None,
124128
markdown=True,
125129
notification_name=self.name,
126130
)

0 commit comments

Comments
 (0)