Skip to content

Commit

Permalink
react/notifications: add project links in notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
sevfurneaux committed Mar 11, 2025
1 parent 5676265 commit e9d0f0a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion meinberlin/react/account/FeedItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function FeedItem ({ id, apiUrl, icon, title, thumbnail, body, me
<div className="feed-item__content">
<div className="feed-item__info">
<div>
<h3 className={classNames('feed-item__title', isRead && 'feed-item__title--read')}>{title}</h3>
<h3 className={classNames('feed-item__title', isRead && 'feed-item__title--read')} dangerouslySetInnerHTML={{ __html: title }} />
{meta.length > 0 && (
<ul className="feed-item__meta">
{meta.map((item, index) => (
Expand Down
24 changes: 12 additions & 12 deletions meinberlin/react/account/Notifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,29 @@ function getInteractionText (action, totalRatings) {
case 'mapidea':
if (actor.is_moderator) {
return {
title: notificationsData.interactions.moderatorReplieIdeaText(project.title),
title: notificationsData.interactions.moderatorReplieIdeaText(project.title, project.url),
body,
linkText: notificationsData.viewCommentText
}
}

return {
title: notificationsData.interactions.userRepliedIdeaText(project.title),
title: notificationsData.interactions.userRepliedIdeaText(project.title, project.url),
body,
linkText: notificationsData.viewCommentText
}

case 'comment':
if (actor.is_moderator) {
return {
title: notificationsData.interactions.moderatorRepliedCommentText(project.title),
title: notificationsData.interactions.moderatorRepliedCommentText(project.title, project.url),
body,
linkText: notificationsData.viewCommentText
}
}

return {
title: notificationsData.interactions.userRepliedCommentText(project.title),
title: notificationsData.interactions.userRepliedCommentText(project.title, project.url),
body,
linkText: notificationsData.viewCommentText
}
Expand All @@ -173,26 +173,26 @@ function getInteractionText (action, totalRatings) {
case 'mapidea':
if (totalRatings > 1) {
return {
title: notificationsData.interactions.usersRatedIdeaText(project.title),
title: notificationsData.interactions.usersRatedIdeaText(project.title, project.url),
linkText: notificationsData.viewIdeaText
}
}

return {
title: notificationsData.interactions.userRatedIdeaText(project.title),
title: notificationsData.interactions.userRatedIdeaText(project.title, project.url),
linkText: notificationsData.viewIdeaText
}

case 'comment':
if (totalRatings > 1) {
return {
title: notificationsData.interactions.usersRatedCommentText(project.title),
title: notificationsData.interactions.usersRatedCommentText(project.title, project.url),
linkText: notificationsData.viewIdeaText
}
}

return {
title: notificationsData.interactions.userRatedCommentText(project.title),
title: notificationsData.interactions.userRatedCommentText(project.title, project.url),
body,
linkText: notificationsData.viewCommentText
}
Expand All @@ -204,7 +204,7 @@ function getSearchProfileText (searchProfile, action) {
const { project } = action

return {
title: notificationsData.searchProfiles.projectMatchesSearchProfileText(project.title, searchProfile.name),
title: notificationsData.searchProfiles.projectMatchesSearchProfileText(project.title, project.url, searchProfile.name),
body: project.title,
linkText: notificationsData.viewProjectText
}
Expand All @@ -218,19 +218,19 @@ function getFollowedProjectsText (action) {
switch (type) {
case 'phase_started':
return {
title: notificationsData.followedProjects.phaseStartedText(project.title, date.toLocaleDateString()),
title: notificationsData.followedProjects.phaseStartedText(project.title, project.url, date.toLocaleDateString()),
linkText: notificationsData.viewProjectText
}

case 'phase_soon_over':
return {
title: notificationsData.followedProjects.phaseEndedText(project.title, date.toLocaleDateString()),
title: notificationsData.followedProjects.phaseEndedText(project.title, project.url, date.toLocaleDateString()),
linkText: notificationsData.viewProjectText
}

case 'offlineevent':
return {
title: notificationsData.followedProjects.offlineEvent(source, project.title, sourceDate.toLocaleString()),
title: notificationsData.followedProjects.offlineEvent(source, project.title, project.url, sourceDate.toLocaleString()),
linkText: notificationsData.viewProjectText
}
}
Expand Down
48 changes: 24 additions & 24 deletions meinberlin/react/account/notification_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,43 @@ export const notificationsData = {
'No reactions to your posts yet. Get involved to get reactions.'
),
buttonText: django.gettext('Find participation projects'),
moderatorReplieIdeaText: (title) => django.interpolate(
django.gettext('A moderator has responded to your idea in %(title)s'),
moderatorReplieIdeaText: (title, url) => django.interpolate(
django.gettext('A moderator has responded to your idea in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
userRepliedIdeaText: (title) => django.interpolate(
django.gettext('A user has replied to your idea in %(title)s'),
userRepliedIdeaText: (title, url) => django.interpolate(
django.gettext('A user has replied to your idea in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
moderatorRepliedCommentText: (title) => django.interpolate(
django.gettext('A moderator has responded to your comment in %(title)s'),
moderatorRepliedCommentText: (title, url) => django.interpolate(
django.gettext('A moderator has responded to your comment in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
userRepliedCommentText: (title) => django.interpolate(
django.gettext('A user has replied to your comment in %(title)s'),
userRepliedCommentText: (title, url) => django.interpolate(
django.gettext('A user has replied to your comment in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
usersRatedIdeaText: (title) => django.interpolate(
django.gettext('Users have rated your idea in %(title)s'),
usersRatedIdeaText: (title, url) => django.interpolate(
django.gettext('Users have rated your idea in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
userRatedIdeaText: (title) => django.interpolate(
django.gettext('A user has rated your idea in %(title)s'),
userRatedIdeaText: (title, url) => django.interpolate(
django.gettext('A user has rated your idea in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
usersRatedCommentText: (title) => django.interpolate(
django.gettext('Users have rated your comment in %(title)s'),
usersRatedCommentText: (title, url) => django.interpolate(
django.gettext('Users have rated your comment in <a href="' + url + '">%(title)s</a>'),
{ title },
true
),
userRatedCommentText: (title) => django.interpolate(
django.gettext('A user has rated your comment in %(title)s'),
userRatedCommentText: (title, url) => django.interpolate(
django.gettext('A user has rated your comment in <a href="' + url + '">%(title)s</a>'),
{ title },
true
)
Expand All @@ -60,8 +60,8 @@ export const notificationsData = {
'No results from your saved searches yet. Add new saved searches and wait for a matching project to be published.'
),
buttonText: django.gettext('Save a search'),
projectMatchesSearchProfileText: (title, name) => django.interpolate(
django.gettext('A new project, %(title)s, matches your search profile %(name)s'),
projectMatchesSearchProfileText: (title, url, name) => django.interpolate(
django.gettext('A new project, <a href="' + url + '">%(title)s</a>, matches your search profile %(name)s'),
{ title, name },
true
)
Expand All @@ -75,18 +75,18 @@ export const notificationsData = {
'No followed projects. Find projects to follow them.'
),
buttonText: django.gettext('Find projects'),
phaseStartedText: (title, date) => django.interpolate(
django.gettext('%(title)s is now open for participation. You can participate until %(date)s'),
phaseStartedText: (title, url, date) => django.interpolate(
django.gettext('<a href="' + url + '">%(title)s</a>. is now open for participation. You can participate until %(date)s'),
{ title, date },
true
),
phaseEndedText: (title, date) => django.interpolate(
django.gettext('%(title)s will end soon. You can still participate until %(date)s'),
phaseEndedText: (title, url, date) => django.interpolate(
django.gettext('<a href="' + url + '">%(title)s</a>. will end soon. You can still participate until %(date)s'),
{ title, date },
true
),
offlineEvent: (eventName, title, date) => django.interpolate(
django.gettext('The event %(eventName)s is coming up for the project %(title)s. It will take place on %(date)s'),
offlineEvent: (eventName, title, url, date) => django.interpolate(
django.gettext('The event %(eventName)s is coming up for the project <a href="' + url + '">%(title)s</a>. It will take place on %(date)s'),
{ eventName, title, date },
true
)
Expand Down

0 comments on commit e9d0f0a

Please sign in to comment.