Rename function

main
Bob Mottram 2020-07-11 21:44:20 +01:00
parent b9cbbdb9c8
commit ad55ea6f97
1 changed files with 8 additions and 8 deletions

View File

@ -79,9 +79,9 @@ from petnames import getPetName
from followingCalendar import receivingCalendarEvents from followingCalendar import receivingCalendarEvents
def getUrlPath(actor: str, domainFull: str, callingDomain: str) -> str: def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
"""Returns path from url """Returns alternate path from the actor
eg. https://somedomain/users/bob becomes /users/bob eg. https://clearnetdomain/path becomes http://oniondomain/path
""" """
postActor = actor postActor = actor
if callingDomain not in actor and domainFull in actor: if callingDomain not in actor and domainFull in actor:
@ -552,7 +552,7 @@ def htmlSearchSharedItems(translate: {},
sharedItemsForm += '</p></div>' sharedItemsForm += '</p></div>'
if not resultsExist and currPage > 1: if not resultsExist and currPage > 1:
postActor = \ postActor = \
getUrlPath(actor, domainFull, getAltPath(actor, domainFull,
callingDomain) callingDomain)
# previous page link, needs to be a POST # previous page link, needs to be a POST
sharedItemsForm += \ sharedItemsForm += \
@ -585,7 +585,7 @@ def htmlSearchSharedItems(translate: {},
currPage += 1 currPage += 1
if currPage > pageNumber: if currPage > pageNumber:
postActor = \ postActor = \
getUrlPath(actor, domainFull, getAltPath(actor, domainFull,
callingDomain) callingDomain)
# next page link, needs to be a POST # next page link, needs to be a POST
sharedItemsForm += \ sharedItemsForm += \
@ -5118,7 +5118,7 @@ def htmlRemoveSharedItem(translate: {}, baseDir: str,
sharesStr += \ sharesStr += \
' <p class="followText">' + translate['Remove'] + \ ' <p class="followText">' + translate['Remove'] + \
' ' + sharedItemDisplayName + ' ?</p>' ' ' + sharedItemDisplayName + ' ?</p>'
postActor = getUrlPath(actor, domainFull, callingDomain) postActor = getAltPath(actor, domainFull, callingDomain)
sharesStr += ' <form method="POST" action="' + postActor + '/rmshare">' sharesStr += ' <form method="POST" action="' + postActor + '/rmshare">'
sharesStr += ' <input type="hidden" name="actor" value="' + actor + '">' sharesStr += ' <input type="hidden" name="actor" value="' + actor + '">'
sharesStr += ' <input type="hidden" name="shareName" value="' + \ sharesStr += ' <input type="hidden" name="shareName" value="' + \
@ -5192,7 +5192,7 @@ def htmlDeletePost(recentPostsCache: {}, maxRecentPosts: int,
' <p class="followText">' + \ ' <p class="followText">' + \
translate['Delete this post?'] + '</p>' translate['Delete this post?'] + '</p>'
postActor = getUrlPath(actor, domainFull, callingDomain) postActor = getAltPath(actor, domainFull, callingDomain)
deletePostStr += \ deletePostStr += \
' <form method="POST" action="' + postActor + '/rmpost">' ' <form method="POST" action="' + postActor + '/rmpost">'
deletePostStr += \ deletePostStr += \
@ -5256,7 +5256,7 @@ def htmlCalendarDeleteConfirm(translate: {}, baseDir: str,
deletePostStr += ' <p class="followText">' + \ deletePostStr += ' <p class="followText">' + \
translate['Delete this event'] + '</p>' translate['Delete this event'] + '</p>'
postActor = getUrlPath(actor, domainFull, callingDomain) postActor = getAltPath(actor, domainFull, callingDomain)
deletePostStr += \ deletePostStr += \
' <form method="POST" action="' + postActor + '/rmpost">' ' <form method="POST" action="' + postActor + '/rmpost">'
deletePostStr += ' <input type="hidden" name="year" value="' + \ deletePostStr += ' <input type="hidden" name="year" value="' + \