Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
74400b05
Commit
74400b05
authored
Sep 05, 2017
by
Matthew Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comments to redux methods
parent
23c40c8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
src/redux/messages.js
src/redux/messages.js
+32
-0
No files found.
src/redux/messages.js
View file @
74400b05
...
...
@@ -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
()
{
return
function
(
dispatch
)
{
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
)
{
return
function
(
dispatch
)
{
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
)
{
return
function
(
dispatch
)
{
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
)
{
return
function
(
dispatch
)
{
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
)
{
return
function
(
dispatch
)
{
api
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment