Commit graph

37 commits

Author SHA1 Message Date
Fomafix 0307338213 Inject services into Hooks
Change-Id: I96b8c9a83a2ec1b3b517106530f9e68e35cc0c28
2024-07-27 07:45:38 +00:00
zoranzoki21 d1b64431e9 PHPCS: Fix all excluded rules
Change-Id: I525345c7be91e83c6050870613eb08a6e8763238
2024-06-04 10:04:30 +00:00
Umherirrender 88aa29cb72 Replace deprecated Http::get
Bug: T305813
Change-Id: Ief91d92c556244c36dfcec23f770319bd2f2c537
2022-12-11 14:18:17 +01:00
Jayprakash12345 37f46abdbb Use new Hook system
Change-Id: I9f45c6fafabe6d6f8dde7e894772d4f1b1c5bcd3
2021-12-04 19:18:52 +05:30
libraryupgrader 8e712c4e2a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I85d018a0837ca36a024187539bd334ffd99a2f4a
2021-07-22 15:33:56 +00:00
libraryupgrader 66ba87913d build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I11808cfb01de67037062e03f0db4268418e65b49
2021-05-04 03:05:13 +00:00
ZabeMath 80da86d44a Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I46dca703deb311d7c4e06b3001357fa602a40e0a
2021-04-14 00:46:28 +02:00
ZabeMath 7e23848ac9 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: I562b19ca41a7ef18be940ec398d58d6873b2555b
2021-03-30 20:31:57 +00:00
Ostrzyciel edd0a7d949 Move the warning outside sitenotice, tidy up code
There's a lot of things going on here, so a quick summary:
* Moved the warning outside sitenotice to avoid reflows and all
  kinds of other issues, including those with dismissable notices.
* Placed the warning on the bottom of the page, on all skins, for
  consistency and to avoid obstructing vital UI elements such as
  site name, user tools, search box.
* Changed the UI to use OOUI for, again, consistency and to avoid
  reinventing the wheel with button styling.
* Removed the cookie emoji as it was only taking up valuable space
  on mobile and making designing a sensible layout much harder.
* Merged the mobile and desktop RL modules into a single, responsive
  one. The warning will work correctly for any skin and screen width.
* The integration tests are truly horrible, I tried to at least
  make them work. They deserve a proper rewrite, but that should be
  done after the extension switches to the new hook system.

I will post screenshots of this in action in the first of the linked
tasks.

Bug: T271047
Bug: T173335
Change-Id: I6e2a3d7aeccc0d4df1b3238e52c67e72099d27d8
2021-02-01 11:23:53 +01:00
Paladox 0dc0e795a1 Replace deprecated hook
Bug: T254302
Change-Id: I140af90b5f175974eb20873f2c1c6449be5a6669
2020-11-22 15:48:59 +00:00
Umherirrender 1412b7c5ba Fix type on @param doc
Change-Id: I9caf576cd3c18b2af8313581d85608becfdacdf7
2020-07-12 01:39:52 +02:00
ankit 95f25aa2ed Bump MW version, remove deprecated IP class, update .gitignore
Bug: T247155
Change-Id: Idef39fd39dd8a9f3483ea30e4a01422923c16e05
2020-03-14 14:34:41 +05:30
Florian Schmidt 6634e8c829 Enable GeoLocation service being replaced by other providers
Making GeoLocation an interface makes it easier to replace the underlying implementation
from the current Http backed method.

Change-Id: I2beb97772fd74ab08b2214c08d82dbc1ebfcdcd2
2019-11-21 17:31:23 +01:00
Paladox 6ecc3fd4fc Fix tests to be compatible with master again
Also fix tests relying on MessageCache. MessageCache is enabled in setup,
however, as setMwGlobals is resetting services, it gets disabled again.
Instead of setting the configuration to enable the use of database
messages, let's enable the message cache after the last reset of services.

Change-Id: Iff670def50ab15054099f7a1ca3adc119bd877ce
2019-11-19 00:40:51 +01:00
Kunal Mehta fc561f35cc Don't double escape $moreLink
Html::element() automatically escapes all attribute values.

Spotted by the phan-taint-check-plugin.

Change-Id: Iad90d48ccba5b7008f5869c7c9f2b280400df749
2018-08-25 00:59:19 -07:00
Zoranzoki21 cfa56cdcb3 Fix 'Retrun' typo
Bug: T201491
Change-Id: I54ae64595d6ef393c60f112695d6d866b653c780
2018-08-14 09:40:40 +00:00
Fomafix 42fca811c6 Use \u{00A0} instead of   or  
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entitiy  .

Also use \u{1F36A} instead of 🍪 for Unicode Character 'COOKIE'
(U+1F36A).

Bug: T154300
Change-Id: I13536589a4c183215785fe3352f4fc081571451b
2018-08-10 20:58:11 +02:00
Florian Schmidt 7afcc5bfd7 Show cookiewarning banner if IP could not be located
If any error occured during locating the IP address, the extension should
assume, that the user is in a configured region and show the cookie warning,
if not already dismissed.

Bug: T200077
Change-Id: Ib7f0dd0a135071924281a576ab24887d5e226435
2018-07-20 14:22:47 +02:00
Florian Schmidt 90d2e58096 Move classes into CookieWarning namespace
This should make the code a bit more structured and easier to navigate
through. It also removes some lines from extension.json as the autoload
classes list is replaced by an autoload namespaces property.

This also changes the minimum requirement of MediaWiki to 1.31 for this
extension to work.

Change-Id: I249ccc3035297c99202a5f83fcc8d3fda68b682c
2018-07-19 12:57:52 +02:00
Florian Schmidt 6f519c9618 Add caching functionality for IP lookup
Instead of always looking up a single IP address, even for multiple
requests, cache the result of the first lookup. IP addresses usually
doesn't move that fast, caching the result should therefore be
reasonably ok.

Change-Id: Ice78ec08ff886e77c542a75086610498eaa6c6b4
2018-07-18 16:03:29 +02:00
Florian Schmidt fed15fd7a5 Refactor Hooks code and move it to separate services
This cleans up the hook file a lot and movesthe logic to seperate services
provided by MediaWikiServices. This also removes some setters and passed-
around variables and stuff. Also fixes the unit tests by not querying
external services anymore.

Change-Id: I0c3c0b7f2f5bd68aaad624e8e2dcad9bdcf97770
2018-07-18 12:59:17 +02:00
jdlrobson 60929abb69 Drop Minerva LESS dependency
* Instead of repeating CSS already in Minerva instead use an element
"banner-container" already in use by CentralNotice (given this is also a banner)
This removes the need for positioning styles at Minerva is delegated to handle that.
* Rewrite existing rules using mediawiki ui variables to make clearer line-height
relates to iconography

Bug: T140807
Change-Id: I1bd3fb164bbb7866e5d32367c66afae5c1933bcb
2018-05-19 11:51:16 +02:00
Fomafix eb27449d70 Fix phpcs exclude rules
Change-Id: Ia39e6189d666af7d6fe1ccd14e8e7cae277a4428
2018-03-30 22:59:10 +02:00
Umherirrender 547c1562c1 Improve some parameter docs
Change-Id: I8ee2396e6a804ab69965383a9ee6b30787c1f9af
2018-01-11 21:09:29 +01:00
Kunal Mehta 4242d63304 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Change-Id: Ibe364df6dc58c2bfb04fc6ac267e1a9fa89bc2f9
2017-06-19 19:40:07 -07:00
Florian Schmidt 9b342e875b Redesign mobile CookieWarning banner
Based on design input from Reading web team (Nirzar).

Bug: T146077
Change-Id: I99aa74842486c4c397462dd51f55c272ae17ad07
2017-01-11 23:06:25 +01:00
Florian Schmidt c35b78fae8 Add option to limit the cookie warning to specific regions
With this change, CookieWarning gets two new ways to limit the warning
bar to users of specific (configurable) regions. Based on the geo location
service (which can be configured, too, defaults to freegeoip.net), the
extension will try to get the region of the user (based on the IP address)
and checks it against the configured regions.

With the configuration variable $wgCookieWarningGeoIPLookup, the wiki sysadmin
can configure, if the lookup should be done with PHP (the timeout for the
request is hardcoded to 2 sedonds max), which will save the paylod sent to
the user, or with JavaScript, which will be asynchronous.

Deactivating this feature is easily done by simply setting the configured regions
to false, instead of an object.

Bug: T145780
Change-Id: I4d9371b8608ef270c11c42bdb3a773675977ab3a
2016-10-07 23:51:18 +02:00
Florian Schmidt 12137c66d8 Use short array syntax instead of array()
Change-Id: I22f24bf047ff8bb476000bfbf879cc7612c10c27
2016-09-18 00:36:56 +02:00
jenkins-bot 5dfb430f40 Merge "i18n: Make the OK button label translateable" 2016-09-17 22:25:29 +00:00
Florian Schmidt a6d1e1f11a i18n: Make the OK button label translateable
Change-Id: Idb7cb249b582f0bf15f1ea6ec1d0aece5c9efdc5
2016-09-18 00:24:17 +02:00
Paladox 828d31625c Fix tests
Change-Id: I761c8eea6c0ecc55f02ce86259c5afc83d6a96a9
2016-09-18 00:18:56 +02:00
Florian Schmidt b8686223e5 Allow non-JS users to dismiss the CookieWarning bar
This commit change sthe "OK"-link to dismiss the cookiewarning bar
from a link to a POST-based form, so that non-JS users are able to
click it, too. If clicked, the dismiss is saved int he user prefs
(if the user is logged in) or in a cookie.

The JS version still works without reloading the page.

Bug: T145647
Change-Id: I711413abcbc131aaba34e8b285630ef1a1c9bda1
2016-09-18 00:00:14 +02:00
Florian Schmidt dcebb9bb04 Add the possibility to edit the more information link on-wiki
Instead of just the configuration variable $wgCookieWarningMoreUrl,
CookirWarning now allows also to set the link on-wiki using the interface
message MediaWiki:Cookiewarning-more-link. It also "listens" for the
MediaWiki:Cookie-policy-link interface message, which is introduced by
Cookie Policy as a first step for merging these both extensions.

Bug: T145781
Change-Id: I818008b2da6d9acd4295857e2916cd1b4637bee9
2016-09-15 23:53:27 +02:00
Florian 97c134e397 Improve documentation of code and add test features (npm, composer)
Also: Add license (MIT).

Change-Id: Ia184b396b648ecb4ef30b40d13618e2ecf72294a
2016-01-10 19:31:07 +01:00
Florian e37bbc73cc Change de-Message, adjust mobile less and add url config option
de i18n message now represents the en translation. The mobile opacity
is now 1, instead of 0.85 from desktop (it covers text in mobile, which
makes it harder to read with the opacity).

The URL isn't hardcoded anymore, it now can be configured with a config
option.

Change-Id: I9a4e3eb40675496e9467ecee4307298d0542633e
2015-08-16 12:00:33 +02:00
Florian bc100e294d Show CookieWarning for mobile users and save setting to user
Enable the CookieWarning to be visible on a mobile device (bottom, instead of top).

Instead of only rely on cookies to save, that a user accepted that we use cookies,
save it as a user preference, too.

Change-Id: Ib03d5eafd4392d14315115c158b547b9e26a173c
2015-08-16 11:49:05 +02:00
Florian b60d6e857a Initial commit
Change-Id: I75ba290d33d981c1c3789868f4ac21916faabde0
2015-07-27 19:19:29 +02:00