-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tag: Add untag functionality #485
tag: Add untag functionality #485
Conversation
174b6f0
to
47be16b
Compare
…article.removeTag function
47be16b
to
95eac79
Compare
fd21791
to
281da19
Compare
handle the special case for {{globalize}} tag, minor code cleanup elsewhere
281da19
to
804cef8
Compare
tagging. Also changed the code structure in Twinkle.tag.callbacks.article
42f7bc4
to
caa078c
Compare
I've just added the feature to group existing tags into the MI template. Closes the antique issue #13. All the changes have been extensively tested (I've raked up my enwiki userspace edit count by quite a bit). This is a gonna be very useful, so can someone review this? I have also updated the testing version at User:SD0001/friendlytag.js; also wrapped its contents into a 1-second |
removals to process simultaneously
ones listed in Twinkle, provided that the template has the correct |name= set
and redirect tags as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to start reviewing this (and the others), but it's very hard to go through something with a dozen listed commits, some of which appear unrelated to the task and some which could've been squashed, without at least some more guidance on what you're trying to do and where. You've got merge conflicts from your last changes to the tag module, are you planning on revisiting these?
Thank you for reviewing this. Given the extent of changes (the I have resolved the merge conflicts (though unfortunately have not tested after doing this). |
Oof, yeah. I've held off looking at #487 and #488 with the idea to do all your tag-related things in order to avoid extra work on your part, but looking at them now, it seems that isn't the case. As far as I can tell from a quick look, those are each going to have a ton of conflicts with this; in fact, it seems it'd be easier to layer this on top of those rather than the other way around? There are some other changes I've held off with the intent of getting through these, but I'd like to. I'm a bit busy this coming week but I will try to review #487 and #488 within the next 10 days or two, with the goal of getting those and #541 and #536 merged (I'm personally opposed to #488 but I think I'm in the minority there) before the next on-wiki update (early April). After that, the decks should be cleared tag-wise, so then if you can deal with the inevitable merge conflicts here, I'll take the time to go through this with the care it deserves. How does this sound for a plan forward? |
Ugh, one more thing: Also, |
Moved translationListPage into callbacks.article, within pntPage.load(...) fwiw also moved
Actually, this isn't the case. Tags can be removed as long as the "Template:" + ambox class name is same as the template page name, or redirects to it. The capitalisation/correctness of the templates listed has no role to play in removing. That being said, there was no reason to make tags uppercase at the end of the day. Self-trout. Let me see if I have time to revert it back to the good old lowercase. |
move multipleIssuesException to below article tags list, some comment changes, other minor fixes
I was nearly three-fourths my way towards converting everything back to ucfirst, when I realised that keeping them ucfirst has an advantage -- it leads to better consistency! If we list available tags as lcfirst, it makes sense to list the already present tags too in lcfirst form. But the trouble is that all tag templates have their |name= param in ucfirst form. We could easily convert them to lcfirst by using Simpler alternative is keep the tags in ucfirst form. Since I had already done most of the work in making them lcfirst and still have that work in git stash, @Amorymeltzer I will leave it to you to decide which way we go. I don't have a preference really. |
I won't be able to review until tomorrow, but wanted to reply to this to head-off confusion.
Where it does matter though (at least as of my last review) is in removing already-present templates from the addable list. That is, if I think what your latest comment is saying is that kind of agreed and thus went to try to undo (e.g. undoing the Cool? Sorry for the all the back-and-forth on this... |
@siddharthvp I can try and run this down tomorrow, but if you have a moment beforehand: there's a typeerror at L1583 ( |
Ooof, yeah! I had forgotten about that aspect. Sorry for causing the confusion, I had a good role to play in that :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What a slog!
@siddharthvp As far as I can see everything checks out, so if you've got nothing further, dare I say that we're all set? |
@Amorymeltzer Yes! |
💯 🏆 💯 Thanks for sticking with it so long! |
Great! This pull has been a great learning experience, at least in terms of JS programming. The functions for removing tags and re-placing tags into MI - I had written 3 times, each time discovering a superior programming technique, though the end result was the same. Thanks for reviewing this. So, you're going to deploy to the wiki now, or with the June update? |
I'll put it up in June. If you can think of good places to advertise this change, I think it'll be popular! |
… or {{merge from}} As reported at [WT:TW](https://en.wikipedia.org/w/index.php?oldid=918480329#Merge_tags), Twinkle has been leaving `{{merge}}` on the other page when tagging with `{{merge to}}` or `{{merge from}}` (rather than `{{merge from}}` or `{{merge to}}`, respectively). Stems from wikimedia-gadgets#485, where somewhere along the way the addition in [L1274](wikimedia-gadgets@95eac79#diff-03744d176dfd1e8a2178545886a87644R1606) at 95eac79 was removed but `params.mergeTag` remained. I've added the line back when validating the various merge tags, since we're already evaluating them all.
… or {{merge from}} As reported at [WT:TW](https://en.wikipedia.org/w/index.php?oldid=918480329#Merge_tags), Twinkle has been leaving `{{merge}}` on the other page when tagging with `{{merge to}}` or `{{merge from}}` (rather than `{{merge from}}` or `{{merge to}}`, respectively). Stems from wikimedia-gadgets#485, where somewhere along the way the addition in [L1274](wikimedia-gadgets@95eac79#diff-03744d176dfd1e8a2178545886a87644R1606) at 95eac79 was removed but `params.mergeTag` remained.
The code is quite complicated due to the asynchronicity of the API call to find the redirects to templates, whose main form wasn't found on the page.This required almost a overhaul ofTwinkle.tag.callbacks
. UPDATE: Code is now much simpler after I discovered that it's possible to get linkshere of multiple pages with a single API call.Since existing tags are detected by parsing the HTML code using jQuery, untagging is only supported if Tag module is invoked while viewing the current version (either in Read mode, or a diff involving the current version, or a permalink page to the current version).
New additions to Morebits.js:
HTMLFormElement.prototype.getUnchecked
- just a copy ofHTMLFormElement.prototype.getChecked
, but gives the unchecked checkboxes of a given name, rather than checked ones.Morebits.pageNameRegex
- given a stringfoobar
orFoobar
, returns[fF]oobar
, which can then be used to construct a regex expression.I will think about adding additional features later, like:
folding existing tags into {{multiple issues}} along with the tags being addedDoneTester-friendly version is at User:SD0001/friendlytag.js, which differs from the file here in that
lots of console.log'ssetTimeout
after page load to prevent crazy Morebits/Twinkle undefined errors