Add moderation status to post

master
Bob Mottram 2019-08-11 21:38:10 +01:00
parent 33cbe80c20
commit 3d8277dcab
3 changed files with 28 additions and 11 deletions

View File

@ -3,6 +3,7 @@
:root { :root {
--main-bg-color: #282c37; --main-bg-color: #282c37;
--main-bg-color-darker: #232c37; --main-bg-color-darker: #232c37;
--main-bg-color-report: #221c27;
--main-header-color-roles: #282237; --main-header-color-roles: #282237;
--main-fg-color: #dddddd; --main-fg-color: #dddddd;
--main-link-color: #999; --main-link-color: #999;
@ -372,6 +373,11 @@ a:link {
background-color: var(--main-bg-color-darker); background-color: var(--main-bg-color-darker);
} }
.report {
border-color: #255;
background-color: var(--main-bg-color-report);
}
.container img.attachment { .container img.attachment {
max-width: 100%; max-width: 100%;
margin-left: 25%; margin-left: 25%;

View File

@ -392,9 +392,10 @@ def updateHashtagsIndex(baseDir: str,tag: {},newPostId: str) -> None:
def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
toUrl: str, ccUrl: str, httpPrefix: str, content: str, \ toUrl: str, ccUrl: str, httpPrefix: str, content: str, \
followersOnly: bool, saveToFile: bool, clientToServer: bool, followersOnly: bool, saveToFile: bool, clientToServer: bool, \
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,imageDescription: str, \
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: useBlurhash: bool,isModerationReport: bool,inReplyTo=None, \
inReplyToAtomUri=None, subject=None) -> {}:
"""Creates a message """Creates a message
""" """
mentionedRecipients=[] mentionedRecipients=[]
@ -421,7 +422,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
postTo=postCC postTo=postCC
postCC='' postCC=''
newPostId=httpPrefix+'://'+domain+'/users/'+nickname+'/statuses/'+statusNumber newPostId=httpPrefix+'://'+domain+'/users/'+nickname+'/statuses/'+statusNumber
sensitive=False sensitive=False
summary=None summary=None
if subject: if subject:
@ -547,6 +548,14 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
newPost['cc']=[ccUrl] newPost['cc']=[ccUrl]
if newPost.get('object'): if newPost.get('object'):
newPost['object']['cc']=[ccUrl] newPost['object']['cc']=[ccUrl]
# if this is a moderation report then add a status
if isModerationReport:
if newPost.get('object'):
newPost['object']['moderationStatus']='pending'
else:
newPost['moderationStatus']='pending'
if saveToFile: if saveToFile:
savePostToBox(baseDir,httpPrefix,newPostId, \ savePostToBox(baseDir,httpPrefix,newPostId, \
nickname,domain,newPost,'outbox') nickname,domain,newPost,'outbox')
@ -663,7 +672,7 @@ def createPublicPost(baseDir: str,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo, inReplyToAtomUri, subject) False,inReplyTo,inReplyToAtomUri,subject)
def createUnlistedPost(baseDir: str, def createUnlistedPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
@ -683,7 +692,7 @@ def createUnlistedPost(baseDir: str,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def createFollowersOnlyPost(baseDir: str, def createFollowersOnlyPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
@ -703,7 +712,7 @@ def createFollowersOnlyPost(baseDir: str,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) -> []: def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) -> []:
"""Extracts a list of mentioned actors from the given message content """Extracts a list of mentioned actors from the given message content
@ -752,7 +761,7 @@ def createDirectMessagePost(baseDir: str,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def createReportPost(baseDir: str, def createReportPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
@ -823,7 +832,7 @@ def createReportPost(baseDir: str,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
None, None, subject) True,None, None, subject)
return postJsonObject return postJsonObject
def threadSendPost(session,postJsonObject: {},federationList: [],\ def threadSendPost(session,postJsonObject: {},federationList: [],\
@ -914,7 +923,7 @@ def sendPost(session,baseDir: str,nickname: str, domain: str, port: int, \
toPersonId,cc,httpPrefix,content, \ toPersonId,cc,httpPrefix,content, \
followersOnly,saveToFile,clientToServer, \ followersOnly,saveToFile,clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo,inReplyToAtomUri,subject) False,inReplyTo,inReplyToAtomUri,subject)
# get the senders private key # get the senders private key
privateKeyPem=getPersonKey(nickname,domain,baseDir,'private') privateKeyPem=getPersonKey(nickname,domain,baseDir,'private')
@ -1013,7 +1022,7 @@ def sendPostViaServer(baseDir,session,fromNickname: str,password: str, \
toPersonId,cc,httpPrefix,content, \ toPersonId,cc,httpPrefix,content, \
followersOnly,saveToFile,clientToServer, \ followersOnly,saveToFile,clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
inReplyTo,inReplyToAtomUri,subject) False,inReplyTo,inReplyToAtomUri,subject)
authHeader=createBasicAuthHeader(fromNickname,password) authHeader=createBasicAuthHeader(fromNickname,password)

View File

@ -934,6 +934,8 @@ def individualPostAsHtml(baseDir: str, \
contentStr='' contentStr=''
if postJsonObject['object'].get('summary'): if postJsonObject['object'].get('summary'):
contentStr+='<b>'+postJsonObject['object']['summary']+'</b> ' contentStr+='<b>'+postJsonObject['object']['summary']+'</b> '
if postJsonObject['object'].get('moderationStatus'):
containerClass='container report'
else: else:
contentStr+='<b>Sensitive</b> ' contentStr+='<b>Sensitive</b> '
contentStr+='<button class="cwButton" onclick="showContentWarning('+"'"+postID+"'"+')">SHOW MORE</button>' contentStr+='<button class="cwButton" onclick="showContentWarning('+"'"+postID+"'"+')">SHOW MORE</button>'