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

feat: Display new target action of News list portlet drawer only for managers of web-contributors group - EXO-65909 - Meeds-io/MIPs#68 #919

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions webapp/src/main/webapp/WEB-INF/jsp/newsListView.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
PortalHttpServletResponseWrapper responseWrapper = ( PortalHttpServletResponseWrapper ) rcontext.getResponse();
String newsListUrl = "/portal/rest/v1/news/byTarget/" + newsTarget + "?offset=0&limit=" + limit + "&returnSize=true";
responseWrapper.addHeader("Link", "<" + newsListUrl + ">; rel=prefetch; as=fetch; crossorigin=use-credentials", false);
boolean canManageNews = NewsUtils.canManageNewsPublishTargets(currentIdentity);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boolean canManageNews = NewsUtils.canManageNewsPublishTargets(currentIdentity);
boolean canManageNewsPublishTargets = NewsUtils.canManageNewsPublishTargets(currentIdentity);

%>
<div class="news-list-view-app" id="<%= appId %>">
<script type="text/javascript">
eXo.env.portal.canManageNews = <%=canManageNews%>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eXo.env.portal.canManageNews = <%=canManageNews%>;
eXo.env.portal.canManageNewsPublishTargets = <%=canManageNewsPublishTargets %>;

require(['PORTLET/news/NewsListView'], app => app.init({
appId: '<%=appId%>',
saveSettingsURL: <%= "'" + saveSettingsURL + "'" %>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</v-card-text>
</v-card>
<news-settings-drawer v-if="canPublishNews" />
<news-publish-targets-management-drawer v-if="canPublishNews" />
<news-publish-targets-management-drawer v-if="canManageNews" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<news-publish-targets-management-drawer v-if="canManageNews" />
<news-publish-targets-management-drawer v-if="canManageNewsPublishTargets " />

</v-app>
</template>

Expand Down Expand Up @@ -104,6 +104,7 @@ export default {
hasMore: false,
offset: 0,
canPublishNews: false,
canManageNews: eXo.env.portal.canManageNews
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
canManageNews: eXo.env.portal.canManageNews
canManageNewsPublishTargets : eXo.env.portal.canManageNewsPublishTargets

}),
computed: {
displayHeader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>
</v-select>
</div>
<div class="d-flex flex-row clickable text-decoration-underline">
<div v-if="canManageNews" class="d-flex flex-row clickable text-decoration-underline">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div v-if="canManageNews" class="d-flex flex-row clickable text-decoration-underline">
<div v-if="canManageNewsPublishTargets" class="d-flex flex-row clickable text-decoration-underline">

<a @click="createNewTarget"> {{ $t('news.list.settings.drawer.createNewTarget') }} </a>
</div>
<div v-if="newsTargets.length === 0" class="d-flex flex-row grey--text">
Expand Down Expand Up @@ -197,7 +197,8 @@ export default {
showArticleReactions: false,
showTooltip: false,
seeAllUrl: `${eXo.env.portal.context}/${eXo.env.portal.portalName}/news?filter=pinned`,
saveSettingsURL: ''
saveSettingsURL: '',
canManageNews: eXo.env.portal.canManageNews
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
canManageNews: eXo.env.portal.canManageNews
canManageNewsPublishTargets: eXo.env.portal.canManageNewsPublishTargets

}),
computed: {
backgroundColor(){
Expand Down