Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/di/global-polls-cleanup' into im…
Browse files Browse the repository at this point in the history
…/global-polls
  • Loading branch information
novacuum committed Apr 18, 2024
2 parents 6824eef + 8274a87 commit 013f81a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions js/src/forum/components/CreatePollModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import app from 'flarum/forum/app';
import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal';
import PollForm from './PollForm';
import PollModel from '../models/Poll';
import PollFormState from '../states/PollFormState';

interface CreatePollModalAttrs extends IInternalModalAttrs {
poll: PollModel;
Expand All @@ -27,7 +26,7 @@ export default class CreatePollModal extends Modal<CreatePollModalAttrs> {
];
}

async onFormSubmit(data: object, state: PollFormState): Promise<void> {
async onFormSubmit(data: object): Promise<void> {
this.hide();
await this.attrs.onsubmit(data);
}
Expand Down
4 changes: 2 additions & 2 deletions js/src/forum/components/Poll/PollSubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class PollSubmitButton extends Component<PollSubmitButtonAttrs> {
<Button
className="Button Button--primary Poll-submit"
loading={state.loadingOptions}
onclick={(event: Event) => this.pollButtonSubmit(state, event)}
onclick={() => this.pollButtonSubmit(state)}
disabled={!state.hasSelectedOptions()}
>
{app.translator.trans('fof-polls.forum.poll.submit_button')}
Expand All @@ -27,7 +27,7 @@ export default class PollSubmitButton extends Component<PollSubmitButtonAttrs> {
* Event handler for submit button being clicked
*/

pollButtonSubmit(state: PollState, event: Event): void {
pollButtonSubmit(state: PollState): void {
state.onsubmit();
}
}
1 change: 0 additions & 1 deletion js/src/forum/components/PollForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import PollControls from '../utils/PollControls';
import PollModel from '../models/Poll';
import PollOption from '../models/PollOption';
import UploadPollImageButton from './UploadPollImageButton';
import Poll from '../models/Poll';
import Tooltip from 'flarum/common/components/Tooltip';
import RequestError from 'flarum/common/utils/RequestError';

Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/UploadPollImageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class UploadPollImageButton extends Button<UploadPollImageButtonA
* @param {object} response
* @protected
*/
failure(response: object) {
failure() {
this.loading = false;
m.redraw();
this.$input?.remove();
Expand Down
6 changes: 3 additions & 3 deletions js/src/forum/utils/PollControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
/**
* Get controls for direct modifcation actions on polls (e.g. vote, view voters).
*/
pollControls(poll: Poll, context: Component): ItemList<Mithril.Children> {
pollControls(): ItemList<Mithril.Children> {
const items = new ItemList<Mithril.Children>();

return items;
Expand All @@ -42,7 +42,7 @@ export default {
/**
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
*/
moderationControls(poll: Poll, context: Component): ItemList<Mithril.Children> {
moderationControls(poll: Poll): ItemList<Mithril.Children> {
const items = new ItemList<Mithril.Children>();

if (poll.canEdit()) {
Expand All @@ -61,7 +61,7 @@ export default {
* Get controls for a user which are destructive (e.g. delete).
* @protected
*/
destructiveControls(poll: Poll, context: Component): ItemList<Mithril.Children> {
destructiveControls(poll: Poll): ItemList<Mithril.Children> {
const items = new ItemList<Mithril.Children>();

if (poll.canDelete()) {
Expand Down
2 changes: 2 additions & 0 deletions js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// access to `dayjs` and `$` in the global namespace.
"include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*"],
"compilerOptions": {
"noUnusedLocals": true,
"noUnusedParameters": true,
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"baseUrl": ".",
Expand Down

0 comments on commit 013f81a

Please sign in to comment.