Skip to content

Commit 317c07b

Browse files
authored
Create a post on Bluesky when a dataset is made public (#544)
- Added configuration page for Bluesky Settings under Panorama Public Admin Console. This can be used to configure the following: -- Credentials for both primary and test Bluesky accounts -- Provide the Bluesky API endpoint URLs for login, posting, and image upload -- Specify default hashtags for posts -- Upload a default Panorama logo (overridden by a dataset’s catalog entry image, if available) -- "Auto‑post" toggle (off by default) to enable automatic posting when a submitter makes a dataset public - Added "Post to Bluesky" menu item to the TargetedMSExperimentWebPart. This allows admins to create a post for the dataset to either the primary or test account. - When “auto‑post” is enabled, a Bluesky post is created immediately after a dataset is made public - Store generated Bluesky post URLs to a property store, linked to each dataset’s short URL - Register PanoramaPublicLogoResourceType attachment type in PanoramaPublicModule.java
1 parent 3745456 commit 317c07b

15 files changed

+1956
-39
lines changed

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 504 additions & 38 deletions
Large diffs are not rendered by default.

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
import org.labkey.api.view.ViewContext;
4444
import org.labkey.api.view.WebPartFactory;
4545
import org.labkey.api.view.WebPartView;
46+
import org.labkey.panoramapublic.bluesky.BlueskyApiClient;
47+
import org.labkey.panoramapublic.bluesky.PanoramaPublicLogoResourceType;
4648
import org.labkey.panoramapublic.catalog.CatalogImageAttachmentType;
4749
import org.labkey.panoramapublic.model.Journal;
4850
import org.labkey.panoramapublic.model.speclib.SpecLibKey;
@@ -104,6 +106,7 @@ protected void init()
104106
addController(PanoramaPublicController.NAME, PanoramaPublicController.class);
105107
PanoramaPublicSchema.register(this);
106108
AttachmentService.get().registerAttachmentType(CatalogImageAttachmentType.get());
109+
AttachmentService.get().registerAttachmentType(PanoramaPublicLogoResourceType.get());
107110
}
108111

109112
@Override
@@ -378,6 +381,7 @@ public Set<Class> getUnitTests()
378381
set.add(ContainerJoin.TestCase.class);
379382
set.add(Formula.TestCase.class);
380383
set.add(CatalogEntryManager.TestCase.class);
384+
set.add(BlueskyApiClient.TestCase.class);
381385
return set;
382386

383387
}

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicNotification.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static void notifyCopied(ExperimentAnnotations srcExpAnnotations, Experim
132132
}
133133

134134
public static void notifyDataPublished(ExperimentAnnotations srcExperiment, ExperimentAnnotations journalCopy, Journal journal,
135-
JournalExperiment je, DataCiteException doiError, boolean madePublic, boolean addedPublication, User user)
135+
JournalExperiment je, DataCiteException doiError, boolean madePublic, boolean addedPublication, String blueskyPostUrl, User user)
136136
{
137137
StringBuilder messageBody = new StringBuilder();
138138
messageBody.append("Dear ").append(getUserName(user)).append(",").append(NL2);
@@ -161,6 +161,10 @@ else if (addedPublication)
161161
{
162162
messageBody.append(NL2).append("The data will be available under the ").append(journalCopy.getDataLicense().getDisplayName()).append(" license.");
163163
}
164+
if (madePublic && !StringUtils.isBlank(blueskyPostUrl))
165+
{
166+
messageBody.append(NL2).append("We have announced your data on Bluesky - take a look here: ").append(bold(link("Bluesky Post", blueskyPostUrl))).append(".");
167+
}
164168
if (journalCopy.hasPxid())
165169
{
166170
messageBody.append(NL2);

0 commit comments

Comments
 (0)