-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement the administration management of automatic translation for news - EXO-72353 - Meeds-io/MIPs#129 (#225) feat: Add the newsServices as a prototype in the favorite drawer extension - EXO-74122 - Meeds-io/MIPs#129 (#229) feat: Implement consult news action menu revamping - EXO-73149 - Meeds-io/MIPs#129 (#228) feat: Implement article copy link action - EXO-73602 - Meeds-io/MIPs#129 (#230) feat: Disable the save/publish button when draft status is saving - EXO-74280 - Meeds-io/MIPs#129 (#235) feat: Fix content body inserted images permissions - EXO-74263_EXO-74265_EXO-74266 - Meeds-io/MIPs#129 (#240) fix: Fix displaying content detail for public sites - EXO-74419 - Meeds-io/MIPs#129 (#243) feat: Implement Space news target auto creation listener in order to create space news target when a space is created - EXO-73039 - Meeds-io/MIPs#129 (#245) feat: Remove unread activities notifications channel for PublishNewsNotificationPlugin - EXO-73048 - Meeds-io/MIPs#129 (#252) feat: Remove unread activities notifications channel for MentionInNewsNotificationPlugin - EXO-73152 - Meeds-io/MIPs#129 (#253) feat: Send published article public link in publish news mail notification message - EXO-73050 - Meeds-io/MIPs#129 (#255) feat: Implement new article view layout - EXO-73043 - Meeds-io/MIPs#129 (#256) Implement new article view layout
- Loading branch information
Showing
40 changed files
with
1,240 additions
and
1,535 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...ent-service/src/main/java/io/meeds/news/listener/SpaceNewsTargetAutoCreationListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* This file is part of the Meeds project (https://meeds.io/). | ||
* | ||
* Copyright (C) 2020 - 2024 Meeds Association [email protected] | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package io.meeds.news.listener; | ||
|
||
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; | ||
import org.exoplatform.services.security.Identity; | ||
import org.exoplatform.social.core.space.SpaceListenerPlugin; | ||
import org.exoplatform.social.core.space.model.Space; | ||
import org.exoplatform.social.core.space.spi.SpaceLifeCycleEvent; | ||
|
||
import io.meeds.news.rest.NewsTargetingEntity; | ||
import io.meeds.news.service.NewsTargetingService; | ||
|
||
public class SpaceNewsTargetAutoCreationListener extends SpaceListenerPlugin { | ||
|
||
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()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.