mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
add comments to redux methods
This commit is contained in:
parent
23c40c8f5e
commit
74400b0599
1 changed files with 32 additions and 0 deletions
|
@ -112,6 +112,10 @@ module.exports.setStatus = function (type, status){
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a request to mark one's unread messages count as cleared.
|
||||||
|
* @return {null} returns nothing
|
||||||
|
*/
|
||||||
module.exports.clearMessageCount = function () {
|
module.exports.clearMessageCount = function () {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch(module.exports.setStatus('CLEAR_STATUS', module.exports.Status.FETCHING));
|
dispatch(module.exports.setStatus('CLEAR_STATUS', module.exports.Status.FETCHING));
|
||||||
|
@ -136,6 +140,14 @@ module.exports.clearMessageCount = function () {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks an admin message as read, dismissing it from the page
|
||||||
|
* @param {string} messageType type of message to delete (invite or notification)
|
||||||
|
* @param {number} messageId id of the message to delete
|
||||||
|
* @param {number} messageCount current number of unread notifications
|
||||||
|
* @param {object[]} adminMessages current list of admin messages retrieved
|
||||||
|
* @return {null} returns nothing
|
||||||
|
*/
|
||||||
module.exports.clearAdminMessage = function (messageType, messageId, messageCount, adminMessages) {
|
module.exports.clearAdminMessage = function (messageType, messageId, messageCount, adminMessages) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch(module.exports.setStatus('CLEAR_STATUS', module.exports.Status.FETCHING));
|
dispatch(module.exports.setStatus('CLEAR_STATUS', module.exports.Status.FETCHING));
|
||||||
|
@ -181,6 +193,14 @@ module.exports.clearAdminMessage = function (messageType, messageId, messageCoun
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a user's messages to be displayed on the /messages page
|
||||||
|
* @param {string} username username of the user for whom the messages should be gotten
|
||||||
|
* @param {string} token the user's unique token for auth
|
||||||
|
* @param {object[]} messages an array of existing messages on the page, if there are any
|
||||||
|
* @param {number} offset offset of messages to get, based on the number retrieved already
|
||||||
|
* @return {null} returns nothing
|
||||||
|
*/
|
||||||
module.exports.getMessages = function (username, token, messages, offset) {
|
module.exports.getMessages = function (username, token, messages, offset) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch(module.exports.setStatus('MESSAGE_STATUS', module.exports.Status.FETCHING));
|
dispatch(module.exports.setStatus('MESSAGE_STATUS', module.exports.Status.FETCHING));
|
||||||
|
@ -206,6 +226,12 @@ module.exports.getMessages = function (username, token, messages, offset) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the messages from the Scratch Team for a user
|
||||||
|
* @param {string} username user's username for whom to get the admin messages
|
||||||
|
* @param {string} token the user's unique token for auth
|
||||||
|
* @return {null} returns nothing
|
||||||
|
*/
|
||||||
module.exports.getAdminMessages = function (username, token) {
|
module.exports.getAdminMessages = function (username, token) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch(module.exports.setStatus('ADMIN_STATUS', module.exports.Status.FETCHING));
|
dispatch(module.exports.setStatus('ADMIN_STATUS', module.exports.Status.FETCHING));
|
||||||
|
@ -231,6 +257,12 @@ module.exports.getAdminMessages = function (username, token) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the invitation to become a Scratcher for a user, if one exists
|
||||||
|
* @param {string} username user's username for whom to get the invite
|
||||||
|
* @param {string} token the user's unique token for auth
|
||||||
|
* @return {null} returns nothing
|
||||||
|
*/
|
||||||
module.exports.getScratcherInvite = function (username, token) {
|
module.exports.getScratcherInvite = function (username, token) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
api({
|
api({
|
||||||
|
|
Loading…
Reference in a new issue