Skip to content

Commit

Permalink
fix: 2.0 bugs (#4011)
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 authored Aug 2, 2024
1 parent 2b56129 commit 770f937
Show file tree
Hide file tree
Showing 40 changed files with 78 additions and 74 deletions.
2 changes: 1 addition & 1 deletion extensions/akismet/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2",
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"typescript": "^4.5.4",
Expand Down
2 changes: 1 addition & 1 deletion extensions/approval/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/embed/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/emoji/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion extensions/flags/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"devDependencies": {
"@types/mithril": "^2.0.8",
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion extensions/likes/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/lock/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions extensions/markdown/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0",
"prettier": "@flarum/prettier-config",
"dependencies": {
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1"
},
Expand All @@ -19,7 +19,7 @@
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2",
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1"
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/mentions/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/nicknames/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import app from 'flarum/forum/app';
import FormModal from 'flarum/common/components/FormModal';
import Button from 'flarum/common/components/Button';
import Stream from 'flarum/common/utils/Stream';
import Form from '@flarum/core/src/common/components/Form';
import Form from 'flarum/common/components/Form';

export default class NicknameModal extends FormModal {
oninit(vnode) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/package-manager/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"devDependencies": {
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion extensions/pusher/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@flarum/prettier-config": "^1.0.0",
"@types/pusher-js": "^5.1.0",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion extensions/statistics/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@flarum/prettier-config": "^1.0.0",
"@types/mithril": "^2.0.11",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.7.1",
"typescript": "^4.7.4",
"typescript-coverage-report": "^0.6.4",
Expand Down
2 changes: 1 addition & 1 deletion extensions/sticky/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/subscriptions/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@flarum/prettier-config",
"devDependencies": {
"@flarum/prettier-config": "^1.0.0",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.7.1",
"webpack": "^5.76.0",
"webpack-cli": "^4.10.0",
Expand Down
2 changes: 1 addition & 1 deletion extensions/suspend/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.0",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.5.1",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Button from 'flarum/common/components/Button';
import Stream from 'flarum/common/utils/Stream';
import withAttr from 'flarum/common/utils/withAttr';
import ItemList from 'flarum/common/utils/ItemList';
import Form from 'flarum/common/components/Form';
import FieldSet from 'flarum/common/components/FieldSet';

import { getPermanentSuspensionDate } from '../helpers/suspensionHelper';
import Form from '@flarum/core/src/common/components/Form';
import FieldSet from '@flarum/core/src/common/components/FieldSet';

export default class SuspendUserModal extends FormModal {
oninit(vnode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import app from 'flarum/forum/app';
import Modal from 'flarum/common/components/Modal';
import Button from 'flarum/common/components/Button';
import fullTime from 'flarum/common/helpers/fullTime';
import Form from 'flarum/common/components/Form';
import { isPermanentSuspensionDate, localStorageKey } from '../helpers/suspensionHelper';
import Form from '@flarum/core/src/common/components/Form';

export default class SuspensionInfoModal extends Modal {
oninit(vnode) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/tags/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.7.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1",
Expand Down
3 changes: 2 additions & 1 deletion extensions/tags/js/src/admin/components/TagsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import Button from 'flarum/common/components/Button';
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
import withAttr from 'flarum/common/utils/withAttr';
import Form from 'flarum/common/components/Form';
import FormSectionGroup from 'flarum/admin/components/FormSectionGroup';
import FormSection from 'flarum/admin/components/FormSection';

import EditTagModal from './EditTagModal';
import tagIcon from '../../common/helpers/tagIcon';
import sortTags from '../../common/utils/sortTags';
import FormSectionGroup, { FormSection } from '@flarum/core/src/admin/components/FormSectionGroup';

function tagItem(tag) {
return (
Expand Down
2 changes: 1 addition & 1 deletion extensions/tags/src/Api/DiscussionResourceFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __invoke(): array
Schema\Relationship\ToMany::make('tags')
->includable()
->writable()
->required(fn (Context $context, Discussion $discussion) => ! $context->getActor()->can('bypassTagCounts', $discussion))
->required(fn (Context $context, Discussion $discussion) => $context->creating() && ! $context->getActor()->can('bypassTagCounts', $discussion))
->set(function (Discussion $discussion, array $newTags, Context $context) {
$actor = $context->getActor();

Expand Down
2 changes: 1 addition & 1 deletion framework/core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"cross-env": "^7.0.3",
"expose-loader": "^3.1.0",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"flarum-webpack-config": "^3.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion framework/core/js/src/admin/AdminApplication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type Extension = {
extra: {
'flarum-extension': {
title: string;
'database-support': undefined | string[];
'database-support'?: string[];
};
};
require?: Record<string, string>;
Expand Down
3 changes: 2 additions & 1 deletion framework/core/js/src/admin/components/AdvancedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { IPageAttrs } from '../../common/components/Page';
import type Mithril from 'mithril';
import Form from '../../common/components/Form';
import extractText from '../../common/utils/extractText';
import FormSectionGroup, { FormSection } from './FormSectionGroup';
import FormSectionGroup from './FormSectionGroup';
import FormSection from './FormSection';
import ItemList from '../../common/utils/ItemList';
import InfoTile from '../../common/components/InfoTile';
import { MaintenanceMode } from '../../common/Application';
Expand Down
21 changes: 21 additions & 0 deletions framework/core/js/src/admin/components/FormSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Component from '../../common/Component';
import type { ComponentAttrs } from '../../common/Component';
import Mithril from 'mithril';
import classList from '../../common/utils/classList';

export interface IFormSectionAttrs extends ComponentAttrs {
label: any;
}

export default class FormSection<CustomAttrs extends IFormSectionAttrs = IFormSectionAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>) {
const { className, ...attrs } = this.attrs;

return (
<div className={classList('FormSection', className)} {...attrs}>
<label>{this.attrs.label}</label>
<div className="FormSection-body">{vnode.children}</div>
</div>
);
}
}
17 changes: 0 additions & 17 deletions framework/core/js/src/admin/components/FormSectionGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,3 @@ export default class FormSectionGroup<CustomAttrs extends IFormSectionGroupAttrs
);
}
}

export interface IFormSectionAttrs extends ComponentAttrs {
label: any;
}

export class FormSection<CustomAttrs extends IFormSectionAttrs = IFormSectionAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>) {
const { className, ...attrs } = this.attrs;

return (
<div className={classList('FormSection', className)} {...attrs}>
<label>{this.attrs.label}</label>
<div className="FormSection-body">{vnode.children}</div>
</div>
);
}
}
2 changes: 1 addition & 1 deletion framework/core/js/src/common/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default abstract class Model {
*/
protected static getIdentifier(model: Model): ModelIdentifier;
protected static getIdentifier(model?: Model): ModelIdentifier | null {
if (!model || !('id' in model.data)) return null;
if (!model || !model.data || !('id' in model.data)) return null;

return {
type: model.data.type,
Expand Down
2 changes: 1 addition & 1 deletion framework/core/js/src/common/components/FormGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default class FormGroup<CustomAttrs extends IFormGroupAttrs = IFormGroupA

settingElement = <UploadImageButton value={stream} {...otherAttrs} />;
} else if (customFieldComponents.has(type)) {
return customFieldComponents.get(type)(this.attrs);
return customFieldComponents.get(type)({ ...this.attrs, bidi: this.attrs.stream });
} else {
attrs.className = classList('FormControl', attrs.className);

Expand Down
3 changes: 2 additions & 1 deletion framework/core/js/src/forum/components/LogInModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Stream from '../../common/utils/Stream';
import type Mithril from 'mithril';
import RequestError from '../../common/utils/RequestError';
import type { LoginParams } from '../../common/Session';
import ForgotPasswordModal from './ForgotPasswordModal';

export interface ILoginModalAttrs extends IFormModalAttrs {
identification?: string;
Expand Down Expand Up @@ -139,7 +140,7 @@ export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginMod
const email = this.identification();
const attrs = email.includes('@') ? { email } : undefined;

app.modal.show(() => import('./ForgotPasswordModal'), attrs);
app.modal.show(ForgotPasswordModal, attrs);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import listItems from '../../common/helpers/listItems';
* The `UsersSearchSource` finds and displays user search results in the search
* dropdown.
*/
export default class UsersSearchResults implements SearchSource {
export default class UsersSearchSource implements SearchSource {
protected results = new Map<string, User[]>();

public resource: string = 'users';
Expand Down
2 changes: 2 additions & 0 deletions framework/core/js/src/forum/states/ComposerState.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class ComposerState {
}

this.body = body;

return componentClass;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion framework/core/less/common/Select.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
cursor: pointer;
line-height: 1;

.FormSection & {
.FormSection &, &.FormControl {
width: 100%;
}
}
Expand Down
5 changes: 2 additions & 3 deletions framework/core/less/forum/Post.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

.UserCard {
position: absolute;
top: 15px;
left: 16px;
top: 0;
left: 0;
z-index: var(--zindex-dropdown);
transition: opacity 0.2s, transform 0.2s;
transform: scale(0.95);
Expand Down Expand Up @@ -454,7 +454,6 @@

.Post-avatar {
.Avatar--size(32px);
display: block;
}

.Post-main {
Expand Down
2 changes: 1 addition & 1 deletion js-packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"prettier": "@flarum/prettier-config",
"dependencies": {
"@types/jest": "^29.2.2",
"flarum-webpack-config": "^2.0.1",
"flarum-webpack-config": "^3.0.0",
"flat": "^5.0.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
Expand Down
2 changes: 1 addition & 1 deletion js-packages/webpack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flarum-webpack-config",
"type": "module",
"version": "2.0.2",
"version": "3.0.0",
"description": "Webpack config for Flarum JS and TS transpilation.",
"main": "src/index.cjs",
"author": "Flarum Team",
Expand Down
Loading

0 comments on commit 770f937

Please sign in to comment.