Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #13041 : redirect user on app main page when trying to access to an unavailable news #784

Merged
merged 1 commit into from May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,3 +77,6 @@ quickinfo.news.delegated.denied = Refus\u00e9e
quickinfo.news.notifNewsLinkLabel = Voir cette actualit\u00e9
quickinfo.news.permalink=Pour copier le lien vers cette actualit\u00e9 \: Clique droit puis 'Copier le raccourci'
quickinfo.ToHour = \u00e0

quickinfo.news.error.notyetvisible = L'actualit\u00e9 demand\u00e9e n'est pas encore disponible...
quickinfo.news.error.nomorevisible = L'actualit\u00e9 demand\u00e9e n'est plus disponible...
Expand Up @@ -77,3 +77,6 @@ quickinfo.news.delegated.denied = Denied
quickinfo.news.notifNewsLinkLabel = gehen Sie zu diese Nachrich
quickinfo.news.permalink=To copy link of this news \: Right-click then 'Copy shortcut'
quickinfo.ToHour = um

quickinfo.news.error.notyetvisible = Die angeforderte Nachricht ist noch nicht verf\u00fcgbar...
quickinfo.news.error.nomorevisible = Die angeforderten Nachrichten sind nicht mehr verf\u00fcgbar...
Expand Up @@ -77,3 +77,6 @@ quickinfo.news.delegated.denied = Denied
quickinfo.news.notifNewsLinkLabel = Go to this news
quickinfo.news.permalink=To copy link of this news \: Right-click then 'Copy shortcut'
quickinfo.ToHour = at

quickinfo.news.error.notyetvisible = The requested news is not yet available...
quickinfo.news.error.nomorevisible = The requested news is no longer available...
Expand Up @@ -77,3 +77,6 @@ quickinfo.news.delegated.denied = Refus\u00e9e
quickinfo.news.notifNewsLinkLabel = Voir cette actualit\u00e9
quickinfo.news.permalink=Pour copier le lien vers cette actualit\u00e9 \: Clique droit puis 'Copier le raccourci'
quickinfo.ToHour = \u00e0

quickinfo.news.error.notyetvisible = L'actualit\u00e9 demand\u00e9e n'est pas encore disponible...
quickinfo.news.error.nomorevisible = L'actualit\u00e9 demand\u00e9e n'est plus disponible...
Expand Up @@ -123,13 +123,23 @@ public String getDestination(String function, QuickInfoSessionController quickIn
if (!StringUtil.isDefined(id)) {
id = request.getParameter("Id");
}
request.setAttribute("News", quickInfo.getNews(id, true));
news = quickInfo.getNews(id, true);
request.setAttribute("News", news);
}
request.setAttribute("Index", quickInfo.getIndex());
String anchor = request.getParameter("Anchor");
destination = "/quickinfo/jsp/news.jsp";
if (StringUtil.isDefined(anchor)) {
destination += "#" + anchor;
if (!isContributor(flag) && (news.isDraft() || !news.isVisible())) {
if (news.isDraft() || news.isNotYetVisible()) {
request.setAttribute("ErrorMessage", "quickinfo.news.error.notyetvisible");
} else {
request.setAttribute("ErrorMessage", "quickinfo.news.error.nomorevisible");
}
destination = getDestination("Main", quickInfo, request);
} else {
request.setAttribute("Index", quickInfo.getIndex());
String anchor = request.getParameter("Anchor");
destination = "/quickinfo/jsp/news.jsp";
if (StringUtil.isDefined(anchor)) {
destination += "#" + anchor;
}
}
} else if ("ViewOnly".equals(function)) {
String id = request.getParameter("Id");
Expand Down Expand Up @@ -169,9 +179,6 @@ public String getDestination(String function, QuickInfoSessionController quickIn
// from a comment
news = quickInfo.getNews(id, true);
}
if (news.isDraft() && !isContributor(flag)) {
throwHttpForbiddenError();
}
request.setAttribute("News", news);
destination = getDestination("View", quickInfo, request);
} else if ("SubmitOnHomepage".equals(function)) {
Expand Down Expand Up @@ -282,4 +289,4 @@ private Period getPeriod(Date begin, Date end) {
end != null ? ofInstant(end.toInstant(), ZoneId.systemDefault()) : null
);
}
}
}
Expand Up @@ -50,6 +50,7 @@
<c:set var="role" value="${requestScope['Role']}"/>
<c:set var="isSubscriberUser" value="${requestScope.IsSubscriberUser}"/>
<c:set var="contributor" value="${role == 'admin' || role == 'publisher'}"/>
<c:set var="errorMessage" value="${requestScope['ErrorMessage']}"/>

<c:set var="defaultPaginationPageSize" value="${requestScope.resources.getSetting('news.home.pagination.page.size.default', 10)}"/>
<c:set var="defaultBatchSize" value="${requestScope.resources.getSetting('news.home.accumulation.batch.size.default', 9)}"/>
Expand Down Expand Up @@ -106,6 +107,10 @@ function putNewsInBasket(contributionId) {
<view:window>
<view:componentInstanceIntro componentId="${componentId}" language="${lang}"/>

<c:if test="${not empty errorMessage}">
<div class="inlineMessage-nok"><fmt:message key="${errorMessage}"/></div>
</c:if>

<c:if test="${contributor || !appSettings.mosaicViewForUsers}">
<!-- Dedicated part for contributors -->
<c:if test="${contributor}">
Expand Down Expand Up @@ -292,4 +297,4 @@ function putNewsInBasket(contributionId) {
</script>

</view:sp-body-part>
</view:sp-page>
</view:sp-page>