Last modified: 2013-04-22 16:16:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45270, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43270 - Add wgPostEdit as core JavaScript variable
Add wgPostEdit as core JavaScript variable
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.21.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Matthew Flaschen
: patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-19 19:03 UTC by Matthew Flaschen
Modified: 2013-04-22 16:16 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Matthew Flaschen 2012-12-19 19:03:15 UTC
I think it is worth adding a boolean variable wgPostEdit, which is true if and only if the user just saved the article.

Right now, this is implemented in https://www.mediawiki.org/wiki/Extension:PostEdit , but the real point of the extension is to show a visual notification.  Other extensions ideally shouldn't have to depend on all that just to get a boolean.  E3Experiments currently uses it implicitly (I will temporarily make it an explicit dependency), and I'm sure there are other extensions and gadgets that could use it.

It looks like this could maybe be implemented in attemptSave, but I'm open to suggestions.
Comment 1 Matthew Flaschen 2012-12-19 19:10:10 UTC
I mean "just saved a page", not specifically an article.
Comment 2 Matthew Flaschen 2013-02-19 23:26:15 UTC
GuidedTour also uses this.

I'm going to start implementing this.
Comment 3 Matthew Flaschen 2013-02-23 10:55:59 UTC
Initial version at https://gerrit.wikimedia.org/r/#/c/50480/, ready to start review.

It's basically similar to the Extension:PostEdit implementation of the variable.  However, it uses the revision ID to avoid conflicts even if you save the same article twice in close succession (e.g. two sections).

It also uses '/' for the path rather than exporting that.
Comment 4 Matthew Flaschen 2013-02-26 20:53:47 UTC
Merged
Comment 5 Matthew Flaschen 2013-03-03 03:18:19 UTC
I've documented this at https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific

The documentation notes that you should depend on 'mediawiki.action.view.postEdit'.  Even though the module will always be added on views, I believe this is necessary to avoid race conditions.

Loading the module when they did not just save should not cause problems.  I've just submitted https://gerrit.wikimedia.org/r/#/c/51885/ to guarantee the variable can never be set on a non-view.
Comment 6 Matthew Flaschen 2013-03-03 04:23:51 UTC
Merged by Ori.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links