mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20598 from overleaf/jdt-ae-dropbox-limit-notif
Add go to project for 2000 file limit notification GitOrigin-RevId: dfd69773ebd5c2160dfce75f56b8fa1e93792c23
This commit is contained in:
parent
874c0211d7
commit
c6aec5c5c0
7 changed files with 21 additions and 16 deletions
|
@ -198,12 +198,13 @@ function ipMatcherAffiliation(userId) {
|
|||
function tpdsFileLimit(userId) {
|
||||
return {
|
||||
key: `tpdsFileLimit-${userId}`,
|
||||
create(projectName, callback) {
|
||||
create(projectName, projectId, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
const messageOpts = {
|
||||
projectName,
|
||||
projectId,
|
||||
}
|
||||
NotificationsHandler.createNotification(
|
||||
userId,
|
||||
|
|
|
@ -62,7 +62,7 @@ async function mergeUpdate(req, res) {
|
|||
{ err, userId, filePath },
|
||||
'tpds trying to append to project over file limit'
|
||||
)
|
||||
NotificationsBuilder.tpdsFileLimit(userId).create(projectName)
|
||||
NotificationsBuilder.tpdsFileLimit(userId).create(projectName, projectId)
|
||||
return res.sendStatus(400)
|
||||
} else {
|
||||
throw err
|
||||
|
|
|
@ -201,19 +201,23 @@ function CommonNotification({ notification }: CommonNotificationProps) {
|
|||
<Notification
|
||||
type="error"
|
||||
onDismiss={() => id && handleDismiss(id)}
|
||||
title={`${notification?.messageOpts?.projectName || 'A project'} exceeds the 2000 file limit`}
|
||||
content={
|
||||
<>
|
||||
Error: Your project {notification.messageOpts.projectName} has
|
||||
gone over the 2000 file limit using an integration (e.g. Dropbox
|
||||
or GitHub) <br />
|
||||
Please decrease the size of your project to prevent further
|
||||
errors.
|
||||
You can't add more files to the project or sync it with any
|
||||
integrations until you reduce the number of files.
|
||||
</>
|
||||
}
|
||||
action={
|
||||
<OLButton variant="secondary" href="/user/settings">
|
||||
Account Settings
|
||||
notification.messageOpts.projectId ? (
|
||||
<OLButton
|
||||
variant="secondary"
|
||||
onClick={() => id && handleDismiss(id)}
|
||||
href={`/project/${notification.messageOpts.projectId}`}
|
||||
>
|
||||
Open project
|
||||
</OLButton>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
) : templateKey === 'notification_dropbox_duplicate_project_names' ? (
|
||||
|
|
|
@ -3,7 +3,7 @@ import NewNotification from '@/shared/components/notification'
|
|||
|
||||
type NotificationProps = Pick<
|
||||
React.ComponentProps<typeof NewNotification>,
|
||||
'type' | 'action' | 'content' | 'onDismiss' | 'className'
|
||||
'type' | 'action' | 'content' | 'onDismiss' | 'className' | 'title'
|
||||
>
|
||||
|
||||
function Notification({ className, ...props }: NotificationProps) {
|
||||
|
|
|
@ -295,14 +295,12 @@ describe('<UserNotifications />', function () {
|
|||
|
||||
screen.getByRole('alert')
|
||||
screen.getByText(/file limit/i)
|
||||
screen.getByText(
|
||||
/please decrease the size of your project to prevent further errors/i
|
||||
)
|
||||
screen.getByText(/You can't add more files to the project or sync it/i)
|
||||
|
||||
const accountSettings = screen.getByRole('link', {
|
||||
name: /account settings/i,
|
||||
name: /Open project/i,
|
||||
})
|
||||
expect(accountSettings.getAttribute('href')).to.equal('/user/settings')
|
||||
expect(accountSettings.getAttribute('href')).to.equal('/project/123')
|
||||
const closeBtn = screen.getByRole('button', { name: /close/i })
|
||||
fireEvent.click(closeBtn)
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ export const notificationIPMatchedAffiliation = {
|
|||
export const notificationTPDSFileLimit = {
|
||||
messageOpts: {
|
||||
projectName: 'Abc Project',
|
||||
projectId: '123',
|
||||
},
|
||||
} as DeepReadonly<NotificationTPDSFileLimit>
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ export interface NotificationTPDSFileLimit extends NotificationBase {
|
|||
templateKey: Extract<TemplateKey, 'notification_tpds_file_limit'>
|
||||
messageOpts: {
|
||||
projectName: string
|
||||
projectId?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue