Adding feature #21345
This commit is contained in:
parent
73db422373
commit
eb27d67845
|
@ -4,9 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
## [v2.1.0-SNAPSHOT]
|
## [v2.1.0-SNAPSHOT]
|
||||||
|
|
||||||
-
|
- Added query parameter social_post_notification to override default VRE behaviour [#21345]
|
||||||
- Users are created/references in the form <Surname Name> and not vice-versa [#21479]
|
- Users are created/references in the form <Surname Name> and not vice-versa [#21479]
|
||||||
|
- Starting to add support for moderation [#21342]
|
||||||
|
|
||||||
## [v2.0.0]
|
## [v2.0.0]
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class CKANInstance {
|
||||||
protected String ckanURL;
|
protected String ckanURL;
|
||||||
protected String sysAdminToken;
|
protected String sysAdminToken;
|
||||||
protected boolean socialPostEnabled;
|
protected boolean socialPostEnabled;
|
||||||
protected boolean notificationToUsersEnabled;
|
protected Boolean notificationToUsersEnabled;
|
||||||
protected String uriResolverURL;
|
protected String uriResolverURL;
|
||||||
|
|
||||||
protected boolean moderationEnabled;
|
protected boolean moderationEnabled;
|
||||||
|
|
|
@ -593,6 +593,17 @@ public class CKANPackage extends CKAN {
|
||||||
socialPost.setItemURL(catalogueItemURL);
|
socialPost.setItemURL(catalogueItemURL);
|
||||||
socialPost.setTags(arrayNode);
|
socialPost.setTags(arrayNode);
|
||||||
socialPost.setItemTitle(title);
|
socialPost.setItemTitle(title);
|
||||||
|
|
||||||
|
Boolean notification = null;
|
||||||
|
try {
|
||||||
|
MultivaluedMap<String,String> queryParameters = uriInfo.getQueryParameters();
|
||||||
|
if(queryParameters.containsKey(GCatConstants.SOCIAL_POST_NOTIFICATION_QUERY_PARAMETER)) {
|
||||||
|
notification = Boolean.parseBoolean(queryParameters.getFirst(GCatConstants.SOCIAL_POST_NOTIFICATION_QUERY_PARAMETER));
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
socialPost.setNotification(notification);
|
||||||
socialPost.start();
|
socialPost.start();
|
||||||
} else {
|
} else {
|
||||||
logger.info("The request explicitly disabled the Social Post.");
|
logger.info("The request explicitly disabled the Social Post.");
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class SocialPost extends Thread {
|
||||||
protected String itemURL;
|
protected String itemURL;
|
||||||
protected String itemTitle;
|
protected String itemTitle;
|
||||||
protected List<String> tags;
|
protected List<String> tags;
|
||||||
|
protected Boolean notification;
|
||||||
|
|
||||||
public SocialPost() throws Exception {
|
public SocialPost() throws Exception {
|
||||||
super();
|
super();
|
||||||
|
@ -103,6 +104,14 @@ public class SocialPost extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isNotification() {
|
||||||
|
return notification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotification(Boolean notification) {
|
||||||
|
this.notification = notification;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
@ -117,6 +126,15 @@ public class SocialPost extends Thread {
|
||||||
logger.info("Going to send Social Post about the Item {} available at {}", itemID, itemURL);
|
logger.info("Going to send Social Post about the Item {} available at {}", itemID, itemURL);
|
||||||
|
|
||||||
boolean notifyUsers = instance.isNotificationToUsersEnabled();
|
boolean notifyUsers = instance.isNotificationToUsersEnabled();
|
||||||
|
|
||||||
|
if(notification != null) {
|
||||||
|
if(notifyUsers) {
|
||||||
|
notifyUsers = notifyUsers && notification;
|
||||||
|
}else {
|
||||||
|
notifyUsers = notification;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// write notification post
|
// write notification post
|
||||||
sendSocialPost(notifyUsers);
|
sendSocialPost(notifyUsers);
|
||||||
|
|
||||||
|
@ -182,4 +200,5 @@ public class SocialPost extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue