Skip to content

Commit

Permalink
feat: Remove all the feature flag MIP129 - EXO-74680 - Meeds-io/MIPs#129
Browse files Browse the repository at this point in the history
 (#259)
  • Loading branch information
azayati committed Oct 11, 2024
1 parent ffb7f4c commit 2abca1f
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.Map;

import org.exoplatform.commons.utils.CommonsUtils;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
Expand All @@ -35,30 +34,25 @@

public class SpaceNewsTargetAutoCreationListener extends SpaceListenerPlugin {

private static final Log LOG =
ExoLogger.getLogger(SpaceNewsTargetAutoCreationListener.class);
private static final Log LOG = ExoLogger.getLogger(SpaceNewsTargetAutoCreationListener.class);

private NewsTargetingService newsTargetingService;

private static final String SPACE_NEWS_TARGET_AUTO_CREATION_FEATURE = "spaceNewsTargetAutoCreation";

public SpaceNewsTargetAutoCreationListener(NewsTargetingService newsTargetingService) {
this.newsTargetingService = newsTargetingService;
}

@Override
public void spaceCreated(SpaceLifeCycleEvent event) {
if (CommonsUtils.isFeatureActive(SPACE_NEWS_TARGET_AUTO_CREATION_FEATURE)) {
Identity currentIdentity = ConversationState.getCurrent().getIdentity();
Space space = event.getSpace();
NewsTargetingEntity spaceNewsTargetEntity = new NewsTargetingEntity();
spaceNewsTargetEntity.setName(space.getDisplayName());
spaceNewsTargetEntity.setProperties(Map.of("label", space.getDisplayName(), "permissions", "space:" + space.getId()));
try {
newsTargetingService.createNewsTarget(spaceNewsTargetEntity, currentIdentity, false);
} catch (Exception e) {
LOG.warn("Can't create space {} news target", space.getPrettyName());
}
Identity currentIdentity = ConversationState.getCurrent().getIdentity();
Space space = event.getSpace();
NewsTargetingEntity spaceNewsTargetEntity = new NewsTargetingEntity();
spaceNewsTargetEntity.setName(space.getDisplayName());
spaceNewsTargetEntity.setProperties(Map.of("label", space.getDisplayName(), "permissions", "space:" + space.getId()));
try {
newsTargetingService.createNewsTarget(spaceNewsTargetEntity, currentIdentity, false);
} catch (Exception e) {
LOG.warn("Can't create space {} news target", space.getPrettyName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
<import>war:/conf/news/metadata-plugins-configuration.xml</import>
<import>war:/conf/news/gamification-configuration.xml</import>
<import>war:/conf/news/ckeditor-configuration.xml</import>
<import>war:/conf/news/feature-flags-configuration.xml</import>

</configuration>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
id="newsDetails"
:class="{'pa-5': articleNewLayoutEnabled}">
class="pa-5">
<div v-if="notFound" class="articleNotFound">
<i class="iconNotFound"></i>
<h3>{{ $t('news.details.restricted') }}</h3>
Expand Down Expand Up @@ -48,11 +48,6 @@ export default {
originalVersion: null,
previousSelectedTranslation: null
}),
computed: {
articleNewLayoutEnabled() {
return eXo?.env?.portal?.articleNewLayoutEnabled;
}
},
created() {
this.getAvailableLanguages();
const url = new URL(window.location.href);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,8 @@
<v-app>
<div
id="newsDetails"
:class="{'pa-5': articleNewLayoutEnabled}">
class="pa-5">
<div
v-if="isMobile && !articleNewLayoutEnabled"
class="application-body">
<exo-news-details-toolbar-mobile
:news="news"
:show-edit-button="showEditButton"
:show-delete-button="showDeleteButton"
:show-copy-link-button="showCopyLinkButton"
:show-publish-button="showPublishButton"
@delete-article="deleteConfirmDialog"
@edit-article="editLink" />
<exo-news-details-body-mobile
:news="news"
:news-id="newsId"
:space="currentSpace" />
</div>
<div
v-else
class="application-body">
<exo-news-details-toolbar
:news="news"
Expand Down Expand Up @@ -165,9 +148,6 @@ export default {
},
processedNewsType() {
return this.activityId && this.activityId !== '' ? this.$newsConstants.newsObjectType.ARTICLE : this.newsType;
},
articleNewLayoutEnabled() {
return eXo?.env?.portal?.articleNewLayoutEnabled;
}
},
created() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<template>
<div v-if="news">
<div
v-if="articleNewLayoutEnabled"
class="newsDetails-description">
<div
class="newsDetails-header">
Expand Down Expand Up @@ -116,127 +115,6 @@
</div>
</div>
</div>
<div
v-else
class="newsDetails-description">
<div :class="[illustrationURL ? 'newsDetails-header' : '']" class="newsDetails-header">
<div v-if="illustrationURL" class="illustration center">
<img
:src="`${illustrationURL}&size=0x400`"
:alt="featuredImageAltText"
class="newsDetailsImage illustrationPicture"
longdesc="#newsSummary">
</div>
<div class="newsDetails">
<div class="news-top-information d-flex">
<div id="titleNews" class="newsTitle newsTitleMobile">
<a class="activityLinkColor newsTitleLink text-title">{{ newsTitle }}</a>
</div>
</div>
<div class="newsInformationBackground center">
<div :class="[showUpdateInfo ? 'news-update-details-header' : 'news-details-header']" class="news-header-content d-inline-flex align-center">
<div :class="[ showUpdateInfo ? 'newsUpdateInfo' : '']" v-if="currentUser">
<exo-user-avatar
:profile-id="authorProfile"
:size="50"
class="me-1"
popover
avatar />
</div>
<div id="informationNews" class="newsInformation pa-1">
<div class="newsPosted d-flex align-center">
<exo-user-avatar
v-if="currentUser"
:profile-id="authorProfile"
extra-class="me-1"
fullname
link-style
popover />
<span v-if="!hiddenSpace && currentUser"> {{ $t('news.activity.in') }} </span>
<exo-space-avatar
v-if="!hiddenSpace && currentUser"
:space-id="spaceId"
fullname
extra-class="me-1 ms-n1"
link-style
popover />
<template v-if="publicationDate">
<span v-if="currentUser"> - </span>
<date-format
:value="publicationDate"
:format="dateFormat"
class="newsInformationValue newsPostedDate news-details-information ms-1" />
</template>
<div class="mb-1 ml-2">
<content-translation-menu
:translations="translations"
:selected-translation="selectedTranslation"
:article="news" />
</div>
</div>
<div class="newsUpdater text-subtitle">
<div v-if="publicationState !== 'staged' && showUpdateInfo">
{{ $t('news.activity.lastUpdated') }}
</div>
<div v-else-if="publicationState === 'staged'">
{{ $t('news.details.scheduled') }}
</div>
<div>
<template v-if="publicationState !== 'staged' && updatedDate && showUpdateInfo">
<date-format
:value="updatedDate"
:format="dateFormat"
class="newsInformationValue newsUpdatedDate" />
</template>
<template v-else-if="publicationState === 'staged'">
<date-format
:value="scheduleDate"
:format="dateFormat"
class="newsInformationValue newsUpdatedDate" />
<span class="newsInformationValue">-</span>
<date-format
:value="scheduleDate"
:format="dateTimeFormat"
class="newsInformationValue newsUpdatedDate ml-1 me-1" />
</template>
<div v-if="notSameUpdater && showUpdateInfo && currentUser" class="text-subtitle">
<span> {{ $t('news.activity.by') }} </span>
<exo-user-avatar
:profile-id="newsUpdater"
extra-class="ms-1"
fullname
link-style
popover />
</div>
</div>
</div>
</div>
</div>
</div>

<div
v-if="newsSummary"
id="newsSummary"
class="summary text-header center ms-13 me-13">
<span v-sanitized-html="newsSummary"></span>
</div>

<div
id="newsBody"
:class="[!summary ? 'fullDetailsBodyNoSummary' : '']"
class="fullDetailsBody ms-13 me-13 clearfix">
<div
class="rich-editor-content extended-rich-content"
v-html="newsBody"></div>
</div>
<extension-registry-components
:params="{attachmentsIds: attachmentsIds}"
name="NewsDetails"
type="news-details-attachments"
element="div" />
</div>
</div>
</div>
</div>
</template>

Expand Down Expand Up @@ -289,9 +167,6 @@ export default {
this.$root.$on('update-news-body', this.setNewsContent);
},
computed: {
articleNewLayoutEnabled() {
return eXo?.env?.portal?.articleNewLayoutEnabled;
},
showUpdaterInfo() {
return !this.isPublicAccess;
},
Expand All @@ -312,12 +187,6 @@ export default {
newsTitle() {
return this.news && this.newsTitleContent;
},
showUpdateInfo() {
return this.news && this.news.updateDate && this.news.updater !== '__system' && this.news.updateDate !== 'null' && this.news.publicationDate && this.news.publicationDate !== 'null' && new Date(this.news.updateDate).getTime() > new Date(this.news.publicationDate).getTime();
},
authorProfile() {
return this.news && this.news.author;
},
articleUpdater() {
return this.news?.updater || this.news?.author;
},
Expand All @@ -330,12 +199,6 @@ export default {
updaterFullName() {
return this.news && this.news.updaterFullName;
},
updaterProfileURL() {
return this.news && `${eXo.env.portal.context}/${eXo.env.portal.metaPortalName}/profile/${this.news.updater}`;
},
newsUpdater() {
return this.news && this.news.updater;
},
publicationDate() {
return this.news?.publicationDate && new Date(this.news.publicationDate);
},
Expand All @@ -359,13 +222,7 @@ export default {
},
publicationState() {
return this.news && this.news.publicationState;
},
notSameUpdater() {
return this.news && this.news.updater !== this.news.author;
},
scheduleDate() {
return this.news && this.news.schedulePostDate;
},
}
},
methods: {
setNewsTitle(title) {
Expand Down
Loading

0 comments on commit 2abca1f

Please sign in to comment.