Moderation button is highlighted if a new report appears

main
Bob Mottram 2019-11-16 15:24:07 +00:00
parent 96fd59d295
commit b4bcbf4a8c
2 changed files with 26 additions and 1 deletions

View File

@ -1000,7 +1000,7 @@ def createReportPost(baseDir: str,
postTo=moderatorsList
postCc=None
postJsonObject=None
for toUrl in postTo:
for toUrl in postTo:
postJsonObject= \
createPostBase(baseDir,nickname, domain, port, \
toUrl,postCc, \
@ -1010,6 +1010,21 @@ def createReportPost(baseDir: str,
imageDescription,useBlurhash, \
True,None, None, subject, \
None,None,None)
if not postJsonObject:
continue
# save a notification file so that the moderator
# knows something new has appeared
toNickname=toUrl.split('/users/')[1]
handle=toNickname+'@'+domain
newReportFile=baseDir+'/accounts/'+handle+'/.newReport'
if os.path.isfile(newReportFile):
continue
try:
with open(newReportFile, 'w') as fp:
fp.write(toUrl+'/moderation')
except:
pass
return postJsonObject
def threadSendPost(session,postJsonStr: str,federationList: [],\

View File

@ -2366,6 +2366,14 @@ def htmlTimeline(translate: {},pageNumber: int, \
if boxName=='tlshares':
os.remove(newShareFile)
# should the Moderation button be highlighted?
newReport=False
newReportFile=accountDir+'/.newReport'
if os.path.isfile(newReportFile):
newReport=True
if boxName=='moderation':
os.remove(newReportFile)
iconsDir=getIconsDir(baseDir)
cssFilename=baseDir+'/epicyon-profile.css'
if os.path.isfile(baseDir+'/epicyon.css'):
@ -2416,6 +2424,8 @@ def htmlTimeline(translate: {},pageNumber: int, \
sentButton='buttonselected'
elif boxName=='moderation':
moderationButton='buttonselected'
if newReport:
moderationButton='buttonselectedhighlighted'
elif boxName=='tlshares':
sharesButton='buttonselected'
if newShare: