forked from indymedia/epicyon
Unfollow/block buttons on profile
parent
ec25deea0f
commit
33909e83bf
|
@ -110,6 +110,23 @@ body, html {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttonunfollow {
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #999;
|
||||||
|
border: none;
|
||||||
|
color: #FFFFFF;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 10px;
|
||||||
|
width: 20%;
|
||||||
|
max-width: 200px;
|
||||||
|
min-width: 100px;
|
||||||
|
transition: all 0.5s;
|
||||||
|
cursor: pointer;
|
||||||
|
margin: 5px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.buttonhighlighted {
|
.buttonhighlighted {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: green;
|
background-color: green;
|
||||||
|
|
|
@ -341,12 +341,15 @@ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
||||||
authorized: bool,ocapAlways: bool, \
|
authorized: bool,ocapAlways: bool, \
|
||||||
nickname: str,domain: str,port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
session,wfRequest: {},personCache: {}, \
|
session,wfRequest: {},personCache: {}, \
|
||||||
followingJson: {}) -> str:
|
followingJson: {}, \
|
||||||
|
buttons: []) -> str:
|
||||||
"""Shows following on the profile screen
|
"""Shows following on the profile screen
|
||||||
"""
|
"""
|
||||||
profileStr=''
|
profileStr=''
|
||||||
for item in followingJson['orderedItems']:
|
for item in followingJson['orderedItems']:
|
||||||
profileStr+=individualFollowAsHtml(session,wfRequest,personCache,domain,item)
|
profileStr+= \
|
||||||
|
individualFollowAsHtml(session,wfRequest,personCache, \
|
||||||
|
domain,item,authorized,buttons)
|
||||||
return profileStr
|
return profileStr
|
||||||
|
|
||||||
def htmlProfileRoles(nickname: str,domain: str,rolesJson: {}) -> str:
|
def htmlProfileRoles(nickname: str,domain: str,rolesJson: {}) -> str:
|
||||||
|
@ -510,12 +513,20 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
||||||
htmlProfilePosts(baseDir,httpPrefix,authorized, \
|
htmlProfilePosts(baseDir,httpPrefix,authorized, \
|
||||||
ocapAlways,nickname,domain,port, \
|
ocapAlways,nickname,domain,port, \
|
||||||
session,wfRequest,personCache)
|
session,wfRequest,personCache)
|
||||||
if selected=='following' or selected=='followers':
|
if selected=='following':
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
htmlProfileFollowing(baseDir,httpPrefix, \
|
htmlProfileFollowing(baseDir,httpPrefix, \
|
||||||
authorized,ocapAlways,nickname, \
|
authorized,ocapAlways,nickname, \
|
||||||
domain,port,session, \
|
domain,port,session, \
|
||||||
wfRequest,personCache,extraJson)
|
wfRequest,personCache,extraJson, \
|
||||||
|
["unfollow"])
|
||||||
|
if selected=='followers':
|
||||||
|
profileStr+= \
|
||||||
|
htmlProfileFollowing(baseDir,httpPrefix, \
|
||||||
|
authorized,ocapAlways,nickname, \
|
||||||
|
domain,port,session, \
|
||||||
|
wfRequest,personCache,extraJson, \
|
||||||
|
["block"])
|
||||||
if selected=='roles':
|
if selected=='roles':
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
htmlProfileRoles(nickname,domainFull,extraJson)
|
htmlProfileRoles(nickname,domainFull,extraJson)
|
||||||
|
@ -530,7 +541,9 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
||||||
|
|
||||||
def individualFollowAsHtml(session,wfRequest: {}, \
|
def individualFollowAsHtml(session,wfRequest: {}, \
|
||||||
personCache: {},domain: str, \
|
personCache: {},domain: str, \
|
||||||
followUrl: str) -> str:
|
followUrl: str, \
|
||||||
|
authorized: bool, \
|
||||||
|
buttons=[]) -> str:
|
||||||
nickname=getNicknameFromActor(followUrl)
|
nickname=getNicknameFromActor(followUrl)
|
||||||
domain,port=getDomainFromActor(followUrl)
|
domain,port=getDomainFromActor(followUrl)
|
||||||
titleStr='@'+nickname+'@'+domain
|
titleStr='@'+nickname+'@'+domain
|
||||||
|
@ -542,11 +555,20 @@ def individualFollowAsHtml(session,wfRequest: {}, \
|
||||||
avatarUrl=avatarUrl2
|
avatarUrl=avatarUrl2
|
||||||
if preferredName:
|
if preferredName:
|
||||||
titleStr=preferredName+' '+titleStr
|
titleStr=preferredName+' '+titleStr
|
||||||
|
|
||||||
|
buttonsStr=''
|
||||||
|
if authorized:
|
||||||
|
for b in buttons:
|
||||||
|
if b=='block':
|
||||||
|
buttonsStr+='<a href="/inbox"><button class="buttonunfollow">Block</button></a>'
|
||||||
|
if b=='unfollow':
|
||||||
|
buttonsStr+='<a href="/inbox"><button class="buttonunfollow">Unfollow</button></a>'
|
||||||
|
|
||||||
return \
|
return \
|
||||||
'<div class="container">\n' \
|
'<div class="container">\n' \
|
||||||
'<a href="'+followUrl+'">' \
|
'<a href="'+followUrl+'">' \
|
||||||
'<img src="'+avatarUrl+'" alt="Avatar">\n'+ \
|
'<p><img src="'+avatarUrl+'" alt="Avatar">\n'+ \
|
||||||
'<p>'+titleStr+'</p></a>'+ \
|
titleStr+'</a>'+buttonsStr+'</p>' \
|
||||||
'</div>\n'
|
'</div>\n'
|
||||||
|
|
||||||
def contentWarningScript() -> str:
|
def contentWarningScript() -> str:
|
||||||
|
|
Loading…
Reference in New Issue