Skip to content

Commit

Permalink
Merge pull request #9447 from weseek/master
Browse files Browse the repository at this point in the history
Release v7.1.5
  • Loading branch information
yuki-takei authored Dec 13, 2024
2 parents f8b06df + 9ee712c commit 56c0ac6
Show file tree
Hide file tree
Showing 18 changed files with 962 additions and 93 deletions.
1 change: 1 addition & 0 deletions apps/app/bin/swagger-jsdoc/definition-apiv3.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
tags: [
'Attachment',
'Bookmarks',
'BookmarkFolders',
'Page',
'Pages',
'Revisions',
Expand Down
2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@growi/app",
"version": "7.1.4",
"version": "7.1.5-RC.0",
"license": "MIT",
"private": "true",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ class UploadForm extends React.Component {
</div>
</div>
<div className="row">
<div className="mx-auto mt-3">
<div className="mt-4 text-center">
{ this.props.onDiscard && (
<button type="button" className="btn btn-outline-secondary mx-1" onClick={this.props.onDiscard}>
{t('admin:importer_management.growi_settings.discard')}
</button>
) }
<button type="submit" className="btn btn-primary" disabled={!this.validateForm()}>
{t('admin:importer_management.growi_settings.upload')}
</button>
Expand All @@ -91,6 +96,7 @@ class UploadForm extends React.Component {
UploadForm.propTypes = {
t: PropTypes.func.isRequired, // i18next
onUpload: PropTypes.func.isRequired,
onDiscard: PropTypes.func,
isTheSameVersion: PropTypes.bool,
onVersionMismatch: PropTypes.func,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class GrowiArchiveSection extends React.Component {
: (
<UploadForm
onUpload={this.handleUpload}
onDiscard={this.state.fileName != null ? this.discardData : undefined}
onVersionMismatch={this.handleMismatchedVersions}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ export const CopyDropdown = (props) => {
<DropdownItemContents
title={t('copy_to_clipboard.Page path and permanent link')}
contents={<>{pagePathWithParams}<br />{permalink}</>}
className="text-truncate"
style={{ direction: 'rtl' }}
className="text-truncate d-block"
/>
</DropdownItem>
</CopyToClipboard>
Expand Down
12 changes: 12 additions & 0 deletions apps/app/src/client/components/Sidebar/Sidebar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
min-height: 50vh;
max-height: calc(100vh - var.$grw-sidebar-nav-width * 2);
border-radius: 0 4px 4px 0 ;
.simple-scrollbar {
max-height: inherit;
}
}
}
}
Expand Down Expand Up @@ -74,6 +77,15 @@
}


.grw-sidebar :global {

// overwrite simplebar-react css
.simplebar-scrollbar::before {
background-color:var(--bs-gray-500);
}

}

@include bs.color-mode(light) {
.grw-sidebar :global {
--bs-border-color: var(--grw-highlight-200);
Expand Down
15 changes: 11 additions & 4 deletions apps/app/src/client/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {

import withLoadingProps from 'next-dynamic-loading-props';
import dynamic from 'next/dynamic';
import SimpleBar from 'simplebar-react';
import { useIsomorphicLayoutEffect } from 'usehooks-ts';

import { SidebarMode } from '~/interfaces/ui';
Expand All @@ -27,6 +28,7 @@ import type { ResizableAreaProps } from './ResizableArea/props';
import { SidebarHead } from './SidebarHead';
import { SidebarNav, type SidebarNavProps } from './SidebarNav';

import 'simplebar-react/dist/simplebar.min.css';
import styles from './Sidebar.module.scss';


Expand Down Expand Up @@ -173,11 +175,16 @@ const CollapsibleContainer = memo((props: CollapsibleContainerProps): JSX.Elemen
<div className={`flex-expand-horiz ${className}`} onMouseLeave={mouseLeaveHandler}>
<Nav onPrimaryItemHover={primaryItemHoverHandler} />
<div
ref={sidebarScrollerRef}
className={`sidebar-contents-container flex-grow-1 overflow-y-auto overflow-x-hidden ${closedClass} ${openedClass}`}
style={{ width: collapsibleContentsWidth }}
className={`sidebar-contents-container flex-grow-1 overflow-hidden ${closedClass} ${openedClass}`}
>
{children}
<SimpleBar
scrollableNodeProps={{ ref: sidebarScrollerRef }}
className="simple-scrollbar h-100"
style={{ width: collapsibleContentsWidth }}
autoHide
>
{children}
</SimpleBar>
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/pages/[[...path]].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
useIsUploadEnabled(props.isUploadEnabled);

useIsLocalAccountRegistrationEnabled(props.isLocalAccountRegistrationEnabled);
useIsRomUserAllowedToComment(props.isRomUserAllowedToComment);

useIsAiEnabled(props.aiEnabled);

Expand Down
126 changes: 89 additions & 37 deletions apps/app/src/server/routes/apiv3/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,52 @@ const {
*
* components:
* schemas:
* AttachmentPaginateResult:
* description: AttachmentPaginateResult
* type: object
* properties:
* docs:
* type: array
* items:
* $ref: '#/components/schemas/Attachment'
* totalDocs:
* type: number
* example: 1
* limit:
* type: number
* example: 20
* totalPages:
* type: number
* example: 1
* page:
* type: number
* example: 1
* offset:
* type: number
* example: 0
* prevPage:
* type: number
* example: null
* nextPage:
* type: number
* example: null
* hasNextPage:
* type: boolean
* example: false
* hasPrevPage:
* type: boolean
* example: false
* pagingCounter:
* type: number
* example: 1
* Attachment:
* description: Attachment
* type: object
* properties:
* id:
* type: string
* description: attachment ID
* example: 5e0734e072560e001761fa67
* _id:
* type: string
* description: attachment ID
Expand All @@ -42,6 +84,10 @@ const {
* type: number
* description: attachment version
* example: 0
* attachmentType:
* type: string
* description: attachment type
* example: WIKI_PAGE
* fileFormat:
* type: string
* description: file format in MIME
Expand All @@ -55,6 +101,7 @@ const {
* description: original file name
* example: file.txt
* creator:
* type: object
* $ref: '#/components/schemas/User'
* page:
* type: string
Expand All @@ -64,14 +111,14 @@ const {
* type: string
* description: date created at
* example: 2010-01-01T00:00:00.000Z
* temporaryUrlExpiredAt:
* type: string
* description: temporary URL expired at
* example: 2024-11-27T00:59:59.962Z
* fileSize:
* type: number
* description: file size
* example: 3494332
* url:
* type: string
* description: attachment URL
* example: http://localhost/files/5e0734e072560e001761fa67
* filePathProxied:
* type: string
* description: file path proxied
Expand All @@ -80,8 +127,11 @@ const {
* type: string
* description: download path proxied
* example: "/download/5e0734e072560e001761fa67"
* temporaryUrlCached:
* type: string
* description: temporary URL cached
* example: "https://example.com/attachment/5e0734e072560e001761fa67"
*/

module.exports = (crowi) => {
const loginRequired = require('../../middlewares/login-required')(crowi, true);
const loginRequiredStrictly = require('../../middlewares/login-required')(crowi);
Expand Down Expand Up @@ -117,16 +167,35 @@ module.exports = (crowi) => {
* get:
* tags: [Attachment]
* description: Get attachment list
* responses:
* 200:
* description: Return attachment list
* parameters:
* - name: page_id
* - name: pageId
* in: query
* required: true
* description: page id
* schema:
* type: string
* - name: pageNumber
* in: query
* required: false
* description: page number
* schema:
* type: number
* example: 1
* - name: limit
* in: query
* required: false
* description: limit
* schema:
* type: number
* example: 10
* responses:
* 200:
* description: Return attachment list
* content:
* application/json:
* schema:
* type: object
* $ref: '#/components/schemas/AttachmentPaginateResult'
*/
router.get('/list', accessTokenParser, loginRequired, validator.retrieveAttachments, apiV3FormValidator, async(req, res) => {

Expand Down Expand Up @@ -202,11 +271,6 @@ module.exports = (crowi) => {
* 500:
* $ref: '#/components/responses/500'
*/
/**
* @api {get} /attachment/limit get available capacity of uploaded file with GridFS
* @apiName AddAttachment
* @apiGroup Attachment
*/
router.get('/limit', accessTokenParser, loginRequiredStrictly, validator.retrieveFileLimit, apiV3FormValidator, async(req, res) => {
const { fileUploadService } = crowi;
const fileSize = Number(req.query.fileSize);
Expand Down Expand Up @@ -234,10 +298,7 @@ module.exports = (crowi) => {
* schema:
* properties:
* page_id:
* nullable: true
* type: string
* path:
* nullable: true
* nullable: false
* type: string
* file:
* type: string
Expand All @@ -250,10 +311,7 @@ module.exports = (crowi) => {
* schema:
* properties:
* page_id:
* nullable: true
* type: string
* path:
* nullable: true
* nullable: false
* type: string
* file:
* type: string
Expand All @@ -273,26 +331,13 @@ module.exports = (crowi) => {
* $ref: '#/components/schemas/Page'
* attachment:
* $ref: '#/components/schemas/Attachment'
* url:
* $ref: '#/components/schemas/Attachment/properties/url'
* pageCreated:
* type: boolean
* description: whether the page was created
* example: false
* revision:
* type: string
* 403:
* $ref: '#/components/responses/403'
* 500:
* $ref: '#/components/responses/500'
*/
/**
* @api {post} /attachment Add attachment to the page
* @apiName AddAttachment
* @apiGroup Attachment
*
* @apiParam {String} page_id
* @apiParam {String} path
* @apiParam {File} file
*/
router.post('/', uploads.single('file'), autoReap, accessTokenParser, loginRequiredStrictly, excludeReadOnlyUser,
validator.retrieveAddAttachment, apiV3FormValidator, addActivity,
async(req, res) => {
Expand Down Expand Up @@ -342,6 +387,13 @@ module.exports = (crowi) => {
* responses:
* 200:
* description: Return attachment
* content:
* application/json:
* schema:
* type: object
* properties:
* attachment:
* $ref: '#/components/schemas/Attachment'
* parameters:
* - name: id
* in: path
Expand Down
Loading

0 comments on commit 56c0ac6

Please sign in to comment.