Commit graph

26 commits

Author SHA1 Message Date
Sam Wilson 2e7e5e0190 Move classes to includes/ and rename some to match class names
For conformance to coding standards. This removes an exclusion
from the phpcs config.

Change-Id: I1481a3e7e68a81daf310ea3c7bf9dc48cdaf140b
2018-01-30 10:32:03 +08:00
Umherirrender 300920f35d Improve some parameter docs
Change-Id: I5b84aec326dad863af152e0b53dbd9f8f66e40d2
2017-09-24 21:54:35 +02:00
Brad Jorsch a9cbd9471b Update for API error i18n
See Iae0e2ce3. Since Thanks master requires core master, this just
depends on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Ib6e66f7e94c41b7a27fe867f079626ac0ade4f1b
2016-11-15 03:22:14 +00:00
Brad Jorsch 470eff1700 Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: Ibcbc065f09f863014389d3a28ca0ae9134c88f78
2016-09-20 15:32:20 -04:00
James D. Forrester 03b8f88fff build: Add doxygen, use composer for phpcs, make pass
Change-Id: I939d6f4d989cf21c0f817d262bf3e4acedcf2ffe
2016-04-25 15:42:04 +00:00
Kunal Mehta 956a476005 Use log_search to track already sent thanks
We currently use client-side storage to keep track of what revisions and
posts have already been thanked for. This is problematic because client-
side storage is not permanent, making it easy to send duplicate thanks
if you have logged out and in, or switched computers.

This starts storing new thanks in the log_search table, which is
designed for efficient querying of metadata associated with a specific
log entry. With this, we can easily check to see if a user has already
sent thanks for a specific revision.

The UX is a bit weird right now, we only check log_search when actually
sending thanks again, in which case the user thinks they have sent
thanks again, but no duplicate thanks is actually sent.

Bug: T88820
Bug: T53303
Change-Id: Iaf8cbe0776081dc69e82883d8727ba1cfe20e3e1
2015-06-16 11:52:34 -07:00
Brad Jorsch c03cea14c8 Update token handling for core API change
Core change I2793a3f2 changes API handling in a way that needs updates
to extensions for proper operation:
* needsToken() now returns a string
* Most custom token types are being replaced with a 'csrf' token (the
  former 'edit' token); any others need a new hook.
* All tokens must use a static salt. Compat with web UI using non-static
  tokens is supported and also serves to handle the now-deprecated token
  fetching.
* Documentation in getParamDescription() should return a string (not
  array) for 'token', as the signal to core that it should be replaced
  with a standardized message.

When compatibility with earlier versions of MediaWiki is no longer
maintained, the entry for 'token' from getAllowedParams() and
getParamDescription() may be removed, as may getTokenSalt(). This patch
leaves them in place.

Note this is intended to be compatible with earlier versions of
MediaWiki, and so should be safe to merge before the core change.

Change-Id: Ifb9a080f1ad7236127c61287d14ff4a465543e0f
2014-08-09 16:28:43 +01:00
wctaiwan 9a709e61b3 Refactor API code and fix invalid input handling
Simplify the code and add additional checks for invalid input.

Change-Id: Ic1fe978730af7715c72f58cd7af46ab753e614e8
2014-04-15 00:28:10 -04:00
wctaiwan 98726b568b Add "Thanks" for comments on Flow boards
bug: 61930
Change-Id: Id37a14e3c75c63419fc34e0b7c2e21f74b3fa875
Co-authored-by: Bencmq <bencmqwiki@gmail.com>
2014-03-14 11:03:11 +00:00
jenkins-bot 1a2fc5c7f1 Merge "Send Thanks log entries to UDP" 2014-01-27 19:22:26 +00:00
jenkins-bot 31437cf89d Merge "Add Special:Thanks as a non-JS fallback" 2013-12-19 05:43:11 +00:00
Matthew Flaschen 3b6d71ebb5 Fix broken notifications caused by invalid create parameters
Caused by 2e7c7d33d0

Bug: 58127
Change-Id: I883b8102ce023334b09d28d5620b050535818039
2013-12-06 17:13:54 -05:00
Kunal Mehta 06360b6d0d Add Special:Thanks as a non-JS fallback
If the user has JavaScript disabled, clicking
on "thank" will send the user to Special:Thanks
with the revision id already filled in. When
submitted, the form calls the API internally
and then shows the user an error or confirmation
message.

Special:Thanks is not a listed special page
since it's mainly intended as a fallback.

The API was modified to return the user name of the
editor who is being thanked if a new notification
was created.

Bug: 49161
Change-Id: I7ba4664b92bb0da425784350487ed0e7ca352b4e
2013-12-05 23:23:21 -08:00
Kunal Mehta 0172b6eb58 Send Thanks log entries to UDP
Change-Id: I57ff962f1f53b2236265381132c396fcd7ce8e20
2013-12-05 23:12:32 -08:00
theopolisme 72c0bf5d52 Perform checks before thanking via API
If the user attempts to thank an anonymous
user, a bot (when $wgThanksSendToBots is not true),
or him/herself, return an error. This is consistent
with the restrictions imposed in insertThankLink().

Bug: 56954
Change-Id: I9e8ae030a8ff1cc312bf98671e593c7367ca0ea2
2013-11-24 17:41:21 -06:00
addshore 2e7c7d33d0 Split Api Module into lovely small functions
Change-Id: I77abd54a50090229c7f3a3daa239bcb185702e46
2013-11-24 23:18:15 +00:00
jenkins-bot f9bbdd02c0 Merge "Mark ApiThank as requiring write" 2013-11-23 07:57:11 +00:00
Matthew Flaschen 491ab99c33 Mark ApiThank as requiring write
Change-Id: Ic6bc0ec65ed0b39114f12a41551c25898d784110
2013-11-23 02:47:54 -05:00
jenkins-bot 084bd53382 Merge "Only allow Thanks for public revisions" 2013-10-30 17:47:04 +00:00
Kunal Mehta 05c7f89a8e Only allow Thanks for public revisions
Bug: 54100
Change-Id: Ied2846076ecf86b7045563fe5f2b0c002bd42647
2013-10-26 20:18:04 -07:00
Kunal Mehta c597db50d9 Add API help url
Change-Id: I9886163ad2492a5030059d45853b15964279362a
2013-10-26 18:56:37 -07:00
bsitu 87d966806f (bug 51303) Do not send duplicate thanks notification
Change-Id: Ie3c31e4ce155541a6aa9b6feae433742be2967e8
2013-07-14 21:18:18 -07:00
ebernhardson a4cfb9ded6 Prevent short-term duplicate thanking
Thanked revision to be stored both server side in the session and client side
in a cookie.  Thanked revisions found in either storage solution will replace
their 'thank' link with the string 'thanked'.
Bug: 46690
Change-Id: I976cd8fbf00856c67b77daeb0d0a952efb371661
2013-04-28 22:58:28 -07:00
kaldari ec71096c1a Adding logging to Thanks extension
Change-Id: I6f58924ae9ec9f581434f9f183cf8842b6142159
2013-04-09 20:54:19 -07:00
kaldari e3a4b724c1 Adding some comments for the API
Adding .jshintrc file

Change-Id: Ib15a3b3ce2c37933b62ccb112a38b1d61051ca16
2013-04-05 17:36:31 -07:00
Kaldari bc369fdf85 Initial version of Thanks extension
See https://www.mediawiki.org/wiki/Extension:Thanks

Change-Id: Ic037f1fcde0f7fa10848c2ed8e31291ad022027d
2013-03-21 11:33:50 -07:00