MediaWiki talk:Gadget-PermissionOTRS.js/Archive 1

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

No suitable place found to insert template!

I am keeping on bouncing to the error 'No suitable place found to insert template!' for whichever image I try. Is the script working now? Let me know if you need an example image page where I tested and failed. --Sreejith K (talk) 12:06, 17 February 2011 (UTC)

I copied the script to my user namespace and ran it and found that if I replace the question mark in var permTester = /\|Permission\s?\=/i; to a "*", the script actually works. * is short for {0,}. Matches zero or more times while ? is short for {0,1}. Matches zero or one time. Any particular reason why "?" is used here instead of "*" ? --Sreejith K (talk) 11:16, 21 February 2011 (UTC)
Fixed --DieBuche (talk) 11:29, 21 February 2011 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Edit summary

The script is adding the old js file link in the edit summary. See an example --Sreejith K (talk) 13:59, 21 February 2011 (UTC)

Fixed as well. Thanks for spotting this.--DieBuche (talk) 14:16, 21 February 2011 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

OTRS received

When I use this script to add {{PermissionOTRS}} to pages which already has {{OTRS received}} tag, the {{OTRS received}} is not getting removed but is moved to the bottom of the page. See this edit for an example. Is this an expected behavior? --Sreejith K (talk) 05:15, 25 February 2011 (UTC)

Expected (This is wasn't part of the script). {{OTRS received}} tag should be removed from now on.--DieBuche (talk) 10:24, 25 February 2011 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

This tool incorrectly removes {{No license}} templates

This tool incorrectly removes {{No license}} templates, see for example [1]. Please do not remove problem tags without checking if the license is present. Jarekt (talk) 12:16, 3 December 2014 (UTC)

✓ DoneUser: Perhelion (Commons: = crap?)  09:38, 22 August 2015 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

date format

@Steinsplitter, Rillke, and Jarekt: I noticed the script adds OTRS received tags with double-digit numbers on single-digit days whereas the matching cat uses only one digit. See image and proper cat/ wrong cat. May originate in a problem of {{OTRS received}}. Please fix. --Denniss (talk) 08:26, 19 August 2015 (UTC)

{{Edit request}}

I can't say which is better, but here is the fix on line 96:
-'#time:d}}|user=' + user + '}}',
+'#time:j}}|user=' + user + '}}',  // day of the month, not zero-padded

mw:Help:Extension:ParserFunctions#.23timeUser: Perhelion (Commons: = crap?)  09:26, 22 August 2015 (UTC)

✓ Done Awesome! Thank you! Steinsplitter (talk) 11:01, 22 August 2015 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Missing parameter/line "Permission="

The following section was moved from Template talk:PermissionOTRS --Jarekt (talk) 12:47, 18 February 2016 (UTC)

Sometimes the parameter "Permission=" is missing in the {{Information}} template, and when it happens it cause a problem and we have to check what was the problem. Is it possible to change the gadget to add the line automatically when this line is missing? -- Geagea (talk) 12:40, 18 February 2016 (UTC) {{Edit request}}

OK hereUser: Perhelion 04:51, 19 February 2016 (UTC)
✓ Done--Jarekt (talk) 05:10, 19 February 2016 (UTC)
@Jarekt Thank you (I thought not you will be so quick). I've added still also a bit more flexible code to cover more possibilities.User: Perhelion 05:54, 19 February 2016 (UTC)
Thanks Perhelion and Jarekt for the quick response. -- Geagea (talk) 07:31, 19 February 2016 (UTC)
I updated it to revision 05:47, 19 February 2016. --Jarekt (talk) 12:59, 19 February 2016 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Not working for me

I enabled the gadget but it doesn't appear to be working for me. What might I be doing wrong? Rrburke (talk) 17:25, 7 April 2016 (UTC)

@Rrburke: Please elaborate what exactly is not working. --Steinsplitter (talk) 18:15, 7 April 2016 (UTC)
@Steinsplitter: Yes, I could've been more specific! In fact, it is working now. Thanks. Rrburke (talk) 09:41, 8 April 2016 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Feature prefill

As I see now (as user) it would be useful to implement an "prefill" feature for the PermissionOTRS|id (if id OTRSreceived present)!? User: Perhelion 14:29, 22 April 2016 (UTC) {{Edit request}}

✓ Done Here is a version with the feature added (the input is also a bit more tolerant, "Ticket#" or "#" as prefix is also accepted - for easier c&p). User: Perhelion 01:15, 24 April 2016 (UTC)
+1 Another feature added, only add the addPortletLinks if needed (no OTRS templates present, as the tool-list is sometimes very long). I added also as minimum an usergroup "autoconfirmed", should there be not an higher group? User: Perhelion 13:06, 24 April 2016 (UTC)
✓ Done Awesome! Thank you! Steinsplitter (talk) 16:52, 24 April 2016 (UTC)

I mean we should restrict this gadget to OTRS-members only!? User: Perhelion 10:03, 30 April 2016 (UTC) {{Edit request}}

Error: Here is the FIX for the current version, SORRY! User: Perhelion 14:00, 24 May 2016 (UTC)
✓ Done Awesome! Thank you! Steinsplitter (talk) 14:07, 24 May 2016 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

remove entire nxd line

I just noticed (again) that this (very useful) script leaves behind an empty line when removing nxd tags (example). Could this be fixed? Ping Perhelion. P.S.: Return-key-to-submit would be very nice to have as well.    FDMS  4    18:44, 11 October 2016 (UTC) {{Edit request}}

Indeed, here is the fix with some more improvements. Thanks for report. User: Perhelion 21:45, 11 October 2016 (UTC)
✓ Done Awesome! Thank you! Steinsplitter (talk) 17:20, 15 October 2016 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Options

Per @BU Rob13: on my talk page, is there a way we could have an option for reasons for the OTRS received template? Thanks. MCMLXXXIX 13:45, 6 December 2016 (UTC)

This would be ideal, yes. So far, I've just been manually editing the page as necessary to include the reason. ~ Rob13Talk 21:24, 6 December 2016 (UTC)
I don't see the need and we shouldn't encourage OTRS member to post internal data onwiki. --Steinsplitter (talk) 12:14, 16 December 2016 (UTC)
The "reason" parameter in the {{OTRS received}} template should be removed then. --Thibaut120094 (talk) 12:26, 16 December 2016 (UTC)
@BU Rob13: Objections? MCMLXXXIX 15:07, 16 December 2016 (UTC)
@Steinsplitter: Sorry if the original reference to "reasons" was confusing, but this is a specific parameter in the {{OTRS received}} template, not a generic reason field. At least the first toggle option should certainly remain, which just allows us to note that the ticket is received but not yet processed, as opposed to processed and deemed insufficient. This is important to determine when the clock starts for permission-based deletion. I would support removing the 2 and 3 options currently in the template, as they probably do involve unnecessarily releasing information, but removing the first option would be a very large change. I should note that I've only ever seen the first option used. ~ Rob13Talk 07:42, 17 December 2016 (UTC)
I would also be interested to switch between the three reasons easily (for example by having a select-box above the ticket number field), since I am using this parameter quite often (especially for the `processing`-tag) --AntonierCH (d) 10:49, 4 June 2017 (UTC)


Edit suggestion for "processing"

{{Editprotected}}

Hello,

To follow-up on the discussion above, I have tweaked the script for my own use. Maybe you would like to include this directly in the script ?

Add at line 128 :

var OTRSprocessing = function OTRSprocessing() {
	_addPermission('{{OTRS received|id=' + ticket +
		'|year={{subst:' +
		'#time:Y}}|month={{subst:' +
		'#time:F}}|day={{subst:' +
		'#time:j}}|reason=processing|user=' + user + '}}',
		'email received but not processed yet');
};


Then, replace at the end :

		if (!bReceive)
			$( mw.util.addPortletLink('p-tb', '#', 'OTRS received') )
			.click( function ( e ) { dialogOTRS( e, OTRSreceived ); } );

by :

		if (!bReceive) {
			$( mw.util.addPortletLink('p-tb', '#', 'OTRS received') )
			.click( function ( e ) { dialogOTRS( e, OTRSreceived ); } );
			
			$( mw.util.addPortletLink('p-tb', '#', 'OTRS processing') )
			.click( function ( e ) { dialogOTRS( e, OTRSprocessing ); } );
		}


This would add the "OTRS processing" link below the "OTRS received".

Best regards

--AntonierCH (d) 11:08, 4 June 2017 (UTC)

Hello AntonierCH, please describe more concrete why you mean this changes are necessary. The function seams redundant. I would rather implement the reason param to the existing function as check option with drop-down selection!? -- User: Perhelion 11:52, 4 June 2017 (UTC)
Hello Perhelion, you are right and this was my suggestion, but I do not have the time (and maybe/probably the skills) to implement a dropdown directly in the OTRS received message box. Maybe someone around here can do it better than me? --AntonierCH (d) 09:40, 5 June 2017 (UTC)
✓ Done Hey AntonierCH, I've created this feature, you can test/copy it here. If tested successful give a short feedback. :-) -- User: Perhelion 14:47, 7 June 2017 (UTC)
Wow ! This looks great, thx a lot Perhelion. I tested it once, and it looks alright. :-) --AntonierCH (d) 15:25, 7 June 2017 (UTC)
✓ Done Thx you too (it was untested but I tested it now too. You can clean your common.js again :P). -- User: Perhelion 19:13, 7 June 2017 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Template in comment

Hello! Would it be possible that the gadget delete {{PermissionOTRS}} (and its aliases) if it is between <!-- --> tag (example)? It would be very useful. Thanks! Bencemac (talk) 12:19, 1 July 2018 (UTC)

✓ Done Thank you! -- User: Perhelion 14:25, 1 July 2018 (UTC)
Thank you very much! Bencemac (talk) 14:28, 1 July 2018 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

DR template should stay

{{Editprotected}} Speedy may be removed or not - I'm not sure about this, but DR does not automatically close per OTRS ticket. (I'm referring to edits like this.) — regards, Revi 11:00, 13 August 2018 (UTC)

True, I often have to add it back myself. Adding an OTRS permission should not be an automatic solution to keep a file and the DR process should remain unchanged. An admin still has to assess if the file with the permission is in the scope of the project for example. --AntonierCH (d) 17:17, 13 August 2018 (UTC)
@Perhelion, AntonierCH, and -revi: When tagging PermissionOTRS, every tag that could result in deletion other than a DR should be removed. This includes: copyvio; expanded nsd, npd, and nld; duplicate; speedy; and their aliases. You could even have the gadget post to the existing DR "I have just accepted permission for File:Example.jpg under Ticket:n and tagged it as such." with sig.   — Jeff G. ツ please ping or talk to me 15:32, 16 August 2018 (UTC)
Good idea. ✓ Done main update. The auto. post on DR could be good. I think I will implement this in the next version. -- User: Perhelion 23:11, 16 August 2018 (UTC)
@Jeff G., AntonierCH, and -revi: ✓ Done New feature auto. report implemented if on DR. Please report if successful (as I'm currently not OTRS member). -- User: Perhelion 18:04, 24 August 2018 (UTC)
Seems fine.[2][3] -- User: Perhelion 22:27, 8 September 2018 (UTC)
And it looks great, thank you all for the suggestions, definitely a great improvement. --AntonierCH (d) 09:13, 9 September 2018 (UTC)
@Perhelion: Excellent, I like what you did with the logo in the DR!   — Jeff G. ツ please ping or talk to me 15:20, 10 September 2018 (UTC)

Perhelion : Unfortunately, I have the folowing error when trying to apply the info on a DR for File:Itineraire theatre noir Cover.jpg. Is it because the DR has another name?

Error!
There was an error processing your request. API-error-code: nocreate-missing Please try again.

--AntonierCH (d) 17:29, 14 October 2018 (UTC)

Fixed There was indeed a frivolous use of RegExp.lastMatch. :-o Thanks for report. -- User: Perhelion 21:42, 14 October 2018 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

You are not authorized for this function

{{Editprotected}} I receive the following message when I click on "Permission OTRS" or "OTRS received" links on the left menu: "OTRS fail! You are not authorized for this function!" I have noticed that OTRS-member has recently been changed to otrs-member (all lowercase). See Phab:T202095 for details. I think this gadget should be updated accordingly in order to work fine again. Thank you. 4nn1l2 (talk) 06:31, 18 August 2018 (UTC)

✓ Done Thank you! -- User: Perhelion 14:42, 18 August 2018 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Has "OTRS received" changed?

On clicking the OTRS received in the left column, I get the pop-up, but now only asks me for a ticket number. There is no sub menu to add the "reason" parameter. Has that been removed, or is it my PC? Ronhjones  (Talk) 17:23, 18 October 2018 (UTC)

Fixed oh* indeed. -- User: Perhelion 10:09, 19 October 2018 (UTC)
Thanks Ronhjones  (Talk) 13:41, 19 October 2018 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 12:54, 17 December 2020 (UTC)

Delete template

Hi,

The gadget shouldn't be removing the {{Delete}} template (like here or here) when adding an OTRS ticket...

Regards. --Thibaut120094 (talk) 15:10, 29 October 2016 (UTC)

@Steinsplitter, Rillke: Hi, do you think you can fix this? --Thibaut120094 (talk) 00:23, 3 November 2016 (UTC)
@Thibaut120094: I don't know why this "cleanup" is in, you can simply comment out line 136: //.replace(/\{\{[Dd]elete[^\}\n]*\}\}\s?/g, '') User: Perhelion 13:59, 3 November 2016 (UTC)
PS: But maybe we can add an message to the open DR!? If yes I could add such function. User: Perhelion 16:19, 3 November 2016 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 13:25, 26 December 2020 (UTC)

More cleanup (edit request)

{{Edit request}} Please add/replace:

-.replace(/\[\[[Cc]ategory\:(u|U)ploaded[ _]with[ _]UploadWizard\]\]\n/g, '')
+.replace(/\{\{PermissionOTRS\|id=\d{16}\|[^\}\n]*\}\}/, '')

to the function _cleanUp, as it may sometimes could be a wrong/double template present e.q. PS: The UploadWizard Cat does not exists anymore. -- User: Perhelion 14:26, 16 May 2017 (UTC)

In old files there is still the cat in so we should keep that i think. --Steinsplitter (talk) 14:58, 16 May 2017 (UTC)
There are no more files on Category:Uploaded with UploadWizard :-P (Or you mean un-purged files from somewhere) Anyway it was only intended for speed up the elimination of this Cat, this OTRS script is not intended to be cleanup generally things. Kind regards PS: On the other hand we may could add a general cleanup-script like User:Perhelion/cleanup.js. ;-) -- User: Perhelion 23:44, 16 May 2017 (UTC)
I break my request for now, because the regexp need more specific the exact ticket number, as some files have double tickets. -- User: Perhelion 00:32, 17 May 2017 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. whym (talk) 13:25, 26 December 2020 (UTC)

Add P6305 SDC statement

{{Edit request}} Many files on Commons store OTRS number in {{Permission OTRS}} and in Wikimedia VRTS ticket number (P6305) Structured Data on Commons property. Eventually all files with OTRS permission should use P6305, so we can create proper SPARQL queries related to OTRS. Since many of {{Permission OTRS}} templates are added using this gadget. It would be great if this gadget could also add Wikimedia VRTS ticket number (P6305) Structured Data on Commons property. Could someone who speaks javascript add this feature? I handle a lot of Edit request but unfortunately I do not know javascript. --Jarekt (talk) 14:26, 8 May 2020 (UTC)

Pinging all interface admins: @-revi, 4nn1l2, Ahmad252, Didym, Ebrahim, FDMS4, Guanaco, Hedwig in Washington, and Jean-Frédéric: @Kaldari, King of Hearts, Krd, Kwj2772, Lucas Werkmeister, Magog the Ogre, Mike Peel, Multichill, Perhelion, and Putnik: @RP88, Raymond, Srittau, Steinsplitter, Thibaut120094, Ymblanter, and ~riley: . Could one of you help with this javacode? User:Magnus Manske/sdc tool.js is an example .js code which adds SDC statements to files. --Jarekt (talk) 16:33, 19 June 2020 (UTC)
Sorry Jarekt, no JS too :-( Raymond 18:46, 19 June 2020 (UTC)
I'm willing to do it, but I'm not an OTRS volunteer so the necessary testing by me would presumably trigger the abuse filter that is supposed to warn about non-OTRS members adding {{Permission OTRS}} to files. Many of the other interface admin are also OTRS volunteers, so it would be better if one of them took care if this. I'll give them time to reply to see if one of them is willing, but I'll check back, and if no one else will do it I'll give it a shot (I do have permission to alter abuse filters — so presumably I could add myself as a temporary exception to the filter as long as I first explained what I was doing.) —RP88 (talk) 22:01, 19 June 2020 (UTC)
RP88 I would not worry about trigger the abuse filters. If you add OTRS and then revert, I do not think anybody will mind, I can also test it for you, if that helps. --Jarekt (talk) 02:16, 20 June 2020 (UTC)
@Jarekt: I completely agree, but that is not what {{Edit request}} is for. A change to the code should be prepared and tested in a sandbox. When ready an interface admin can deploy it here. Code from User:Magnus Manske/sdc tool.js can probably be used, but d:MediaWiki:AddQuickClaim.js is probably a lot easier. Multichill (talk) 19:17, 20 June 2020 (UTC)
Multichill, I agree, it is just that I never learned how to code in javascript, so I was looking for someone that knows the language to do this task, I can help but I do not know much about it. I created phabricator:T252300 and left a note here, but just can not find any javascript coders interested in taking on this task. --Jarekt (talk) 02:11, 21 June 2020 (UTC)
 Agree we should do 2 edits --Jarekt (talk) 12:45, 5 August 2020 (UTC)
Closing as resolved with #Add P6305 SDC statement (part 2). 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 22:43, 4 June 2021 (UTC)
This section was archived on a request by: 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 22:43, 4 June 2021 (UTC)

Add P6305 SDC statement (part 2)

After previous discussion above and after dropping a note at Wikipedia:User_scripts/Requests#help_needed_with_high_use_gadget_on_Commons, User:Majavah picked up the challenge and 1.5 hours later posted at commons Beta revised java script code (Great thanks again!). I imported it to User:Jarekt/Gadget-PermissionOTRS.js and was testing it, and it seems to work fine. I will test it a bit more, but unless there are any objections I will deploy this version in a day or two. Pinging @Perhelion, Krd, Steinsplitter, King of Hearts, and ~riley: interface admins with OTRS rights, in case others are willing to test or review the code. Once can see the diff here. --Jarekt (talk) 03:07, 16 December 2020 (UTC)

@Jarekt: Please also include this revision which fixes the SDC link on the edit summary (or change it to something completely else).  Majavah (t/c) 06:12, 16 December 2020 (UTC)
Looks good to me! ~riley (talk) 15:02, 16 December 2020 (UTC)
+1. Thank you :)--Steinsplitter (talk) 16:22, 16 December 2020 (UTC)

Gadget disappearance

This section was archived on a request by: 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 22:43, 4 June 2021 (UTC)

Underscores

{{Editprotected}} Does the filename mentioned in this edit have to have underscores in it? Please stop including them in such edits made by the script.   — Jeff G. please ping or talk to me 21:54, 7 February 2021 (UTC)

✓ Done --Lucas Werkmeister (talk) 22:18, 17 February 2021 (UTC)
@Lucas Werkmeister: Thanks!   — Jeff G. please ping or talk to me 07:33, 18 February 2021 (UTC)
This section was archived on a request by: 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 22:44, 4 June 2021 (UTC)