Skip to content

Commit

Permalink
BC-6424 - Incorrect message describing the news creator after deletin…
Browse files Browse the repository at this point in the history
…g the creator field (#3402)

* change displaying messege for news

* changes in locales and change updater into creator

* fix translation and wording

* fix word order

* fix displaying message in case creator and updater are present
  • Loading branch information
WojciechGrancow authored Feb 6, 2024
1 parent 7a47960 commit 537c8c9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
2 changes: 2 additions & 0 deletions controllers/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ router.get('/:newsId', (req, res, next) => {
api(req, { version: VERSION })
.get(`/news/${req.params.newsId}`)
.then((news) => {
const creatorAndUpdaterPresent = !!(news.updater && news.creator);
res.render('news/article', {
title: news.title,
news,
creatorAndUpdaterPresent,
isRSS: news.source === 'rss',
});
})
Expand Down
6 changes: 3 additions & 3 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2648,14 +2648,14 @@
"atSchool": "an der Schule",
"atYourSchool": "an deiner Schule ",
"created": "erstellt",
"from": "von",
"by": "von",
"inTheClass": "in der Klasse",
"inTheCourse": "im Kurs",
"inTheTeam": "im Team",
"lastFrom": "(zuletzt von",
"last": "zuletzt",
"newsNeedContent": "News benötigen Inhalt!",
"newsNeedTitle": "News benötigen einen Titel!",
"processed": "bearbeitet)",
"processed": "bearbeitet",
"released": "Veröffentlicht",
"unpublished": "Unveröffentlicht"
}
Expand Down
6 changes: 3 additions & 3 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2647,15 +2647,15 @@
"text": {
"atSchool": "at school",
"atYourSchool": "at your school ",
"by": "by",
"created": "created",
"from": "from",
"inTheClass": "in the class",
"inTheCourse": "in the course",
"inTheTeam": "in the team",
"lastFrom": "(last from",
"last": "last",
"newsNeedContent": "News need content!",
"newsNeedTitle": "News need a title!",
"processed": "edited)",
"processed": "edited",
"released": "Released",
"unpublished": "Unpublished"
}
Expand Down
6 changes: 3 additions & 3 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2648,14 +2648,14 @@
"atSchool": "en la escuela",
"atYourSchool": "en tu escuela",
"created": "creado",
"from": "desde",
"by": "por",
"inTheClass": "en la clase",
"inTheCourse": "en el curso",
"inTheTeam": "en el equipo",
"lastFrom": "(último desde",
"last": "últimamente",
"newsNeedContent": "¡Las noticias necesitan contenido!",
"newsNeedTitle": "¡Las noticias necesitan un título!",
"processed": "editado)",
"processed": "editado",
"released": "Publicado",
"unpublished": "Sin publicar"
}
Expand Down
6 changes: 3 additions & 3 deletions locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1677,12 +1677,12 @@
"atSchool": "у школі",
"atYourSchool": "у вашій школі ",
"created": "створено",
"from": "з",
"by": "",
"inTheClass": "в класі",
"inTheCourse": "в курсі",
"inTheTeam": "в команді",
"lastFrom": "(останнє з",
"processed": "відредаговано)",
"last": "останній раз було",
"processed": "відредаговано",
"released": "Випущено",
"unpublished": "Не опубліковано",
"newsNeedContent": "Новинам потрібний контент!",
Expand Down
14 changes: 9 additions & 5 deletions views/news/article.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{{#extend "news/news"}}
{{#content "page"}}
<p>
<small class="text-muted">{{timeFromNow news.displayAt}}</small>
{{#unless isRSS}}
<small class="text-muted">
{{$t "news.text.from" }} {{news.creator.firstName}} {{news.creator.lastName}} {{$t "news.text.created" }}
{{#if news.updater}}
{{$t "news.text.lastFrom" }} {{news.updater.firstName}} {{news.updater.lastName}} {{$t "news.text.processed" }}
{{$t "news.text.last" }} {{$t "news.text.processed" }} {{$t "news.text.by" }} {{news.updater.firstName}} {{news.updater.lastName}}
{{/if}}
{{#if creatorAndUpdaterPresent}} | {{/if}}
{{$t "news.text.created" }}
{{#if news.creator}}
{{$t "news.text.by" }} {{news.creator.firstName}} {{news.creator.lastName}}
{{/if}}
{{timeFromNow news.displayAt}}
{{#if news.target.name}}
{{#ifCond news.targetModel '===' 'teams'}}
{{$t "news.text.inTheTeam" }}
Expand All @@ -22,8 +26,8 @@
<a href="/{{../news.targetModel}}/{{../news.target.id}}">{{../news.target.name}}</a>
{{/ifCond}}
{{/if}}
{{#ifCond @root.currentUser.schoolId '===' news.school.id}} {{$t "news.text.atYourSchool" }}{{else}}
{{$t "news.text.atSchool" }} {{../news.school.name}}
</br>
{{#ifCond @root.currentUser.schoolId '!==' news.school.id}} {{$t "news.text.atSchool" }} {{../news.school.name}}
{{/ifCond}}
</small>
{{/unless}}
Expand Down

0 comments on commit 537c8c9

Please sign in to comment.