r106059 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106058‎ | r106059 | r106060 >
Date:18:41, 13 December 2011
Author:neilk
Status:ok (Comments)
Tags:
Comment:
reverting r105766, does not work, also too hacky
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -89,18 +89,13 @@
9090 },
9191
9292 getLicenseWikiText: function() {
93 - var wikiText;
94 - // TODO: not nice to have 2 cases here and then have to insert the attribution field...
95 -
9693 if ( _this.showCustomDiv && this.licenseInput.getWikiText() !== '' ) {
97 - wikiText = this.licenseInput.getWikiText();
 94+ return this.licenseInput.getWikiText();
9895 }
9996 else {
100 - wikiText = '{{' + mw.UploadWizard.config.licensesOwnWork.filterTemplate
 97+ return '{{' + mw.UploadWizard.config.licensesOwnWork.filterTemplate
10198 + '|' + mw.UploadWizard.config.licensesOwnWork.defaults[0] + '}}';
10299 }
103 -
104 - return wikiText.slice( 0, -2 ) + '|attribution=' + this.getAuthorWikiText() + wikiText.slice( -2 );
105100 },
106101
107102 getSourceWikiText: function() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r106062merging extensions/VisualEditor....neilk18:47, 13 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105766bug 32794jeroendedauw17:45, 10 December 2011

Comments

#Comment by Jeroen De Dauw (talk | contribs)   18:49, 13 December 2011

Weird, I tested this and got the correct thing. Maybe I did not look closely enough at it though. Either way, easy to fix the off-by-one error.

It might be hacky, but considering there seems to be no sane way to place it in somewhere else either (I looked at it for over half an hour), I think it's still a good fix from a pragmatic perspective. Unless you know a better way of putting it in ofc.

#Comment by NeilK (talk | contribs)   19:52, 13 December 2011

Maybe instead of using blind offsets, you could use a regex. That would be less likely to fail.

Or, refactor it so that the other methods are returning a list of wikiText arguments, and then construct the template string at the last minute. That might be too much work though.

#Comment by Jeroen De Dauw (talk | contribs)   19:56, 13 December 2011

> Maybe instead of using blind offsets, you could use a regex. That would be less likely to fail.

So you'd be ok with this approach if I replace it by a regex?

> Or, refactor it so that the other methods are returning a list of wikiText arguments, and then construct the template string at the last minute. That might be too much work though.

I figured this would definitely be non-trivial to do, so yeah, it seems like to much work.

Status & tagging log