Skip to content

Commit

Permalink
ccrf: new module
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed May 28, 2024
1 parent 1c5f541 commit 4dc21f6
Show file tree
Hide file tree
Showing 23 changed files with 2,012 additions and 8 deletions.
3 changes: 3 additions & 0 deletions i18n/ccrf-loader/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deputy.ccrf.start": "File a new case request"
}
64 changes: 64 additions & 0 deletions i18n/ccrf/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"deputy.ccrf.start": "File a new case request",

"deputy.ccrf.caseRequestFilingDialog.title": "CCI Case Request Filer",

"deputy.ccrf.previous": "Previous",
"deputy.ccrf.next": "Next",

"deputy.ccrf.intro.heading": "Hello!",
"deputy.ccrf.intro.newbies": "If you're new here, please read the introduction below.",
"deputy.ccrf.intro.explain1": "Welcome to the CCI Case Request Filer. This wizard will help you with spot-checking a user for possible copyright violations and, if needed, file a case request at this wiki's [[$1|contributor copyright investigations]] (CCI) board.",
"deputy.ccrf.intro.explain2": "First and foremost, however, it is important to note that the wizard itself is not able to properly identify copyright investigations, but it will try its best to help you find possible violations. When spot-checking a user, it is important that you perform a thorough check at the data provided by the wizard to ensure that you're filing an accurate request. And as always, please assume good faith when performing spot-checks.",

"deputy.ccrf.step1.heading": "Select a user",
"deputy.ccrf.step1.details": "Type the name of the user you want to investigate in the box below. You can also paste a URL of that user's userpage, talk page, or contributions page.",
"deputy.ccrf.step1.details2": "Once you've selected a user, we'll run a few background checks for you. You'll still have to interpret these checks on your own.",
"deputy.ccrf.step1.placeholder": "Username",
"deputy.ccrf.step1.error.invalid": "It looks like this username is invalid. Check your input and try again.",
"deputy.ccrf.step1.error.notfound": "It looks like this user doesn't exist on this wiki. Check your spelling and try again.",

"deputy.ccrf.step2.heading": "Perform background checks",
"deputy.ccrf.step2.details": "We're running a few background checks for you. Some of these checks may contain false positives and false negatives; it's important that you double check the data here before including them in your request. These background checks determine if:",
"deputy.ccrf.step2.details.page": "$1 created pages that were deleted for copyright violations",
"deputy.ccrf.step2.details.revisions": "$1 has revisions hidden due to copyright violations",
"deputy.ccrf.step2.details.revisions.note": "Note that $1's revisions may have been collateral damage from another user's copyright violation. We've placed notes on revisions where this is the likely case.",
"deputy.ccrf.step2.details.warnings": "$1 has received copyright-related warnings in the past",
"deputy.ccrf.step2.details2": "These checks may take a while. Some of these checks have progress indicators to help you gauge how long they'll take. Grab a cup of coffee or stare at [[Special:RecentChanges|recent changes]] while you wait.",
"deputy.ccrf.step2.noUser": "You haven't selected a user yet. Please go back to the previous step and select a user.",
"deputy.ccrf.step2.error": "An error occurred while attempting to perform background checks: $1",

"deputy.ccrf.step2.fallback": "Prior to writing a case on $1, check if this user has a history of copyright violations. This can help you determine if this user is a repeat offender, and you can include this information as required in your report. You can start off by checking the following places:",
"deputy.ccrf.step2.fallback.link1": "[[Special:PageHistory/User talk:$1|$1's talk page history]] (to look for past warnings)",
"deputy.ccrf.step2.fallback.link2": "[[Special:Log/create|Page creation log]] (to look for pages by the user that have since been deleted for copyright reasons)",
"deputy.ccrf.step2.fallback2": "Once you're done, take note of what you've found to include them in the your request.",

"deputy.ccrf.check.page.load": "Checking user's deleted pages...",
"deputy.ccrf.check.page.match": "Found $1 pages that were likely copyright violations",
"deputy.ccrf.check.page.clear": "Found no pages that were likely copyright violations",
"deputy.ccrf.check.page.none": "Deputy was unable to find any pages that were deleted for copyright violations.",
"deputy.ccrf.check.revision.load": "Checking user's hidden revisions...",
"deputy.ccrf.check.revision.match": "Found $1 revisions that may have copyright violations, none likely",
"deputy.ccrf.check.revision.match.close": "Found $1 revisions that may have copyright violations, $2 likely",
"deputy.ccrf.check.revision.clear": "Found no revisions that were deleted for copyright violations",
"deputy.ccrf.check.revision.none": "Deputy was unable to find any revisions by this user that were deleted or hidden for copyright violations.",
"deputy.ccrf.check.warnings.load": "Checking user's warnings...",
"deputy.ccrf.check.warnings.match": "Found $1 copyright violation warnings",
"deputy.ccrf.check.warnings.clear": "Found no copyright violation warnings",
"deputy.ccrf.check.toggle": "Toggle details",

"deputy.ccrf.page.links.parenthesis": "(",
"deputy.ccrf.page.links.separator": " | ",
"deputy.ccrf.page.links.history": "history",
"deputy.ccrf.page.links.edit": "edit",
"deputy.ccrf.page.links.end": ")",

"deputy.ccrf.page.details.separator": "",
"deputy.ccrf.page.details.created": "created $1",
"deputy.ccrf.page.deleted": "Deleted on [[$1|$2]] by [[$3|$4]] with reason \"<i>$5</i>\"",
"deputy.ccrf.page.deleted.userhidden": "Deleted on [[$1|$2]] with reason \"<i>$3</i>\"",

"deputy.ccrf.revision.deleted": "Deleted on [[$1|$2]] by [[$3|$4]] with reason \"<i>$5</i>\"",
"deputy.ccrf.revision.deleted.userhidden": "Deleted on [[$1|$2]] with reason \"<i>$3</i>\"",
"deputy.ccrf.revision.likely": "Likely cause of deletion"
}
8 changes: 8 additions & 0 deletions i18n/shared/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"deputy.ante.short": "Attrib. Template Editor",
"deputy.ante.acronym": "Deputy: ANTE",

"deputy.ccrf": "CCI Case Request Filer",
"deputy.ccrf.short": "Case Request Filer",
"deputy.ccrf.acronym": "Deputy: CCRF",

"deputy.module.loadFailure": "The requested module couldn't be loaded ($1).",

"deputy.cancel": "Cancel",
"deputy.review": "Review",
"deputy.review.title": "Review a diff of the changes to be made to the page",
Expand All @@ -34,6 +40,8 @@
"deputy.revision.tags": "{{PLURAL:$1|Tag|Tags}}:",
"deputy.revision.new": "N",
"deputy.revision.new.tooltip": "This edit created a new page.",
"deputy.revision.removed.user": "Username or IP removed",
"deputy.revision.removed.comment": "edit summary removed",

"deputy.comma-separator": ", ",

Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
"test:clean": "shx rm -rf tests/artifacts/ && shx mkdir -p tests/artifacts/",
"test:jest": "jest",
"clean": "shx rm -rf build node_modules/.cache/rollup-plugin-typescript2",
"prebuild": "shx mkdir -p build/i18n/ && shx cp -Rf i18n/* build/i18n/",
"build": "npm run prebuild && rollup -c",
"index": "node scripts/genUtilIndices.js",
"prebuild": "npm run index && shx mkdir -p build/i18n/ && shx cp -Rf i18n/* build/i18n/",
"build": "rollup -c",
"build:deputy": "npm run prebuild && cross-env DEPUTY_ONLY=deputy rollup -c",
"build:ante": "npm run prebuild && cross-env DEPUTY_ONLY=ante rollup -c",
"build:ia": "npm run prebuild && cross-env DEPUTY_ONLY=ia rollup -c",
"build:ccrf": "npm run prebuild && cross-env DEPUTY_ONLY=ccrf rollup -c",
"build:ccrf-loader": "npm run prebuild && cross-env DEPUTY_ONLY=ccrf-loader rollup -c",
"dev": "cross-env DEPUTY_DEV=true rollup -c --watch",
"dev:deputy": "cross-env DEPUTY_ONLY=deputy npm run dev",
"dev:ante": "cross-env DEPUTY_ONLY=ante npm run dev",
"dev:ia": "cross-env DEPUTY_ONLY=ia npm run dev"
"dev:ia": "cross-env DEPUTY_ONLY=ia npm run dev",
"dev:ccrf": "cross-env DEPUTY_ONLY=ccrf npm run dev",
"dev:ccrf-loader": "cross-env DEPUTY_ONLY=ccrf,ccrf-loader npm run dev"
},
"repository": {
"type": "git",
Expand Down
32 changes: 32 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,37 @@ export default [
},
plugins: getPlugins(),
watch: getWatch()
} ),

// Standalone CCI Case Request Filer
auto( 'ccrf', {
...globals,
input: 'src/modules/ccrf/CCICaseRequestFilerStandalone.ts',
output: {
sourcemap: true,
file: 'build/deputy-ccrf.js',
format: 'iife',
banner: loadBanner( 'src', 'modules', 'ccrf', 'BANNER.txt' ) +
'\n// <nowiki>',
footer: '// </nowiki>\n// <3'
},
plugins: getPlugins(),
watch: getWatch()
} ),

// Standalone CCI Case Request Filer Loader
auto( 'ccrf-loader', {
...globals,
input: 'src/modules/ccrf/CCICaseRequestFilerLoader.ts',
output: {
sourcemap: true,
file: 'build/deputy-ccrf-loader.js',
format: 'iife',
banner: loadBanner( 'src', 'modules', 'ccrf', 'BANNER.txt' ) +
'\n// <nowiki>',
footer: '// </nowiki>\n// <3'
},
plugins: getPlugins(),
watch: getWatch()
} )
].filter( ( v ) => !!v );
51 changes: 50 additions & 1 deletion src/config/WikiConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import applyOverrides from '../util/applyOverrides';
import log from '../util/log';
import warn from '../util/warn';
import error from '../util/error';
import { StringFilterType } from './types';

export type WikiPageConfiguration = {
title: mw.Title,
Expand Down Expand Up @@ -266,6 +267,14 @@ export default class WikiConfiguration extends ConfigurationBase {
defaultValue: collapseBottom,
displayOptions: { type: 'code' }
} ),
requestsHeader: new Setting<string, string>( {
defaultValue: null,
displayOptions: { type: 'text' }
} ),
requestsTemplate: new Setting<string, string>( {
defaultValue: null,
displayOptions: { type: 'code' }
} ),
earwigRoot: new Setting<string, URL>( {
serialize: ( v ) => v.href,
deserialize: ( v ) => new URL( v ),
Expand Down Expand Up @@ -350,8 +359,48 @@ export default class WikiConfiguration extends ConfigurationBase {
} )
};

public readonly ccrf = {
introExtra: new Setting<string, string>( {
defaultValue: null,
displayOptions: { type: 'code' }
} ),
performPageChecks: new Setting<boolean, boolean>( {
defaultValue: true,
displayOptions: { type: 'checkbox' }
} ),
performRevisionChecks: new Setting<boolean, boolean>( {
defaultValue: true,
displayOptions: { type: 'checkbox' }
} ),
performWarningChecks: new Setting<boolean, boolean>( {
defaultValue: true,
displayOptions: { type: 'checkbox' }
} ),
pageDeletionFilters: new Setting<StringFilterType, StringFilterType>( {
...Setting.basicSerializers,
defaultValue: null,
displayOptions: { type: 'unimplemented' }
} ),
revisionDeletionFilters: new Setting<StringFilterType, StringFilterType>( {
...Setting.basicSerializers,
defaultValue: null,
displayOptions: { type: 'unimplemented' }
} ),
warningFilters: new Setting<StringFilterType, StringFilterType>( {
...Setting.basicSerializers,
defaultValue: null,
displayOptions: { type: 'unimplemented' }
} )
};

readonly type = <const> 'wiki';
public readonly all = { core: this.core, cci: this.cci, ante: this.ante, ia: this.ia };
public readonly all = {
core: this.core,
cci: this.cci,
ante: this.ante,
ia: this.ia,
ccrf: this.ccrf
};

/**
* Set to true when this configuration is outdated based on latest data. Usually adds banners
Expand Down
2 changes: 2 additions & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ export enum PortletNameView {
Short = 'short',
Acronym = 'acronym'
}

export type StringFilterType = string | string[] | { source: string, flags: string };
28 changes: 28 additions & 0 deletions src/modules/ccrf/BANNER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

CASE REQUEST FILER

File CCI requests through a guided interface.

------------------------------------------------------------------------

Copyright 2022 Chlod Aidan Alejandro

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

------------------------------------------------------------------------

NOTE TO USERS AND DEBUGGERS: This userscript is originally written in
TypeScript. The original TypeScript code is converted to raw JavaScript
during the build process. To view the original source code, visit

https://github.com/ChlodAlejandro/deputy
5 changes: 5 additions & 0 deletions src/modules/ccrf/BackgroundChecks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface BackgroundChecks {
page: boolean;
revision: boolean;
warnings: boolean;
}
Loading

0 comments on commit 4dc21f6

Please sign in to comment.