forked from indymedia/epicyon
Undo like from web interface
parent
7c7ace43f9
commit
f5da898007
|
@ -708,7 +708,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if not self.server.session:
|
||||
self.server.session= \
|
||||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
likeActor=self.server.httpPrefix+'://'+self.server.fullDomain+'/users/'+self.postToNickname
|
||||
likeActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname
|
||||
likeJson= {
|
||||
'type': 'Like',
|
||||
'actor': likeActor,
|
||||
|
@ -730,7 +730,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if not self.server.session:
|
||||
self.server.session= \
|
||||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
undoActor=self.server.httpPrefix+'://'+self.server.fullDomain+'/users/'+self.postToNickname
|
||||
undoActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname
|
||||
undoLikeJson= {
|
||||
'type': 'Undo',
|
||||
'actor': undoActor,
|
||||
|
@ -743,7 +743,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
},
|
||||
'to': [undoActor+'/followers'],
|
||||
'cc': []
|
||||
}
|
||||
}
|
||||
if undoLikeJson:
|
||||
self._postToOutbox(undoLikeJson)
|
||||
self.server.GETbusy=False
|
||||
|
|
15
like.py
15
like.py
|
@ -19,9 +19,9 @@ from webfinger import webfingerHandle
|
|||
from auth import createBasicAuthHeader
|
||||
from posts import getPersonBox
|
||||
|
||||
def undoLikesCollectionEntry(postFilename: str,objectUrl: str, actor: str,debug: bool) -> None:
|
||||
def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug: bool) -> None:
|
||||
"""Undoes a like for a particular actor
|
||||
"""
|
||||
"""
|
||||
with open(postFilename, 'r') as fp:
|
||||
postJsonObject=commentjson.load(fp)
|
||||
if not postJsonObject.get('type'):
|
||||
|
@ -480,22 +480,15 @@ def outboxUndoLike(baseDir: str,httpPrefix: str, \
|
|||
""" When an undo like request is received by the outbox from c2s
|
||||
"""
|
||||
if not messageJson.get('type'):
|
||||
if debug:
|
||||
print('DEBUG: undo like - no type')
|
||||
return
|
||||
if not messageJson['type']=='Undo':
|
||||
if debug:
|
||||
print('DEBUG: not an undo of Like')
|
||||
return
|
||||
if not messageJson.get('object'):
|
||||
if debug:
|
||||
print('DEBUG: no object in undo like')
|
||||
return
|
||||
if not isinstance(messageJson['object']['object'], dict):
|
||||
if not isinstance(messageJson['object'], dict):
|
||||
if debug:
|
||||
print('DEBUG: undo like object is not dict')
|
||||
return
|
||||
|
||||
return
|
||||
if not messageJson['object'].get('type'):
|
||||
if debug:
|
||||
print('DEBUG: undo like - no type')
|
||||
|
|
Loading…
Reference in New Issue