Skip to content

Commit

Permalink
post-rebase fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Oct 4, 2023
1 parent 00d2a91 commit badaaf7
Show file tree
Hide file tree
Showing 44 changed files with 4,764 additions and 311 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ root = true
end_of_line = lf
indent_style = tab

[{src, scripts, types}/**.{js,ts}]
[{src,scripts,types}/**.{js,ts}]
end_of_line = lf
insert_final_newline = true
charset = utf-8
Expand Down
7 changes: 2 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ module.exports = {
testRegex: '(/tests/)(.*?)(Tests?)(\\.[jt]s)$',

transform: {
'^.+\\.ts?$': 'ts-jest'
},
globals: {
'ts-jest': {
'^.+\\.tsx?$': [ 'ts-jest', {
tsconfig: '<rootDir>/tsconfig.tests.json'
}
} ]
},
testTimeout: 600e3

Expand Down
4,899 changes: 4,670 additions & 229 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"dependencies": {
"@chlodalejandro/parsoid": "^2.0.1-37ea110",
"broadcastchannel-polyfill": "^1.0.1",
"deputy-dispatch": "github:ChlodAlejandro/deputy-dispatch",
"idb": "^7.1.0",
"tsx-dom": "^1.4.0"
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/genUtilIndices.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const path = require( 'path' );

const dir = ( await fs.opendir( utilPath ) );
for await ( const fse of dir ) {
const moduleName = fse.name.replace( /\.ts$/, '' );
const moduleName = fse.name.replace( /\.tsx?$/, '' );

if ( fse.isFile() && fse.name !== 'index.ts' ) {
modules.push( moduleName );
Expand Down
2 changes: 1 addition & 1 deletion src/DeputyCommunications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'broadcastchannel-polyfill';
import { ContributionSurveyRowStatus } from './models/ContributionSurveyRow';
import generateId from './util/generateId';
import { WikiPageConfiguration } from './config/WikiConfiguration';
import log from './util/log';
import { ContributionSurveyRowStatus } from './models/ContributionSurveyRowStatus';

/**
* Generic message used to acknowledge an action. This is usually required by
Expand Down
3 changes: 2 additions & 1 deletion src/DeputyLanguage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeputyResources } from './DeputyResources';
import cloneRegex from './util/cloneRegex';
import error from './util/error';
import warn from './util/warn';
import { USER_LOCALE } from './wiki/Locale';

/**
Expand Down Expand Up @@ -75,7 +76,7 @@ export default class DeputyLanguage {

if ( mw.loader.getState( 'moment' ) !== 'ready' ) {
// moment.js is not yet loaded.
console.warn(
warn(
'Deputy tried loading moment.js locales but moment.js is not yet ready.'
);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/DeputyStorage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { openDB, DBSchema, IDBPDatabase } from 'idb';
import { ExpandedRevisionData } from './api/ExpandedRevisionData';
import { ContributionSurveyRowStatus } from './models/ContributionSurveyRow';
import MwApi from './MwApi';
import log from './util/log';
import { ContributionSurveyRowStatus } from './models/ContributionSurveyRowStatus';

/**
* General key-value store. Used for storing single-variable data
Expand Down
5 changes: 0 additions & 5 deletions src/MwApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ export default class MwApi {
errorformat: 'html',
errorlang: mw.config.get( 'wgUserLanguage' ),
errorsuselocal: true
},
ajax: {
headers: {
'Api-User-Agent': `Deputy/${deputyVersion} (${window.location.hostname})`
}
}
} ) );
}
Expand Down
3 changes: 0 additions & 3 deletions src/api/Dispatch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ExpandedRevisionData } from './ExpandedRevisionData';
import Requester from '../util/Requester';
import { deputyVersion } from '../DeputyVersion';
import WikiConfiguration from '../config/WikiConfiguration';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/config/Setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import UserConfiguration from './UserConfiguration';
import { ArrayOrNot } from '../types';
import getObjectValues from '../util/getObjectValues';
import { warn } from 'rollup-plugin-visualizer/dist/plugin/warn';
import warn from '../util/warn';

interface DisplayOptionsBase {

Expand Down
5 changes: 3 additions & 2 deletions src/config/WikiConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
batchListingPageWikitext,
batchListingWikitext,
collapseBottom,
collapseTop, copyvioBottom, copyvioTop,
collapseTop,
copyvioBottom,
copyvioTop,
listingWikitext
} from '../wiki/TemplatePolyfills';
import ConfigurationReloadBanner from '../ui/config/ConfigurationReloadBanner';
Expand All @@ -22,7 +24,6 @@ import log from '../util/log';
import warn from '../util/warn';
import error from '../util/error';
import { StringFilterType } from './types';
import warn from '../util/warn';

export type WikiPageConfiguration = {
title: mw.Title,
Expand Down
4 changes: 2 additions & 2 deletions src/css/deputy.css
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ body.mediawiki.rtl .dp-cs-row-head > :not(:first-child):not(:last-child) {

padding: 8px;
background-color: #fff;
border: 1px solid gray;
border: 1px solid rgb(128, 128, 128);
font-size: 0.9rem;

display: flex;
Expand Down Expand Up @@ -386,7 +386,7 @@ body.mediawiki.rtl .dp-cs-row-head > :not(:first-child):not(:last-child) {
/* TODO: Recheck RTL compatibility */
margin-left: 16px;
padding-left: 16px;
border-left: 1px solid gray;
border-left: 1px solid rgb(128, 128, 128);
}

.dp-pt-section:last-child {
Expand Down
2 changes: 1 addition & 1 deletion src/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

.deputy-about > :nth-child(2) > :first-child > :nth-child(2) {
color: gray;
color: rgb(128, 128, 128);
vertical-align: bottom;
margin-left: 0.4em;
}
Expand Down
16 changes: 1 addition & 15 deletions src/models/ContributionSurveyRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,7 @@ import ContributionSurveyRowParser, {
} from './ContributionSurveyRowParser';
import { ContributionSurveyRowSort } from './ContributionSurveyRowSort';
import DispatchRevisions from '../api/DispatchRevisions';

export enum ContributionSurveyRowStatus {
// The row has not been processed yet.
Unfinished = 0,
// The row has a comment but cannot be parsed
Unknown = 1,
// The row has been processed and violations were found ({{y}})
WithViolations = 2,
// The row has been processed and violations were not found ({{n}})
WithoutViolations = 3,
// The row has been found but the added text is no longer in the existing revision
Missing = 4,
// The row has been processed and text was presumptively removed ({{x}}),
PresumptiveRemoval = 5
}
import { ContributionSurveyRowStatus } from './ContributionSurveyRowStatus';

/**
* Represents a contribution survey row. This is an abstraction of the row that can
Expand Down
14 changes: 14 additions & 0 deletions src/models/ContributionSurveyRowStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export enum ContributionSurveyRowStatus {
// The row has not been processed yet.
Unfinished = 0,
// The row has a comment but cannot be parsed
Unknown = 1,
// The row has been processed and violations were found ({{y}})
WithViolations = 2,
// The row has been processed and violations were not found ({{n}})
WithoutViolations = 3,
// The row has been found but the added text is no longer in the existing revision
Missing = 4,
// The row has been processed and text was presumptively removed ({{x}}),
PresumptiveRemoval = 5
}
2 changes: 1 addition & 1 deletion src/modules/DeputyModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import deputySharedEnglish from '../../i18n/shared/en.json';
import UserConfiguration from '../config/UserConfiguration';
import { attachConfigurationDialogPortletLink } from '../ui/config/ConfigurationDialog';
import WikiConfiguration from '../config/WikiConfiguration';
import { warn } from 'rollup-plugin-visualizer/dist/plugin/warn';
import warn from '../util/warn';

/**
* A Deputy module. Modules are parts of Deputy that can usually be removed
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ante/css/copied-template-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}

.cte-fieldset {
border: 1px solid gray;
border: 1px solid rgb(128, 128, 128);
background-color: #ddf7ff;
padding: 16px;
min-width: 200px;
Expand Down
3 changes: 1 addition & 2 deletions src/modules/ante/models/TemplateMerger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import RowedAttributionNotice from './RowedAttributionNotice';
import { AttributionNoticeRow } from './AttributionNoticeRow';

/**
* Merges templates together. Its own class to avoid circular dependencies.
Expand All @@ -20,7 +19,7 @@ export default class TemplateMerger {
const template = templateList[ 0 ];
if ( template !== pivot ) {
if ( template.node.getTarget().href !== pivot.node.getTarget().href ) {
throw new Error("Attempted to merge incompatible templates.");
throw new Error( 'Attempted to merge incompatible templates.' );
}
pivot.merge( template, { delete: true } );
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ante/ui/pages/CopiedTemplateRowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import equalTitle from '../../../../util/equalTitle';
import RevisionDateGetButton from '../components/RevisionDateGetButton';
import SmartTitleInputWidget from '../components/SmartTitleInputWidget';
import PageLatestRevisionGetButton from '../components/PageLatestRevisionGetButton';
import { warn } from '../../../../util/warn';
import warn from '../../../../util/warn';
import error from '../../../../util/error';

export interface CopiedTemplateRowPageData {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ccrf/CCICaseRequestFilerLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import warn from '../../util/warn';
config,
window.deputyWikiConfigOverride,
( key, oldVal, newVal ) => {
console.warn( `${key}: ${
warn( `${key}: ${
JSON.stringify( oldVal )
}${
JSON.stringify( newVal )
Expand Down
7 changes: 5 additions & 2 deletions src/modules/ccrf/ui/CaseRequestFilingDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '../../../types';
import { blockExit, unblockExit } from '../../../util/blockExit';
import { h } from 'tsx-dom';
import CRFDIntroPageLayout from './pages/CRFDIntroPageLayout';
import CRFDUserSelectPageLayout from './pages/CRFDUserSelectPageLayout';
import sleep from '../../../util/sleep';
Expand All @@ -24,6 +23,7 @@ function initCaseRequestFilingDialog() {

// For dialogs. Remove if not a dialog.
static static = {
...OO.ui.ProcessDialog.static,
name: 'caseRequestFilingDialog',
title: mw.msg( 'deputy.ccrf.caseRequestFilingDialog.title' ),
actions: [
Expand All @@ -36,11 +36,12 @@ function initCaseRequestFilingDialog() {
};

data: any;
$body: JQuery;

introPage: ReturnType<typeof CRFDIntroPageLayout>;
userSelectPage: ReturnType<typeof CRFDUserSelectPageLayout>;
userCheckPage: ReturnType<typeof CRFDUserCheckPageLayout>;
layout: typeof window.OO.ui.BookletLayout;
layout: OO.ui.BookletLayout;

/**
* @param config
Expand Down Expand Up @@ -77,6 +78,8 @@ function initCaseRequestFilingDialog() {
this.setPage( this.introPage.name, true );

this.$body.append( this.layout.$element );

return this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ccrf/ui/checks/BackgroundCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PromiseOrNot } from '../../../../types';
*/
export default abstract class BackgroundCheck<T> {

progressBarWidget: typeof OO.ui.ProgressBarWidget;
progressBarWidget: OO.ui.ProgressBarWidget;
element: JSX.Element;
headerElement: JSX.Element;
mainElement: JSX.Element;
Expand Down
1 change: 0 additions & 1 deletion src/modules/ccrf/ui/pages/CRFDIntroPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { h } from 'tsx-dom';
import '../../../../types';
import msgEval from '../../../../wiki/util/msgEval';
import type CaseRequestFilingDialog from '../CaseRequestFilingDialog';
import unwrapWidget from '../../../../util/unwrapWidget';
import CRFDNavigation from '../CRFDNavigation';
import unwrapJQ from '../../../../util/unwrapJQ';

Expand Down
1 change: 0 additions & 1 deletion src/modules/ccrf/ui/pages/CRFDUserCheckPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type CaseRequestFilingDialog from '../CaseRequestFilingDialog';
import CRFDNavigation from '../CRFDNavigation';
import unwrapWidget from '../../../../util/unwrapWidget';
import DeputyMessageWidget from '../../../../ui/shared/DeputyMessageWidget';
import { DeputyDispatchTask } from '../../../../api/DispatchAsync';
import { BackgroundChecks } from '../../BackgroundChecks';
import { h } from 'tsx-dom';
import unwrapJQ from '../../../../util/unwrapJQ';
Expand Down
2 changes: 1 addition & 1 deletion src/modules/dynamicDevModuleLoad.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// #if _DEV
import { warn } from 'rollup-plugin-visualizer/dist/plugin/warn';
import warn from '../util/warn';

/**
* Loads a module in development. Only works in development contexts.
Expand Down
4 changes: 2 additions & 2 deletions src/modules/ia/css/infringement-assistant.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body.rtl .ia-listing-action--bracket:last-child {
}

.ia-listing-action--link[disabled] {
color: gray;
color: rgb(128, 128, 128);
pointer-events: none;
}

Expand Down Expand Up @@ -120,7 +120,7 @@ body.rtl .ia-listing-action--bracket:last-child {
.ia-report-intro {
font-size: 0.8rem;
padding-bottom: 12px;
border-bottom: 1px solid gray;
border-bottom: 1px solid rgb(128, 128, 128);
margin-bottom: 12px;
}
.ia-report-intro b {
Expand Down
1 change: 0 additions & 1 deletion src/modules/ia/ui/ListingActionLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { h } from 'tsx-dom';
import type CopyrightProblemsListing from '../models/CopyrightProblemsListing';
import type CopyrightProblemsSession from '../models/CopyrightProblemsSession';
import ListingResponsePanel from './ListingResponsePanel';
import DeputyLanguage from '../../../DeputyLanguage';

/**
*
Expand Down
1 change: 0 additions & 1 deletion src/modules/ia/ui/NewCopyrightProblemsListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { CompletionAction } from '../../shared/CompletionAction';
import purge from '../../../wiki/util/purge';
import { blockExit, unblockExit } from '../../../util/blockExit';
import CCICaseInputWidget from './CCICaseInputWidget';
import DeputyLanguage from '../../../DeputyLanguage';

/**
*
Expand Down
1 change: 0 additions & 1 deletion src/ui/config/ConfigurationReloadBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'tsx-dom';
import '../../types';
import unwrapWidget from '../../util/unwrapWidget';
import DeputyMessageWidget from '../shared/DeputyMessageWidget';
Expand Down
14 changes: 4 additions & 10 deletions src/ui/root/DeputyContributionSurveyRevision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import unwrapWidget from '../../util/unwrapWidget';
import { DeputyMessageEvent, DeputyRevisionStatusUpdateMessage } from '../../DeputyCommunications';
import type DeputyContributionSurveyRow from './DeputyContributionSurveyRow';
import {
ChangesListBytes, ChangesListDate,
ChangesListDiff,
ChangesListLinks, ChangesListRow,
ChangesListTags, ChangesListTime,
ChangesListUser,
NewPageIndicator
ChangesListLinks, ChangesListMissingRow, ChangesListRow
} from '../shared/ChangesList';
import unwrapElement from '../../util/unwrapElement';
import DeputyLoadingDots from './DeputyLoadingDots';
import MwApi from '../../MwApi';
import classMix from '../../util/classMix';
Expand Down Expand Up @@ -350,11 +344,11 @@ export default class DeputyContributionSurveyRevision
revid={ this.revision.revid }
parentid={ this.revision.parentid }
missing={ ( this.revision as any ).missing }
/>{unwrapElement(
/>{
( this.revision as any ).missing ?
this.renderMissingRevisionInfo() :
<ChangesListMissingRow revision={this.revision}/> :
<ChangesListRow revision={this.revision}/>
)}{this.diff}
}{this.diff}
</div> as HTMLElement;
}

Expand Down
5 changes: 2 additions & 3 deletions src/ui/root/DeputyContributionSurveyRow.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { ComponentChild, h } from 'tsx-dom';
import DeputyContributionSurveySection from './DeputyContributionSurveySection';
import { DeputyUIElement } from '../DeputyUIElement';
import ContributionSurveyRow, {
ContributionSurveyRowStatus
} from '../../models/ContributionSurveyRow';
import ContributionSurveyRow from '../../models/ContributionSurveyRow';
import swapElements from '../../util/swapElements';
import unwrapWidget from '../../util/unwrapWidget';
import DeputyLoadingDots from './DeputyLoadingDots';
Expand All @@ -22,6 +20,7 @@ import { ContributionSurveyRowSort } from '../../models/ContributionSurveyRowSor
import last from '../../util/last';
import warn from '../../util/warn';
import error from '../../util/error';
import { ContributionSurveyRowStatus } from '../../models/ContributionSurveyRowStatus';

export enum DeputyContributionSurveyRowState {
/*
Expand Down
Loading

0 comments on commit badaaf7

Please sign in to comment.