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
de85a25d
Commit
de85a25d
authored
May 10, 2021
by
Eric Rosenbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use formatted messages for each activity notification
parent
1232f981
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
6 deletions
+135
-6
src/views/studio/l10n.json
src/views/studio/l10n.json
+7
-0
src/views/studio/studio-activity.jsx
src/views/studio/studio-activity.jsx
+128
-6
No files found.
src/views/studio/l10n.json
0 → 100644
View file @
de85a25d
{
"studio.activityAddProjectToStudio"
:
"{profileLink} added the project {projectLink}"
,
"studio.activityRemoveProjectStudio"
:
"{profileLink} removed the project {projectLink}"
,
"studio.activityUpdateStudio"
:
"{profileLink} made edits to the title, thumbnail, or description"
,
"studio.activityBecomeCurator"
:
"{promotedProfileLink} accepted an invitation from {promotorProfileLink} to curate this studio"
,
"studio.activityBecomeOwner"
:
"{promotedProfileLink} was promoted to manager by {promotorProfileLink}"
}
src/views/studio/studio-activity.jsx
View file @
de85a25d
import
React
,
{
useEffect
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
const
FormattedMessage
=
require
(
'
react-intl
'
).
FormattedMessage
;
import
{
connect
}
from
'
react-redux
'
;
import
{
useParams
}
from
'
react-router
'
;
...
...
@@ -12,6 +13,132 @@ import SocialMessage from '../../components/social-message/social-message.jsx';
import
'
./studio.scss
'
;
const
getComponentForItem
=
(
item
)
=>
{
switch
(
item
.
type
)
{
case
'
addprojecttostudio
'
:
return
(
<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
key=
{
item
.
id
}
>
<
FormattedMessage
id=
"studio.activityAddProjectToStudio"
values=
{
{
profileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
),
projectLink
:
(
<
a
href=
{
`/projects/${item.project_id}`
}
>
{
item
.
project_title
}
</
a
>
)
}
}
/>
</
SocialMessage
>
);
case
'
removeprojectstudio
'
:
return
(
<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
key=
{
item
.
id
}
>
<
FormattedMessage
id=
"studio.activityRemoveProjectStudio"
values=
{
{
profileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
),
projectLink
:
(
<
a
href=
{
`/projects/${item.project_id}`
}
>
{
item
.
project_title
}
</
a
>
)
}
}
/>
</
SocialMessage
>
);
case
'
updatestudio
'
:
return
(
<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
key=
{
item
.
id
}
>
<
FormattedMessage
id=
"studio.activityUpdateStudio"
values=
{
{
profileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
)
}
}
/>
</
SocialMessage
>
);
case
'
becomecurator
'
:
return
(
<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
key=
{
item
.
id
}
>
<
FormattedMessage
id=
"studio.activityBecomeCurator"
values=
{
{
promotedProfileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
),
promotorProfileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
)
}
}
/>
</
SocialMessage
>
);
case
'
becomeownerstudio
'
:
return
(
<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
key=
{
item
.
id
}
>
<
FormattedMessage
id=
"studio.activityBecomeOwner"
values=
{
{
promotedProfileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
),
promotorProfileLink
:
(
<
a
href=
{
`/users/${item.actor_id}`
}
>
username
</
a
>
)
}
}
/>
</
SocialMessage
>
);
default
:
return
(
<
SocialMessage
>
{
item
.
type
}
</
SocialMessage
>
)
}
};
const
StudioActivity
=
({
items
,
loading
,
error
,
onInitialLoad
})
=>
{
const
{
studioId
}
=
useParams
();
// Fetch the data if none has been loaded yet. This would run only once,
...
...
@@ -33,12 +160,7 @@ const StudioActivity = ({items, loading, error, onInitialLoad}) => {
className=
"studio-messages-list"
>
{
items
.
map
((
item
,
index
)
=>
(<
SocialMessage
datetime=
{
item
.
datetime_created
}
iconSrc=
"/svgs/messages/love.svg"
>
{
item
.
type
}
</
SocialMessage
>)
getComponentForItem
(
item
)
)
}
</
ul
>
</
div
>
...
...
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