Jump to content

Extension:Thanks

From mediawiki.org
This extension comes with MediaWiki 1.40 and above. Thus you do not have to download it again. However, you still need to follow the other instructions provided.
MediaWiki extensions manual
Thanks
Release status: stable
Implementation User interface
Description Lets users thank other users for individual edits etc.
Author(s)
Latest version 1.2.0 (Continuous updates)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki >= 1.43
License MIT License
Download
  • $wgThanksAllowedLogTypes
  • $wgThanksConfirmationRequired
  • $wgThanksLogging
  • $wgThanksSendToBots
Quarterly downloads 22 (Ranked 113rd)
Public wikis using 2,442 (Ranked 193rd)
Translate the Thanks extension if it is available at translatewiki.net
Vagrant role echo
Issues Open tasks · Report a bug

The Thanks extension adds a quick way to give positive feedback for productive contributions to MediaWiki sites. It allows users to send public 'thank you' notifications (via Echo ) to other users for their individual edits and some logged actions.

The specific revision that is being "thanked" for is not stored in the public logging table. Only the timestamp, sender, and recipient, are publicly logged.

A 'thank' link is added in the following places:

  • next to the 'undo' link in history and diff views;
  • on some log entries on Special:Log (see #Configuration, below); and
  • to Flow board comments if Flow is installed.

It also provides an API for sending thanks.

Note that if you do not want to be thanked, you can easily disable this notification in your preferences, as described below.

Example of a 'thanks' notification

Once you have had a chance to try it out, we welcome your feedback about this feature on the talk page.

We hope that the Thanks notification will make it easier to show appreciation for each other's work – and it should be particularly helpful for encouraging new users during their first critical steps on a wiki. We have intentionally kept this notification as simple as possible, so we can evaluate it and improve it together. Enjoy…

Installation

[edit]
Thanks requires the Echo extension be installed as a prerequisite.
  • Download and move the extracted Thanks folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'Thanks' );
    
  • If necessary configure at your convenience
  • Go to the History action of a page to see the new "Thank" interface.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

[edit]

Enable the Thank interface for bot edits (disabled by default)

$wgThanksSendToBots = false;

Log Thank actions to "Special:Log" (enabled by default)

$wgThanksLogging = true;

Whether or not confirmation is required for sending thanks (enabled by default)

$wgThanksConfirmationRequired = true;

Log entry types that can be thanked from Special:Log:

$wgThanksAllowedLogTypes = [
	"contentmodel",
	"delete",
	"import",
	"merge",
	"move",
	"patrol",
	"protect",
	"tag",
	"managetags",
	"rights"
];

Usage

[edit]

To thank another user, go to the History tab of any page. Next to each revision will be a 'thank' link. Click the link to send thanks to that user. This link is also available in the diff view, on some entries in Special:Log, and below comments on Flow boards if Flow is installed.

When the thank link is clicked, the recipient will receive a notification with your thanks via the Echo extension (unless they have opted out of receiving thanks notifications). A record of the action is also recorded as a log entry at Special:Log/thanks.

If the wiki is using memcached, a rate limit is imposed of no more than 10 thanks per minute per user. The limit can be configured with $wgRateLimits ['thanks-notification'].

Avoiding thanks

[edit]

To stop getting thanks notifications, you can opt out from them in your notification preferences. Go to the Notifications tab of your preferences. This only prevents you from getting notified, it does not prevent users from thanking you.

API documentation

[edit]

The Thanks extension includes an API for sending thanks. In order to call the API, use the parameter action=thank.

Parameters:

  • rev - The revision ID you would like to thank someone for (either this or log is required)
  • log - The log ID you would like to thank someone for (either this or rev is required)
  • source - Source of the thank event. This is a short string that identifies where the thanks was sent from. For example, if the thanks was sent from Huggle, the value could be 'huggle'. (optional)
  • token - Edit token (a.k.a. CSRF token). You can get one of these through the tokens API. (required)

Example:

 api.php?action=thank&rev=16543&token=%2B\

To send thanks via OAuth only the "Basic" grant permission is required. A python example is available.

Flow Thanks

[edit]

There is a separate API for sending Thanks for comments on Flow boards. To call the API, use action=flowthank.

Parameters:

  • postid - The UUID of the comment for which to send thanks (required)
  • token - Edit token. You can get one of these through prop=info. (required)

Example:

 api.php?action=flowthank&postid=abc123&token=%2B\

Errors and Warnings

[edit]
Code Info
invalidrecipient No valid recipient found
Bots cannot be thanked
You cannot thank yourself

SQL Documentation

[edit]

Understanding who thanked who from the logs requires some understanding of the columns. Within the logging table, the log_title represents the receiver, and the log_user_text represents the sender.

The following SQL which finds all the thanks a receiver received within a time period illustrates this:

select log_timestamp as thank_timestamp,
  replace(log_title, '_', ' ') as receiver,
  log_user_text as sender
from logging_logindex
where log_title = :user_name
  and log_action = 'thank'
  and :start_date <= log_timestamp
  and log_timestamp <= :end_date

Notice also that the logging table is not selected from directly, but on Wikimedia servers we take advantage of the logging_logindex table. In order to quickly search for all the thanks a user sent the logging_userindex provides the correct index.


See also

[edit]