Skip to content

Commit

Permalink
Merge branch 'feat/page-bulk-export' into feat/78040-135788-resume-su…
Browse files Browse the repository at this point in the history
…spended-bulk-export-job
  • Loading branch information
arafubeatbox committed Aug 4, 2024
2 parents b4a4178 + a9680d5 commit 5c7f1b8
Show file tree
Hide file tree
Showing 77 changed files with 803 additions and 340 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/auto-labeling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
runs-on: ubuntu-latest

if: |
!contains(github.event.pull_request.labels.*.name, 'flag/exclude-from-changelog')
(!contains( github.event.pull_request.labels.*.name, 'flag/exclude-from-changelog' )
&& !startsWith( github.head_ref, 'changeset-release/' ))
steps:
- uses: release-drafter/release-drafter@v5
Expand All @@ -33,8 +34,9 @@ jobs:
runs-on: ubuntu-latest

if: |
(!contains( github.event.pull_request.labels.*.name, 'flag/exclude-from-changelog' ) &&
!startsWith( github.head_ref, 'dependabot/' ))
(!contains( github.event.pull_request.labels.*.name, 'flag/exclude-from-changelog' )
&& !startsWith( github.head_ref, 'changeset-release/' )
&& !startsWith( github.head_ref, 'dependabot/' ))
steps:
- uses: amannn/action-semantic-pull-request@v5
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches-ignore:
- release/**
- rc/**
- changeset-release/**
paths:
- .github/workflows/ci-app.yml
- .eslint*
Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# Changelog

## [Unreleased](https://github.com/weseek/growi/compare/v7.0.15...HEAD)
## [Unreleased](https://github.com/weseek/growi/compare/v7.0.16...HEAD)

*Please do not manually update this file. We've automated the process.*

## [v7.0.16](https://github.com/weseek/growi/compare/v7.0.15...v7.0.16) - 2024-07-31

### 💎 Features

* feat: Automatically repair corrupted data, at least for the latest revision (#9002) @yuki-takei

### 🚀 Improvement

* imprv: User group link in admin page (#8855) @kazutoweseek
* imprv: Sidebar header text size (#8986) @satof3
* imprv: Replace possition usericon (#8991) @satof3

### 🐛 Bug Fixes

* fix: Undo in the comment editor (#9005) @yuki-takei
* fix: Some OIDC authentication settings not being applied (#9000) @WNomunomu
* fix: font-family for monospace (#9004) @yuki-takei
* fix: Pointer cursor for the create button in the installer (#9003) @yuki-takei
* fix: Migration script (20211227060705-revision-path-to-page-id-schema-migration--fixed-7549.js) (#8998) @miya
* fix: Non-admin user gets 500 error when opening history modal (#9001) @miya
* fix: Enable page creation under GRANT_RESTRICTED pages (#8996) @arafubeatbox

## [v7.0.15](https://github.com/weseek/growi/compare/v7.0.14...v7.0.15) - 2024-07-23

### 🐛 Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion apps/app/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GROWI Official docker image
Supported tags and respective Dockerfile links
------------------------------------------------

* [`7.0.15`, `7.0`, `7`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v7.0.15/apps/app/docker/Dockerfile)
* [`7.0.16`, `7.0`, `7`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v7.0.16/apps/app/docker/Dockerfile)
* [`6.3.2`, `6.3`, `6` (Dockerfile)](https://github.com/weseek/growi/blob/v6.3.2/apps/app/docker/Dockerfile)
* [`6.2.4`, `6.2` (Dockerfile)](https://github.com/weseek/growi/blob/v6.2.4/apps/app/docker/Dockerfile)
* [`6.1.15`, `6.1` (Dockerfile)](https://github.com/weseek/growi/blob/v6.1.15/apps/app/docker/Dockerfile)
Expand Down
5 changes: 3 additions & 2 deletions apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@growi/app",
"version": "7.0.16-RC.0",
"version": "7.0.17-RC.0",
"license": "MIT",
"private": "true",
"scripts": {
Expand Down Expand Up @@ -44,7 +44,8 @@
"vitest:run:components": "vitest run -c vitest.config.components.ts src --coverage",
"previtest:run:integ": "vitest run -c test-with-vite/download-mongo-binary/vitest.config.ts test-with-vite/download-mongo-binary",
"//// misc": "",
"console": "yarn cross-env NODE_ENV=development yarn ts-node --experimental-repl-await src/server/console.js",
"console": "yarn repl",
"repl": "yarn cross-env NODE_ENV=development yarn ts-node src/server/repl.ts",
"swagger-jsdoc": "swagger-jsdoc -o tmp/swagger.json -d config/swagger-definition.js",
"openapi:v3": "yarn cross-env API_VERSION=3 yarn swagger-jsdoc -- \"src/server/routes/apiv3/**/*.js\" \"src/server/models/**/*.js\"",
"openapi:v1": "yarn cross-env API_VERSION=1 yarn swagger-jsdoc -- \"src/server/*/*.js\" \"src/server/models/**/*.js\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react';
import React, { useCallback, useState, useMemo } from 'react';

import {
getIdForRef, isPopulated, type IGrantedGroup, type IUserGroupHasId,
getIdStringForRef, isPopulated, type IGrantedGroup, type IUserGroupHasId,
} from '@growi/core';
import { useTranslation } from 'next-i18next';
import {
Expand Down Expand Up @@ -90,8 +90,8 @@ export const UserGroupDeleteModal: FC<Props> = (props: Props) => {
}, [setActionName]);

const handleGroupChange = useCallback((e) => {
const transferToUserGroupId = e.target.value;
const selectedGroup = userGroups.find(group => getIdForRef(group.item) === transferToUserGroupId) ?? null;
const transferToUserGroupId: string = e.target.value;
const selectedGroup = userGroups.find(group => getIdStringForRef(group.item) === transferToUserGroupId) ?? null;
setTransferToUserGroup(selectedGroup);
}, [userGroups]);

Expand Down Expand Up @@ -136,11 +136,11 @@ export const UserGroupDeleteModal: FC<Props> = (props: Props) => {
}

const groups = userGroups.filter((group) => {
return getIdForRef(group.item) !== deleteUserGroup._id;
return getIdStringForRef(group.item) !== deleteUserGroup._id;
});

const options = groups.map((group) => {
const groupId = getIdForRef(group.item);
const groupId = getIdStringForRef(group.item);
const groupName = isPopulated(group.item) ? group.item.name : null;
return { id: groupId, name: groupName };
}).filter(obj => obj.name != null)
Expand All @@ -153,7 +153,7 @@ export const UserGroupDeleteModal: FC<Props> = (props: Props) => {
<select
name="transferToUserGroup"
className={`form-control ${actionName === PageActionOnGroupDelete.transfer ? '' : 'd-none'}`}
value={transferToUserGroup != null ? getIdForRef(transferToUserGroup.item) : ''}
value={transferToUserGroup != null ? getIdStringForRef(transferToUserGroup.item) : ''}
onChange={handleGroupChange}
>
<option value="" disabled>{defaultOptionText}</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {
} from 'react';

import {
GroupType, getIdForRef, type IGrantedGroup, type IUserGroup, type IUserGroupHasId,
GroupType, getIdStringForRef, type IGrantedGroup, type IUserGroup, type IUserGroupHasId,
} from '@growi/core';
import { objectIdUtils } from '@growi/core/dist/utils';
import { useTranslation } from 'next-i18next';
Expand Down Expand Up @@ -130,8 +130,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
setSearchType(searchType);
}, []);

const updateUserGroup = useCallback(async(userGroup: IUserGroupHasId, update: Partial<IUserGroupHasId>, forceUpdateParents: boolean) => {
const parentId = typeof update.parent === 'string' ? update.parent : update.parent?._id;
const updateUserGroup = useCallback(async(userGroup: IUserGroupHasId, update: IUserGroupHasId, forceUpdateParents: boolean) => {
if (isExternalGroup) {
await apiv3Put<{ userGroup: IExternalUserGroupHasId }>(`/external-user-groups/${userGroup._id}`, {
description: update.description,
Expand All @@ -141,7 +140,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
await apiv3Put<{ userGroup: IUserGroupHasId }>(`/user-groups/${userGroup._id}`, {
name: update.name,
description: update.description,
parentId: parentId ?? null,
parentId: update.parent != null ? getIdStringForRef(update.parent) : null,
forceUpdateParents,
});
}
Expand All @@ -154,7 +153,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
}, [mutateAncestorUserGroups, mutateChildUserGroups, mutateSelectableChildUserGroups, mutateSelectableParentUserGroups, isExternalGroup]);

const onSubmitUpdateGroup = useCallback(
async(targetGroup: IUserGroupHasId, userGroupData: Partial<IUserGroupHasId>, forceUpdateParents: boolean): Promise<void> => {
async(targetGroup: IUserGroupHasId, userGroupData: IUserGroupHasId, forceUpdateParents: boolean): Promise<void> => {
try {
await updateUserGroup(targetGroup, userGroupData, forceUpdateParents);
toastSuccess(t('toaster.update_successed', { target: t('UserGroup'), ns: 'commons' }));
Expand Down Expand Up @@ -303,7 +302,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {

const deleteChildUserGroupById = useCallback(async(deleteGroupId: string, actionName: PageActionOnGroupDelete, transferToUserGroup: IGrantedGroup | null) => {
const url = isExternalGroup ? `/external-user-groups/${deleteGroupId}` : `/user-groups/${deleteGroupId}`;
const transferToUserGroupId = transferToUserGroup != null ? getIdForRef(transferToUserGroup.item) : null;
const transferToUserGroupId = transferToUserGroup != null ? getIdStringForRef(transferToUserGroup.item) : null;
const transferToUserGroupType = transferToUserGroup != null ? transferToUserGroup.type : null;
try {
const res = await apiv3Delete(url, {
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/client/components/InstallerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const InstallerForm = memo((props: Props): JSX.Element => {
<span className="material-symbols-outlined">person_add</span>
)}
</span>
<label className="flex-grow-1">{ t('Create') }</label>
<span className="flex-grow-1">{ t('Create') }</span>
</button>
</div>

Expand Down
7 changes: 4 additions & 3 deletions apps/app/src/client/components/Me/ProfileImageSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback, useState } from 'react';


import { isPopulated } from '@growi/core';
import { useTranslation } from 'next-i18next';

import ImageCropModal from '~/client/components/Common/ImageCropModal';
Expand All @@ -21,10 +22,10 @@ const ProfileImageSettings = (): JSX.Element => {

const [isGravatarEnabled, setGravatarEnabled] = useState(currentUser?.isGravatarEnabled);
const [uploadedPictureSrc, setUploadedPictureSrc] = useState(() => {
if (typeof currentUser?.imageAttachment === 'string') {
return currentUser?.image;
if (currentUser?.imageAttachment != null && isPopulated(currentUser.imageAttachment)) {
return currentUser.imageAttachment.filePathProxied ?? currentUser.image;
}
return currentUser?.imageAttachment?.filePathProxied ?? currentUser?.image;
return currentUser?.image;
});

const [showImageCropModal, setShowImageCropModal] = useState(false);
Expand Down
9 changes: 6 additions & 3 deletions apps/app/src/client/components/PageComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import React, {
useState, useMemo, memo, useCallback,
} from 'react';

import { isPopulated, getIdForRef, type IRevisionHasId } from '@growi/core';
import type { IRevision, Ref } from '@growi/core';
import {
isPopulated, getIdStringForRef,
} from '@growi/core';
import { UserPicture } from '@growi/ui/dist/components';
import { useTranslation } from 'next-i18next';

Expand All @@ -30,7 +33,7 @@ type PageCommentProps = {
rendererOptions?: RendererOptions,
pageId: string,
pagePath: string,
revision: string | IRevisionHasId,
revision: Ref<IRevision>,
currentUser: any,
isReadOnly: boolean,
}
Expand Down Expand Up @@ -121,7 +124,7 @@ export const PageComment: FC<PageCommentProps> = memo((props: PageCommentProps):
return <></>;
}

const revisionId = getIdForRef(revision);
const revisionId = getIdStringForRef(revision);
const revisionCreatedAt = (isPopulated(revision)) ? revision.createdAt : undefined;

const commentElement = (comment: ICommentHasId) => (
Expand Down
14 changes: 9 additions & 5 deletions apps/app/src/client/components/PageComment/CommentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CodeMirrorEditorComment } from '@growi/editor/dist/client/components/Co
import { useCodeMirrorEditorIsolated } from '@growi/editor/dist/client/stores/codemirror-editor';
import { useResolvedThemeForEditor } from '@growi/editor/dist/client/stores/use-resolved-theme';
import { UserPicture } from '@growi/ui/dist/components';
import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
import { useTranslation } from 'next-i18next';
import dynamic from 'next/dynamic';
import {
Expand Down Expand Up @@ -208,10 +209,13 @@ export const CommentEditor = (props: CommentEditorProps): JSX.Element => {
});
}, [codeMirrorEditor, pageId]);

const onChangeHandler = useCallback(async(value: string) => {
const dirtyNum = await evaluateEditorDirtyMap(editorKey, value);
mutateIsEnabledUnsavedWarning(dirtyNum > 0);
}, [editorKey, evaluateEditorDirtyMap, mutateIsEnabledUnsavedWarning]);
const cmProps = useMemo<ReactCodeMirrorProps>(() => ({
onChange: async(value: string) => {
const dirtyNum = await evaluateEditorDirtyMap(editorKey, value);
mutateIsEnabledUnsavedWarning(dirtyNum > 0);
},
}), [editorKey, evaluateEditorDirtyMap, mutateIsEnabledUnsavedWarning]);


// initialize CodeMirrorEditor
useEffect(() => {
Expand Down Expand Up @@ -260,10 +264,10 @@ export const CommentEditor = (props: CommentEditorProps): JSX.Element => {
<CodeMirrorEditorComment
editorKey={editorKey}
acceptedUploadFileType={acceptedUploadFileType}
onChange={onChangeHandler}
onSave={postCommentHandler}
onUpload={uploadHandler}
editorSettings={editorSettings}
cmProps={cmProps}
/>
</TabPane>
<TabPane tabId="comment_preview">
Expand Down
13 changes: 9 additions & 4 deletions apps/app/src/client/components/PageControls/PageControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
}, [onClickDeleteMenuItem, pageId, pageInfo, path, revisionId]);

const switchContentWidthClickHandler = useCallback(() => {
if (onClickSwitchContentWidth == null) {
return;
}

const newValue = !expandContentWidth;
if (onClickSwitchContentWidth == null || (isGuestUser ?? true) || (isReadOnlyUser ?? true)) {
if ((isGuestUser ?? true) || (isReadOnlyUser ?? true)) {
logger.warn('Could not switch content width', {
onClickSwitchContentWidth: onClickSwitchContentWidth == null ? 'null' : 'not null',
isGuestUser,
isReadOnlyUser,
});
Expand All @@ -250,12 +252,15 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
if (!isIPageInfoForEntity(pageInfo)) {
return undefined;
}
const wideviewMenuItemRenderer = (props: WideViewMenuItemProps) => {
if (onClickSwitchContentWidth == null) {
return undefined;
}

const wideviewMenuItemRenderer = (props: WideViewMenuItemProps) => {
return <WideViewMenuItem {...props} onClick={switchContentWidthClickHandler} expandContentWidth={expandContentWidth} />;
};
return wideviewMenuItemRenderer;
}, [pageInfo, switchContentWidthClickHandler, expandContentWidth]);
}, [pageInfo, expandContentWidth, onClickSwitchContentWidth, switchContentWidthClickHandler]);

if (!isIPageInfoForEntity(pageInfo)) {
return <></>;
Expand Down
19 changes: 12 additions & 7 deletions apps/app/src/client/components/PageEditor/PageEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, {
useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,
} from 'react';


import type EventEmitter from 'events';
import nodePath from 'path';

Expand All @@ -14,12 +13,13 @@ import { CodeMirrorEditorMain } from '@growi/editor/dist/client/components/CodeM
import { useCodeMirrorEditorIsolated } from '@growi/editor/dist/client/stores/codemirror-editor';
import { useResolvedThemeForEditor } from '@growi/editor/dist/client/stores/use-resolved-theme';
import { useRect } from '@growi/ui/dist/utils';
import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
import detectIndent from 'detect-indent';
import { useTranslation } from 'next-i18next';
import { throttle, debounce } from 'throttle-debounce';

import { useUpdateStateAfterSave } from '~/client/services/page-operation';
import { updatePage, extractRemoteRevisionDataFromErrorObj } from '~/client/services/update-page';
import { useUpdatePage, extractRemoteRevisionDataFromErrorObj } from '~/client/services/update-page';
import { uploadAttachments } from '~/client/services/upload-attachments';
import { toastError, toastSuccess, toastWarning } from '~/client/util/toastr';
import { useShouldExpandContent } from '~/services/layout/use-should-expand-content';
Expand Down Expand Up @@ -118,6 +118,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {

const shouldExpandContent = useShouldExpandContent(currentPage);

const updatePage = useUpdatePage();
const updateStateAfterSave = useUpdateStateAfterSave(pageId, { supressEditingMarkdownMutation: true });

useConflictEffect();
Expand Down Expand Up @@ -159,10 +160,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
setMarkdownToPreview(value);
})), []);

const markdownChangedHandler = useCallback((value: string) => {
setMarkdownPreviewWithDebounce(value);
}, [setMarkdownPreviewWithDebounce]);


const { scrollEditorHandler, scrollPreviewHandler } = useScrollSync(GlobalCodeMirrorEditorKey.MAIN, previewRef);

Expand Down Expand Up @@ -267,6 +264,14 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
});
}, [codeMirrorEditor, pageId]);


const cmProps = useMemo<ReactCodeMirrorProps>(() => ({
onChange: (value: string) => {
setMarkdownPreviewWithDebounce(value);
},
}), [setMarkdownPreviewWithDebounce]);


// set handler to save and return to View
useEffect(() => {
globalEmitter.on('saveAndReturnToView', saveAndReturnToViewHandler);
Expand Down Expand Up @@ -363,7 +368,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
<div className="page-editor-editor-container flex-expand-vert border-end">
<CodeMirrorEditorMain
isEditorMode={editorMode === EditorMode.Editor}
onChange={markdownChangedHandler}
onSave={saveWithShortcut}
onUpload={uploadHandler}
acceptedUploadFileType={acceptedUploadFileType}
Expand All @@ -374,6 +378,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
initialValue={initialValue}
editorSettings={editorSettings}
onEditorsUpdated={onEditorsUpdated}
cmProps={cmProps}
/>
</div>
<div
Expand Down
Loading

0 comments on commit 5c7f1b8

Please sign in to comment.