Skip to content
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: fix bug when there are no available tags #732

Merged

Conversation

Amorymeltzer
Copy link
Collaborator

If there are no available tags (all are already present or none provided) the module would die when trying to untag (like a printer low on cyan). This is incredibly unlikely on enwiki, but I can theoretically imagine other wikis with fewer maintenance templates might run into an issue where all available templates are already transcluded. Reported on my testwiki talk.


I spent some time delving into other tightenings when the various tag objects were empty or emptied, but it's only partially doable without some major restructuring, and I'm not sure it's even a good idea.

If there are no available tags (all are already present or none provided) the module would die when trying to untag (like a printer low on cyan).  This is incredibly unlikely on enwiki, but I can theoretically imagine other wikis with fewer maintenance templates might run into an issue where all available templates are already transcluded.  Reported [on my testwiki talk](https://test.wikipedia.org/w/index.php?title=User_talk:Amorymeltzer&oldid=405366).
@siddharthvp
Copy link
Member

siddharthvp commented Oct 24, 2019

A more elegant long-term solution, I believe, is to make Morebits.quickForm.getElements and HTMLFormElement.prototype.getChecked and the like return an empty array if there is nothing to be returned. This is more intuitive, removes the need to write such special cases, and is the model followed by jQuery. This would not break any existing code (it just renders a if condition useless, in case anyone is using).

@Amorymeltzer Amorymeltzer merged commit a1b9ea2 into wikimedia-gadgets:master Nov 12, 2019
@Amorymeltzer Amorymeltzer deleted the tag-tagpocalypse branch November 12, 2019 02:05
@Amorymeltzer
Copy link
Collaborator Author

Yeah — intuitively that makes sense, not sure why null was chosen? I suppose it's strictly more "correct" in some view? I haven't looked at what/where that would require changing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants