Show petname on person options screen

main
Bob Mottram 2020-06-29 17:25:28 +01:00
parent 41667cface
commit 46b1eea06a
17 changed files with 46 additions and 18 deletions

View File

@ -59,14 +59,14 @@ def getPetName(baseDir: str, nickname: str, domain: str,
"""Given a handle returns the petname
"""
if '@' not in handle:
return None
return ''
if handle.startswith('@'):
handle = handle[1:]
petnamesFilename = baseDir + '/accounts/' + \
nickname + '@' + domain + '/petnames.txt'
if not os.path.isfile(petnamesFilename):
return None
return ''
with open(petnamesFilename, 'r') as petnamesFile:
petnamesStr = petnamesFile.read()
if ' ' + handle + '\n' in petnamesStr:
@ -74,4 +74,4 @@ def getPetName(baseDir: str, nickname: str, domain: str,
for pet in petnamesList:
if pet.endswith(' ' + handle):
return pet.replace(' ' + handle, '').strip()
return None
return ''

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "ملاحظة مجدولة لنفسك",
"Replying to": "الرد على",
"Send to": "ارسل إلى",
"Show a list of addresses to send to": "عرض قائمة بالعناوين التي تريد الإرسال إليها"
"Show a list of addresses to send to": "عرض قائمة بالعناوين التي تريد الإرسال إليها",
"Petname": "Petname"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nota programada a tu mateix",
"Replying to": "Responent a",
"Send to": "Envia a",
"Show a list of addresses to send to": "Mostra una llista dadreces a les quals enviar-la"
"Show a list of addresses to send to": "Mostra una llista dadreces a les quals enviar-la",
"Petname": "Nom de mascota"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nodyn wedi'i drefnu i chi'ch hun",
"Replying to": "Ymateb i",
"Send to": "Anfon i",
"Show a list of addresses to send to": "Dangoswch restr o gyfeiriadau i anfon atynt"
"Show a list of addresses to send to": "Dangoswch restr o gyfeiriadau i anfon atynt",
"Petname": "Enw anwes"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Geplante Notiz an dich",
"Replying to": "Antworten auf",
"Send to": "Senden an",
"Show a list of addresses to send to": "Zeigen Sie eine Liste der Adressen an, an die gesendet werden soll"
"Show a list of addresses to send to": "Zeigen Sie eine Liste der Adressen an, an die gesendet werden soll",
"Petname": "Haustiername"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Scheduled note to yourself",
"Replying to": "Replying to",
"Send to": "Send to",
"Show a list of addresses to send to": "Show a list of addresses to send to"
"Show a list of addresses to send to": "Show a list of addresses to send to",
"Petname": "Petname"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nota programada para ti",
"Replying to": "Respondiendo a",
"Send to": "Enviar a",
"Show a list of addresses to send to": "Mostrar una lista de direcciones para enviar"
"Show a list of addresses to send to": "Mostrar una lista de direcciones para enviar",
"Petname": "Nombre de mascota"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Note programmée pour vous",
"Replying to": "Répondre à",
"Send to": "Envoyer à",
"Show a list of addresses to send to": "Afficher une liste d'adresses à envoyer"
"Show a list of addresses to send to": "Afficher une liste d'adresses à envoyer",
"Petname": "Nom d'animal domestique"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nóta sceidealta duit féin",
"Replying to": "Ag freagairt do",
"Send to": "Sheoladh chuig",
"Show a list of addresses to send to": "Taispeáin liosta seoltaí le seoladh chucu"
"Show a list of addresses to send to": "Taispeáin liosta seoltaí le seoladh chucu",
"Petname": "Ainmainm"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "खुद को निर्धारित नोट",
"Replying to": "को जवाब दे रहा है",
"Send to": "भेजना",
"Show a list of addresses to send to": "भेजने के लिए पते की एक सूची दिखाएं"
"Show a list of addresses to send to": "भेजने के लिए पते की एक सूची दिखाएं",
"Petname": "अल्पार्थक नाम"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nota programmata per te",
"Replying to": "In risposta a",
"Send to": "Inviare a",
"Show a list of addresses to send to": "Mostra un elenco di indirizzi a cui inviare"
"Show a list of addresses to send to": "Mostra un elenco di indirizzi a cui inviare",
"Petname": "Nome del cucciolo"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "自分への予定されたメモ",
"Replying to": "に返信しています",
"Send to": "に送る",
"Show a list of addresses to send to": "送信するアドレスのリストを表示する"
"Show a list of addresses to send to": "送信するアドレスのリストを表示する",
"Petname": "ペットネーム"
}

View File

@ -233,5 +233,6 @@
"Scheduled note to yourself": "Scheduled note to yourself",
"Replying to": "Replying to",
"Send to": "Send to",
"Show a list of addresses to send to": "Show a list of addresses to send to"
"Show a list of addresses to send to": "Show a list of addresses to send to",
"Petname": "Petname"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Nota agendada para si mesmo",
"Replying to": "Respondendo a",
"Send to": "Enviar para",
"Show a list of addresses to send to": "Mostrar uma lista de endereços para enviar para"
"Show a list of addresses to send to": "Mostrar uma lista de endereços para enviar para",
"Petname": "Nome do animal de estimação"
}

View File

@ -237,5 +237,6 @@
"Scheduled note to yourself": "Запланированная заметка для себя",
"Replying to": "Отвечать на",
"Send to": "Отправить",
"Show a list of addresses to send to": "Показать список адресов для отправки"
"Show a list of addresses to send to": "Показать список адресов для отправки",
"Petname": "Имя питомца"
}

View File

@ -236,5 +236,6 @@
"Scheduled note to yourself": "预定给自己的笔记",
"Replying to": "回覆",
"Send to": "发给",
"Show a list of addresses to send to": "显示要发送到的地址列表"
"Show a list of addresses to send to": "显示要发送到的地址列表",
"Petname": "宠物名"
}

View File

@ -73,6 +73,7 @@ from happening import getCalendarEvents
from happening import getTodaysEvents
from git import isGitPatch
from theme import getThemesList
from petnames import getPetName
def getContentWarningButton(postID: str, translate: {},
@ -5312,6 +5313,10 @@ def htmlPersonOptions(translate: {}, baseDir: str,
"""Show options for a person: view/follow/block/report
"""
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
optionsDomainFull = optionsDomain
if optionsPort:
if optionsPort != 80 and optionsPort != 443:
optionsDomainFull = optionsDomain + ':' + str(optionsPort)
if os.path.isfile(baseDir + '/img/options-background.png'):
if not os.path.isfile(baseDir + '/accounts/options-background.png'):
@ -5321,6 +5326,7 @@ def htmlPersonOptions(translate: {}, baseDir: str,
followStr = 'Follow'
blockStr = 'Block'
nickname = None
optionsNickname = None
if originPathStr.startswith('/users/'):
nickname = originPathStr.split('/users/')[1]
if '/' in nickname:
@ -5408,6 +5414,13 @@ def htmlPersonOptions(translate: {}, baseDir: str,
optionsActor + '">'
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \
optionsProfileUrl + '">'
if optionsNickname:
handle = optionsNickname + '@' + optionsDomainFull
petname = getPetName(baseDir, nickname, domain, handle)
optionsStr += \
'<p>' + translate['Petname'] + ': ' + \
'<input type="text" name="optionpetname" value="' + \
petname + '"></p>'
optionsStr += optionsLinkStr
optionsStr += \
' <button type="submit" class="button" name="submitView">' + \