Page MenuHomePhabricator

Send an email to indicate a match if a file is uploaded that is already marked as a match
Closed, ResolvedPublic1 Estimated Story Points

Assigned To
Authored By
Dreamy_Jazz
Jan 18 2024, 7:29 PM
Referenced Files
F41735691: image (7).png
Jan 31 2024, 7:46 PM
F41735689: image (6).png
Jan 31 2024, 7:46 PM
F41735687: image (5).png
Jan 31 2024, 7:46 PM
F41735683: image (4).png
Jan 31 2024, 7:46 PM
F41735681: image (3).png
Jan 31 2024, 7:46 PM
F41735679: image (2).png
Jan 31 2024, 7:46 PM
F41735677: image (1).png
Jan 31 2024, 7:46 PM
F41735673: image.png
Jan 31 2024, 7:46 PM

Description

When a file is uploaded we insert this file to the mediamoderation_scan table for later processing. However, if the file is already in the table and is a match this file never get reported in an email. While we may want to block the upload, we currently only process the file once it has been uploaded. As such, sending an email to report this match is a quick solution to ensuring re-uploads are not missed.

Acceptance criteria
  • If a user uploads a file already listed as a match in the mediamoderation_scan table, then send an email indicating this new file is a match

Event Timeline

Change 991777 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/MediaModeration@master] Send email if file is uploaded that is already a match

https://gerrit.wikimedia.org/r/991777

Dreamy_Jazz set the point value for this task to 1.Jan 24 2024, 12:54 PM

Change 991777 merged by jenkins-bot:

[mediawiki/extensions/MediaModeration@master] Send email if file is uploaded that is already a match

https://gerrit.wikimedia.org/r/991777

Change 993499 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/MediaModeration@wmf/1.42.0-wmf.15] Send email if file is uploaded that is already a match

https://gerrit.wikimedia.org/r/993499

Change 993499 merged by jenkins-bot:

[mediawiki/extensions/MediaModeration@wmf/1.42.0-wmf.15] Send email if file is uploaded that is already a match

https://gerrit.wikimedia.org/r/993499

Mentioned in SAL (#wikimedia-operations) [2024-01-29T14:54:07Z] <Dreamy_Jazz> scap backport is also backporting 993499 for T355357

I will write suggested QA steps in a few hours.

Suggested QA steps which need a local wiki:

  1. Enable email support on your wiki so that you can view emails, if not already enabled.
    1. To set-up email support for MediaWiki-Docker, you can follow the steps at https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/Mail_handling to add Mail hog to your MediaWiki-Docker instance. You should add the code listed in that page to the listed files and then down and up your MediaWiki-Docker instance.
  2. Upload a test file to your wiki
  3. For the filename of the file you uploaded in step 2, note down the filename after replacing any spaces in the name with _ and removing the File: prefix.
  4. Define $wgMediaModerationPhotoDNAMockServiceFiles in your LocalSettings.php as the following replacing <file> with the filename from step 3. If you already have a definition of $wgMediaModerationPhotoDNAMockServiceFiles then remove it.
$wgMediaModerationPhotoDNAMockServiceFiles = [
	'FilesToIsMatchMap'	=> [
		// change to false if you want IsMatch to be false
		'<file>' => true,
	]
];
  1. Run ./maintenance/run MediaModeration:scanFilesInScanTable.php --use-jobqueue --verbose
  2. Define the following in your LocalSettings.php, if you don't already have it there:
$wgMediaModerationRecipientList = [ 'admin@wikimedia.org' ];
$wgMediaModerationFrom = 'no-reply@wikimedia.org';
  1. Open the email server for your wiki (if you use mail hog / did step 1A then open http://localhost:8025 ).
  2. Verify that an email for the file you uploaded in step 2 is in the inbox
  3. Upload the same file from step 2 under a different filename. Changing the filename can be done by modifying the Destination filename field in Special:Upload. Also check the Ignore warnings checkbox before uploading.
  4. Go back to the email server for your wiki and verify a new email has appeared that only details the filename for the file uploaded in step 9.

I have verified that the new code has been implemented and is functioning and displaying as expected...
Below you will see a series of screenshots that show the sequence of the Inbox beginning with 1 email and then ending with 2 emails , both with the same SHA-1 but different filenames for the same uploaded image.
Thank you @Dreamy_Jazz.

image.png (148×565 px, 11 KB)

image (1).png (256×1 px, 29 KB)

image (2).png (714×1 px, 121 KB)

image (3).png (755×1 px, 94 KB)

image (4).png (291×1 px, 48 KB)

image (5).png (677×1 px, 122 KB)

image (6).png (740×1 px, 96 KB)

image (7).png (740×1 px, 96 KB)