Skip to content

Commit

Permalink
Merge PWA - Meeds-io/MIPs#134 (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker authored Aug 22, 2024
2 parents 26be621 + c0e849d commit f37c25a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import io.meeds.kudos.model.Kudos;
import io.meeds.kudos.service.KudosService;
import io.meeds.kudos.service.utils.Utils;

import jakarta.annotation.PostConstruct;

Expand All @@ -52,7 +53,7 @@ public class KudosSentNotificationListener extends Listener<KudosService, Kudos>

@PostConstruct
public void init() {
listenerService.addListener("exo.kudos.sent", this);
listenerService.addListener(Utils.KUDOS_ACTIVITY_EVENT, this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import org.exoplatform.commons.api.notification.NotificationContext;
import org.exoplatform.commons.api.notification.model.NotificationInfo;
import org.exoplatform.commons.api.notification.plugin.BaseNotificationPlugin;
Expand Down Expand Up @@ -66,13 +68,13 @@ public NotificationInfo makeNotification(NotificationContext ctx) {
}
ActivityManager activityManager = ExoContainerContext.getService(ActivityManager.class);
ExoSocialActivity activity = activityManager.getActivity(String.valueOf(kudos.getActivityId()));
if (activity.isComment()) {
if (activity != null && activity.isComment()) {
activity = activityManager.getActivity(activity.getParentId());
}

return NotificationInfo.instance()
.to(toList)
.setSpaceId(activity == null ? 0l : Long.parseLong(activity.getSpaceId()))
.setSpaceId(activity == null || StringUtils.isBlank(activity.getSpaceId()) ? 0l : Long.parseLong(activity.getSpaceId()))
.with(SocialNotificationUtils.ACTIVITY_ID.getKey(), String.valueOf(kudos.getActivityId()))
.with("ENTITY_ID", kudos.getEntityId())
.with("ENTITY_TYPE", kudos.getEntityType())
Expand Down
24 changes: 23 additions & 1 deletion kudos-webapps/src/main/webapp/WEB-INF/gatein-resources.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
<gatein-resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/gatein_resources_1_4 http://www.exoplatform.org/xml/ns/gatein_resources_1_4" xmlns="http://www.exoplatform.org/xml/ns/gatein_resources_1_4">
<gatein-resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/gatein_resources_1_5 http://www.exoplatform.org/xml/ns/gatein_resources_1_5" xmlns="http://www.exoplatform.org/xml/ns/gatein_resources_1_5">

<portal-skin>
<skin-name>Enterprise</skin-name>
<skin-module>kudos</skin-module>
<css-path>/skin/css/main.css</css-path>
<css-priority>120</css-priority>
<filtered>true</filtered>
</portal-skin>

<portlet-skin>
<application-name>kudos</application-name>
<portlet-name>Kudos</portlet-name>
<skin-name>Enterprise</skin-name>
<additional-module>kudos</additional-module>
</portlet-skin>

<portlet-skin>
<application-name>kudos</application-name>
<portlet-name>KudosOverview</portlet-name>
<skin-name>Enterprise</skin-name>
<additional-module>kudos</additional-module>
</portlet-skin>

<portlet-skin>
<application-name>kudos</application-name>
<portlet-name>KudosAdmin</portlet-name>
<skin-name>Enterprise</skin-name>
<additional-module>kudos</additional-module>
</portlet-skin>

<portlet>
<name>Kudos</name>
<module>
Expand Down
1 change: 1 addition & 0 deletions kudos-webapps/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<url-pattern>*.css</url-pattern>
<url-pattern>*.js</url-pattern>
<url-pattern>*.html</url-pattern>
<url-pattern>/i18n/*</url-pattern>
<url-pattern>/images/*</url-pattern>
</filter-mapping>

Expand Down
2 changes: 1 addition & 1 deletion kudos-webapps/src/main/webapp/vue-app/kudos-admin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (extensionRegistry) {
}

const lang = eXo && eXo.env.portal.language || 'en';
const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.addon.Kudos-${lang}.json`;
const url = `/kudos/i18n/locale.addon.Kudos?lang=${lang}`;
const appId = 'KudosAdminApp';

export function init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const cacheId = `${appId}_${eXo.env.portal.profileOwnerIdentityId}`;

//should expose the locale ressources as REST API
const lang = (eXo && eXo.env && eXo.env.portal && eXo.env.portal.language) || 'en';
const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.addon.Kudos-${lang}.json`;
const url = `/kudos/i18n/locale.addon.Kudos?lang=${lang}`;

export function init() {
exoi18n.loadLanguageAsync(lang, url).then(i18n => {
Expand Down
2 changes: 1 addition & 1 deletion kudos-webapps/src/main/webapp/vue-app/kudos/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const appId = 'KudosApp';

//should expose the locale ressources as REST API
const lang = (eXo && eXo.env && eXo.env.portal && eXo.env.portal.language) || 'en';
const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.addon.Kudos-${lang}.json`;
const url = `/kudos/i18n/locale.addon.Kudos?lang=${lang}`;

exoi18n.loadLanguageAsync(lang, url).then(i18n => {
// init Vue app when locale ressources are ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import './initComponents.js';
import './extensions.js';

const lang = eXo.env.portal.language;
const url = `${eXo.env.portal.context}/${eXo.env.portal.rest}/i18n/bundle/locale.notification.KudosNotification-${lang}.json`;
const url = `/kudos/i18n/locale.notification.KudosNotification?lang=${lang}`;

export function init() {
return exoi18n.loadLanguageAsync(lang, url)
Expand Down

0 comments on commit f37c25a

Please sign in to comment.