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) {
|
function tpdsFileLimit(userId) {
|
||||||
return {
|
return {
|
||||||
key: `tpdsFileLimit-${userId}`,
|
key: `tpdsFileLimit-${userId}`,
|
||||||
create(projectName, callback) {
|
create(projectName, projectId, callback) {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function () {}
|
callback = function () {}
|
||||||
}
|
}
|
||||||
const messageOpts = {
|
const messageOpts = {
|
||||||
projectName,
|
projectName,
|
||||||
|
projectId,
|
||||||
}
|
}
|
||||||
NotificationsHandler.createNotification(
|
NotificationsHandler.createNotification(
|
||||||
userId,
|
userId,
|
||||||
|
|
|
@ -62,7 +62,7 @@ async function mergeUpdate(req, res) {
|
||||||
{ err, userId, filePath },
|
{ err, userId, filePath },
|
||||||
'tpds trying to append to project over file limit'
|
'tpds trying to append to project over file limit'
|
||||||
)
|
)
|
||||||
NotificationsBuilder.tpdsFileLimit(userId).create(projectName)
|
NotificationsBuilder.tpdsFileLimit(userId).create(projectName, projectId)
|
||||||
return res.sendStatus(400)
|
return res.sendStatus(400)
|
||||||
} else {
|
} else {
|
||||||
throw err
|
throw err
|
||||||
|
|
|
@ -201,19 +201,23 @@ function CommonNotification({ notification }: CommonNotificationProps) {
|
||||||
<Notification
|
<Notification
|
||||||
type="error"
|
type="error"
|
||||||
onDismiss={() => id && handleDismiss(id)}
|
onDismiss={() => id && handleDismiss(id)}
|
||||||
|
title={`${notification?.messageOpts?.projectName || 'A project'} exceeds the 2000 file limit`}
|
||||||
content={
|
content={
|
||||||
<>
|
<>
|
||||||
Error: Your project {notification.messageOpts.projectName} has
|
You can't add more files to the project or sync it with any
|
||||||
gone over the 2000 file limit using an integration (e.g. Dropbox
|
integrations until you reduce the number of files.
|
||||||
or GitHub) <br />
|
|
||||||
Please decrease the size of your project to prevent further
|
|
||||||
errors.
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
action={
|
action={
|
||||||
<OLButton variant="secondary" href="/user/settings">
|
notification.messageOpts.projectId ? (
|
||||||
Account Settings
|
<OLButton
|
||||||
</OLButton>
|
variant="secondary"
|
||||||
|
onClick={() => id && handleDismiss(id)}
|
||||||
|
href={`/project/${notification.messageOpts.projectId}`}
|
||||||
|
>
|
||||||
|
Open project
|
||||||
|
</OLButton>
|
||||||
|
) : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : templateKey === 'notification_dropbox_duplicate_project_names' ? (
|
) : templateKey === 'notification_dropbox_duplicate_project_names' ? (
|
||||||
|
|
|
@ -3,7 +3,7 @@ import NewNotification from '@/shared/components/notification'
|
||||||
|
|
||||||
type NotificationProps = Pick<
|
type NotificationProps = Pick<
|
||||||
React.ComponentProps<typeof NewNotification>,
|
React.ComponentProps<typeof NewNotification>,
|
||||||
'type' | 'action' | 'content' | 'onDismiss' | 'className'
|
'type' | 'action' | 'content' | 'onDismiss' | 'className' | 'title'
|
||||||
>
|
>
|
||||||
|
|
||||||
function Notification({ className, ...props }: NotificationProps) {
|
function Notification({ className, ...props }: NotificationProps) {
|
||||||
|
|
|
@ -295,14 +295,12 @@ describe('<UserNotifications />', function () {
|
||||||
|
|
||||||
screen.getByRole('alert')
|
screen.getByRole('alert')
|
||||||
screen.getByText(/file limit/i)
|
screen.getByText(/file limit/i)
|
||||||
screen.getByText(
|
screen.getByText(/You can't add more files to the project or sync it/i)
|
||||||
/please decrease the size of your project to prevent further errors/i
|
|
||||||
)
|
|
||||||
|
|
||||||
const accountSettings = screen.getByRole('link', {
|
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 })
|
const closeBtn = screen.getByRole('button', { name: /close/i })
|
||||||
fireEvent.click(closeBtn)
|
fireEvent.click(closeBtn)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ export const notificationIPMatchedAffiliation = {
|
||||||
export const notificationTPDSFileLimit = {
|
export const notificationTPDSFileLimit = {
|
||||||
messageOpts: {
|
messageOpts: {
|
||||||
projectName: 'Abc Project',
|
projectName: 'Abc Project',
|
||||||
|
projectId: '123',
|
||||||
},
|
},
|
||||||
} as DeepReadonly<NotificationTPDSFileLimit>
|
} as DeepReadonly<NotificationTPDSFileLimit>
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ export interface NotificationTPDSFileLimit extends NotificationBase {
|
||||||
templateKey: Extract<TemplateKey, 'notification_tpds_file_limit'>
|
templateKey: Extract<TemplateKey, 'notification_tpds_file_limit'>
|
||||||
messageOpts: {
|
messageOpts: {
|
||||||
projectName: string
|
projectName: string
|
||||||
|
projectId?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue