From e789f88c4b1cc931af12670deb6663ce7c512c8b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 29 Jun 2020 10:34:22 +0100 Subject: [PATCH] Select dm recipient from list --- webinterface.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/webinterface.py b/webinterface.py index dcc0466e..4eea3fd3 100644 --- a/webinterface.py +++ b/webinterface.py @@ -316,6 +316,26 @@ def htmlFollowingList(baseDir: str, followingFilename: str) -> str: return '' +def htmlFollowingDataList(baseDir: str, nickname: str, domain: str) -> str: + """Returns a datalist of handles being followed + """ + listStr = '\n' + followingFilename = \ + baseDir + '/accounts/' + nickname + '@' + domain + '/following.txt' + if os.path.isfile(followingFilename): + with open(followingFilename, 'r') as followingFile: + msg = followingFile.read() + followingList = msg.split('\n') + followingList.sort() + if followingList: + for followingAddress in followingList: + if followingAddress: + listStr += \ + '\n' + listStr += '\n' + return listStr + + def htmlSearchEmoji(translate: {}, baseDir: str, httpPrefix: str, searchStr: str) -> str: """Search results for emoji @@ -2113,17 +2133,18 @@ def htmlNewPost(mediaInstance: bool, translate: {}, if inReplyTo: newPostForm += \ '
' + '
\n' else: newPostForm += \ ' ' \ ' 📄
' + translate['Send to'] + ':' + ' 📄
\n' newPostForm += \ ' ' + 'list="followingHandles" value="' + mentionsStr + '" selected>\n' + newPostForm += htmlFollowingDataList(baseDir, nickname, domain) newPostForm += '' selectedStr = ''