Include whether the post is a reply to you in speaker endpoint

Note this is different than the flag indicating that a reply has happened sometime
main
Bob Mottram 2021-03-16 12:59:43 +00:00
parent 59f1979065
commit 1442c15339
1 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import urllib.parse
from auth import createBasicAuthHeader from auth import createBasicAuthHeader
from session import getJson from session import getJson
from utils import isDM from utils import isDM
from utils import isReply
from utils import camelCaseSplit from utils import camelCaseSplit
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
@ -293,7 +294,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
followRequestsList: [], followRequestsList: [],
likedBy: str, published: str, postCal: bool, likedBy: str, published: str, postCal: bool,
postShare: bool, themeName: str, postShare: bool, themeName: str,
isDirect: bool) -> {}: isDirect: bool, replyToYou: bool) -> {}:
"""Returns a json endpoint for the TTS speaker """Returns a json endpoint for the TTS speaker
""" """
speakerJson = { speakerJson = {
@ -306,6 +307,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
"detectedLinks": links, "detectedLinks": links,
"id": postId, "id": postId,
"direct": isDirect, "direct": isDirect,
"replyToYou": replyToYou,
"notify": { "notify": {
"theme": themeName, "theme": themeName,
"dm": postDM, "dm": postDM,
@ -457,6 +459,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
img['name'] + '. ' img['name'] + '. '
isDirect = isDM(postJsonObject) isDirect = isDM(postJsonObject)
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
replyToYou = isReply(postJsonObject, actor)
published = '' published = ''
if postJsonObject['object'].get('published'): if postJsonObject['object'].get('published'):
@ -531,7 +535,7 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
followRequestsList, followRequestsList,
likedBy, published, likedBy, published,
postCal, postShare, themeName, postCal, postShare, themeName,
isDirect) isDirect, replyToYou)
def updateSpeaker(baseDir: str, httpPrefix: str, def updateSpeaker(baseDir: str, httpPrefix: str,