Quote Post Fixe
This commit is contained in:
parent
d79678aae3
commit
9e529f8b99
2 changed files with 16 additions and 10 deletions
|
|
@ -256,12 +256,12 @@ public class FederationService {
|
|||
* Send an Accept for a quote interaction (FEP-5e53).
|
||||
* This tells the quoting server that the quote has been approved.
|
||||
*
|
||||
* @param createActivityId the ID of the incoming Create activity that contains the quote
|
||||
* @param noteUri the URI of the remote Note that quotes our post
|
||||
* @param remoteActorUri the actor URI of the user who quoted the post
|
||||
* @param localUser the local user who owns the quoted post
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
public void sendAcceptQuote(String createActivityId, String remoteActorUri, User localUser) {
|
||||
public void sendAcceptQuote(String noteUri, String remoteActorUri, User localUser) {
|
||||
try {
|
||||
RemoteActor remoteActor = fetchRemoteActor(remoteActorUri);
|
||||
|
||||
|
|
@ -273,13 +273,13 @@ public class FederationService {
|
|||
acceptActivity.put("type", "Accept");
|
||||
acceptActivity.put("id", acceptId);
|
||||
acceptActivity.put("actor", actorUri);
|
||||
acceptActivity.put("object", createActivityId);
|
||||
acceptActivity.put("object", noteUri);
|
||||
|
||||
sendActivity(remoteActor.getInboxUrl(), acceptActivity, localUser);
|
||||
log.info("Sent Accept (quote approval) to: {} for Create {}", remoteActor.getActorUri(), createActivityId);
|
||||
log.info("Sent Accept (quote approval) to: {} for Note {}", remoteActor.getActorUri(), noteUri);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to send Accept for quote: {}", createActivityId, e);
|
||||
log.error("Failed to send Accept for quote: {}", noteUri, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,10 +287,16 @@ public class InboxProcessor {
|
|||
User localUser = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new IllegalArgumentException("User not found: " + username));
|
||||
|
||||
String createActivityId = (String) createActivity.get("id");
|
||||
log.info("Approving quote from {} for activity {} (Create id: {})", actor, activityId, createActivityId);
|
||||
// Mastodon tracks pending quote approvals by the Note URI (the inner
|
||||
// object's "id"), not by the wrapping Create activity's "id". The Accept
|
||||
// we send back must therefore reference the Note URI so Mastodon can match
|
||||
// it to the pending approval.
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> noteObject = (Map<String, Object>) createActivity.get("object");
|
||||
String noteUri = (String) noteObject.get("id");
|
||||
log.info("Approving quote from {} for activity {} (Note URI: {})", actor, activityId, noteUri);
|
||||
|
||||
federationService.sendAcceptQuote(createActivityId, actor, localUser);
|
||||
federationService.sendAcceptQuote(noteUri, actor, localUser);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error handling quote approval for {}", quoteUri, e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue