Commit graph

32 commits

Author SHA1 Message Date
Purodha
b121b6c1ba Add GENDER to rollback-success message
Bug: T141250
Change-Id: I99c2b5ad5594b25928ad5bfd3f3a36b19a2c041c
2017-02-22 21:11:29 +00:00
Timo Tijhof
f188c23ca8 RollbackAction: Allow 'from' to be an empty string
Fix regression from 9af38c046c, which made 'from' a required
non-empty parameter where previously an empty value was allowed.

The rollback links always include a 'from' parameter, but it is
set to an empty string by Revision::getUserText if the current
revision has its username hidden.

Test plan:
* Go to action=history, tick latest revision and "Change visibility".
* Tick "Editor's username" and apply the change.
* Hit "rollback" on the history page.
* Before: "missing parameter" error.
  After: Success.

Bug: T141985
Change-Id: I20d23e2aeec858f82231910c030c14ffa3af656f
2016-09-07 21:09:22 +00:00
Chad Horohoe
639a083d84 Rollback: Catch error when unable to load latest revision data
Ideally this never happens, but it can, so fail gracefully instead
of just throwing a 'call to a member function on non-object' message

Change-Id: Iac8be9c7994aa3e74ed3c0eecff211524037165e
2016-08-26 17:21:41 -07:00
Kunal Mehta
08179800cd RollbackAction: Don't return true, causes '1' to be output
Bug: T136375
Change-Id: Id994b7ee7044ce18cf245a219ba290970511ea0f
2016-05-27 16:12:58 -07:00
Krinkle
5391e328c2 Revert "RollbackAction: Implement AJAX interface and require POST"
This partially reverts commit 9af38c046c.

* The new JS modules continue to exist. While not used by default,
  the mediawiki.api.rollback may be used elsewhere by now.
  The mediawiki.page.rollback module may still be used on cached
  pages and should continue to work.

* The new API behaviour remains.

* To avoid breaking mid-air rollbacks again, the token remains
  the same (plain "rollback" salt). We're not re-introducing the
  web-specific salt again.

Bug: T136375
Change-Id: Iba17ce55ff9506e838bfc6e70ca280e5a20b77b6
2016-05-27 16:16:40 +00:00
Timo Tijhof
9af38c046c RollbackAction: Implement AJAX interface and require POST
Similar to WatchAction (converted in commit 77cdf1919).

* Make FormAction::getFormFields not abstract.
  In most cases this will just be an empty array.

* Convert RollbackAction from FormlessAction to FormAction and implement the
  required error handling scenarios (mostly moved out of from the old method, or
  duplicated from the WikiPage method where necessary).

* In most cases the in-between form is never used since a JavaScript handler
  takes over the link and uses the API over AJAX instead. In the no-js fallback
  (as well as for any existing tokenless rollback links) copy the GET parameters
  into the form for re-submission as POST (plus token, added by HTMLForm).

* Remove the distinction between WebUI and API tokens. This stronger token salt made it
  unnecessarily complex and was only there because it used GET until now. This streamlining of
  tokens matches what we already do for 'watch', 'edit', 'patrol' and other actions.

* Fix form submission bugs when 'from' query parameter is missing.

  - Ensure the required 'from' query parameter is present before showing a form.
    No need for the user to submit a form we know will fail.

  - Plain GET request to action=rollback (with no parameters) is now a 400 Bad Request
    instead of a form that would fail when submitted.

  - Submitting the form without 'form' field now correctly says why it failed.
    Previously it emitted a session error, which was a lie.

Bug: T88044
Change-Id: Ia457802fec2e90573c8e7d552bc1f3cee258f10b
2016-05-23 20:00:48 +01:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
543b063773 Distinguish read vs write mode Action classes
Bug: T123589
Change-Id: I3c8fab646d3bb8cd468e5b60c27f3c5d43f9f97c
2016-01-15 01:13:38 +00:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
jeroendedauw
f7a6a0c8f5 RollbackAction: Remove dead argument
Change-Id: Icd1584460e68422e50d4391bfbdf0d938ab1c1cf
2015-09-24 17:16:24 +00:00
Aaron Schulz
9bba2d169e Added wfTransactionalTimeLimit() method and applied it
* Potentially long running POST requests often use multiple transactions,
  talk to multiple services, or defer updates. Try to make sure they have
  a chance to complete all of the work. WMF already sets ignore_user_abort()
  across the board in config, but this applies it to key spots for all
  installs, in addition to bumping the time limit. 
* Eventually this can lower the need for high overall time limits.

Bug: T102890
Change-Id: I893ddd773064dcd63b5b24c84c6391974f4b5aee
2015-08-12 22:09:40 +00:00
Étienne Beaulé
b230bdce16 Create preference to watchlist pages after rollbacking
This change adds a  preference in the 'watchlist' section to
automatically watchlist a page after rollbacking.

The setting is only visible, if the user has the 'rollback'-right.
I have removed the watch reverts function per advice by Vogone.

Bug: 4488
Change-Id: I3aa831c9c04d627684641af0ca5a332795c87062
2014-07-30 21:51:41 +00:00
Siebrand Mazeland
8a096e3444 Random documentation tweaks
Change-Id: I57c3bde6551c14324cf34e4db003a319d6cebc47
2014-01-02 23:45:14 +01:00
Siebrand Mazeland
cb8a9bb78a Break long lines in Action classes
Fixes CodeSniffer errors and warnigs.

Change-Id: Ic9cf4b9c677b3168d7c9820e2694080907997ee3
2013-11-14 18:18:49 +00:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
umherirrender
1572841659 Simplify code for usertools in RollbackAction
Change-Id: Ib550084ca60f54a0c1b1a3d6479fba75bc4f22bf
2012-10-07 19:05:34 +02:00
daniel
425ae715aa Merge "Fix error display on failing rollback" into Wikidata 2012-08-29 10:02:26 +00:00
daniel
41842bc71b Fix error display on failing rollback
Rollback will now show the actual errors that caused it to fail,
instead of a misleading message about permissions.

Also, errores returned by WikiPage::doEditContent are now propagated
and shown.

Change-Id: I5a3f8cb7a0b881d07d52f63504dd3757192205a9
2012-08-27 21:40:03 +02:00
daniel
2bc191889a Fixing creation of DifferenceEninge
Creation of DifferenceEninge insteances was based on invalid assumptions
in several places.

Change-Id: Ib67ca893ea53a27d4ac7efd8a9ca0d3b2d93949f
2012-08-24 20:49:19 +02:00
Tim Starling
072416fa2d Fix indenting errors introduced in Wikidata branch
Change-Id: I487a0966a26359d4a6769331a6e2ee356eeb41db
2012-06-19 19:45:31 +10:00
daniel
02b78b2c15 renamed getDifferenceEngine to createDifferenceEngine 2012-04-17 21:02:03 +02:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
Daniel Kinzler
88f8ab8e90 use factory method to get difference engine everywhere 2012-04-04 19:59:46 +02:00
Alexandre Emsenhuber
95c35e5211 Use local context to get messages
Change-Id: Ic173f92f56f74261a34c896fbd1f45ec097129d6
2012-03-28 12:34:34 +02:00
Antoine Musso
93c314a3bb fix doc grouping for actions 2012-02-08 16:58:49 +00:00
Alexandre Emsenhuber
2b78de3f02 Made DifferenceEngine use a context instead of global variables and updaters calls to constructor in core 2011-11-10 13:06:52 +00:00
Alexandre Emsenhuber
f2d0453f9d * Made PermissionsError exception accept an optional second parameter for the description of the errors (as returned by Title::getUserPermissionsErrors())
* PermissionsError now calls OutputPage::showPermissionsErrorPage() to display the error (this is needed to make the item above work correctly)
* Removed the override of the HTML title in OutputPage::showPermissionsErrorPage() so that it shows "Permission errors - Sitename" instead of simply "Permission errors" for consistency with the other things
* Pass the error array returned by Title::getUserPermissionsErrors() to PermissionsError where available
* Converted direct calls to OutputPage::showPermissionsErrorPage() to throw an PermissionsError error instead
* Added 'action-rollback' message that will be displayed when accessing action=rollback without sufficient rights
* Changed getRestriction() in subclasses of Action to return null when they previously returned 'read' so that user rights can be check with Title::getUserPermissionsErrors()
* Reordered checks to do first user rights, then block (if needed) and finally read only (also if needed) so that users don't think the error is temporary when they both don't have right and the database is locked
2011-11-02 15:30:55 +00:00
Alexandre Emsenhuber
b212bace90 Per Nikerabbit's comment on r100621:
* Removed OutputPage::setPageTitleMsg() and OutputPage::setHTMLTitleMsg() and make OutputPage::setPageTitle() and OutputPage::setHTMLTitle() accept a Message object
* Updated core calls (including some that I missed last time because of non-matching case)
* Added Message::setContext() and use it in RequestContext so that I don't need to duplicate the call in OutputPage
* Yes, I'm calling $this->msg() on places and then setting the context one more time in OutputPage::setPageTitle() or OutputPage::setHTMLTitle(), but at least I won't be confused about which objects $
2011-10-27 20:23:16 +00:00
Alexandre Emsenhuber
ae45908c59 Added OutputPage::setPageTitleMsg() and OutputPage::setHTMLTitleMsg() as modified versions of OutputPage::setPageTitle() and OutputPage::setHTMLTitle() that take an message name and its parameters; updated all calls in core that can use the two new functions 2011-10-24 17:24:38 +00:00
Alexandre Emsenhuber
9e7167bbca * Use wfMessage() instead of OutputPage::addWikiMsgArray() with the third parameter
* In EditPage.php: call Linker methods statically
2011-07-16 19:19:01 +00:00
Alexandre Emsenhuber
18346994ca Moved action=rollback to an Action subclass 2011-07-02 13:46:56 +00:00