forked from indymedia/epicyon
				
			Show locked account status on person options
							parent
							
								
									2bbdbe9774
								
							
						
					
					
						commit
						74547ca8d9
					
				|  | @ -47,6 +47,7 @@ from matrix import getMatrixAddress | ||||||
| from matrix import setMatrixAddress | from matrix import setMatrixAddress | ||||||
| from donate import getDonationUrl | from donate import getDonationUrl | ||||||
| from donate import setDonationUrl | from donate import setDonationUrl | ||||||
|  | from person import getLockedAccount | ||||||
| from person import setPersonNotes | from person import setPersonNotes | ||||||
| from person import getDefaultPersonContext | from person import getDefaultPersonContext | ||||||
| from person import savePersonQrcode | from person import savePersonQrcode | ||||||
|  | @ -5214,11 +5215,13 @@ class PubServer(BaseHTTPRequestHandler): | ||||||
|             jamiAddress = None |             jamiAddress = None | ||||||
|             ssbAddress = None |             ssbAddress = None | ||||||
|             emailAddress = None |             emailAddress = None | ||||||
|  |             lockedAccount = False | ||||||
|             actorJson = getPersonFromCache(baseDir, |             actorJson = getPersonFromCache(baseDir, | ||||||
|                                            optionsActor, |                                            optionsActor, | ||||||
|                                            self.server.personCache, |                                            self.server.personCache, | ||||||
|                                            True) |                                            True) | ||||||
|             if actorJson: |             if actorJson: | ||||||
|  |                 lockedAccount = getLockedAccount(actorJson) | ||||||
|                 donateUrl = getDonationUrl(actorJson) |                 donateUrl = getDonationUrl(actorJson) | ||||||
|                 xmppAddress = getXmppAddress(actorJson) |                 xmppAddress = getXmppAddress(actorJson) | ||||||
|                 matrixAddress = getMatrixAddress(actorJson) |                 matrixAddress = getMatrixAddress(actorJson) | ||||||
|  | @ -5247,7 +5250,8 @@ class PubServer(BaseHTTPRequestHandler): | ||||||
|                                     PGPpubKey, PGPfingerprint, |                                     PGPpubKey, PGPfingerprint, | ||||||
|                                     emailAddress, |                                     emailAddress, | ||||||
|                                     self.server.dormantMonths, |                                     self.server.dormantMonths, | ||||||
|                                     backToPath).encode('utf-8') |                                     backToPath, | ||||||
|  |                                     lockedAccount).encode('utf-8') | ||||||
|             msglen = len(msg) |             msglen = len(msg) | ||||||
|             self._set_headers('text/html', msglen, |             self._set_headers('text/html', msglen, | ||||||
|                               cookie, callingDomain) |                               cookie, callingDomain) | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								person.py
								
								
								
								
							
							
						
						
									
										10
									
								
								person.py
								
								
								
								
							|  | @ -201,6 +201,16 @@ def getDefaultPersonContext() -> str: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def getLockedAccount(actorJson: {}) -> bool: | ||||||
|  |     """Returns whether the given account requires follower approval | ||||||
|  |     """ | ||||||
|  |     if not actorJson.get('manuallyApprovesFollowers'): | ||||||
|  |         return False | ||||||
|  |     if actorJson['manuallyApprovesFollowers'] is True: | ||||||
|  |         return True | ||||||
|  |     return False | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, | def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, | ||||||
|                       httpPrefix: str, saveToFile: bool, |                       httpPrefix: str, saveToFile: bool, | ||||||
|                       manualFollowerApproval: bool, |                       manualFollowerApproval: bool, | ||||||
|  |  | ||||||
|  | @ -45,7 +45,8 @@ def htmlPersonOptions(defaultTimeline: str, | ||||||
|                       PGPfingerprint: str, |                       PGPfingerprint: str, | ||||||
|                       emailAddress: str, |                       emailAddress: str, | ||||||
|                       dormantMonths: int, |                       dormantMonths: int, | ||||||
|                       backToPath: str) -> str: |                       backToPath: str, | ||||||
|  |                       lockedAccount: bool) -> str: | ||||||
|     """Show options for a person: view/follow/block/report |     """Show options for a person: view/follow/block/report | ||||||
|     """ |     """ | ||||||
|     optionsDomain, optionsPort = getDomainFromActor(optionsActor) |     optionsDomain, optionsPort = getDomainFromActor(optionsActor) | ||||||
|  | @ -112,6 +113,8 @@ def htmlPersonOptions(defaultTimeline: str, | ||||||
|         '" ' + getBrokenLinkSubstitute() + '/></a>\n' |         '" ' + getBrokenLinkSubstitute() + '/></a>\n' | ||||||
|     handle = getNicknameFromActor(optionsActor) + '@' + optionsDomain |     handle = getNicknameFromActor(optionsActor) + '@' + optionsDomain | ||||||
|     handleShown = handle |     handleShown = handle | ||||||
|  |     if lockedAccount: | ||||||
|  |         handleShown += '🔒' | ||||||
|     if dormant: |     if dormant: | ||||||
|         handleShown += ' 💤' |         handleShown += ' 💤' | ||||||
|     optionsStr += \ |     optionsStr += \ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue