Show author name in squeak timeline items (#132)

This commit is contained in:
Jonathan Zernik 2020-07-23 17:26:54 -07:00 committed by GitHub
parent 6d7247eb13
commit 5904ed9a11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -352,6 +352,9 @@ def run():
assert (
len(get_address_squeak_display_response.squeak_display_entries) == 2
)
for squeak_display_entry in get_address_squeak_display_response.squeak_display_entries:
assert squeak_display_entry.author_name == "bob"
assert squeak_display_entry.author_address == squeak_profile_address
# Get squeak profile by address
get_profile_by_address_response = admin_stub.GetSqueakProfileByAddress(

View file

@ -174,7 +174,10 @@ message SqueakDisplayEntry {
bool is_author_known = 8;
/// The author name
string author_name = 9;
string author_address = 9;
/// The author name
string author_name = 10;
}
message GetFollowedSqueakDisplaysRequest {

View file

@ -119,12 +119,19 @@ class SqueakAdminServerServicer(squeak_admin_pb2_grpc.SqueakAdminServicer):
block_header = squeak_entry.block_header
is_unlocked = squeak.HasDecryptionKey()
content_str = squeak.GetDecryptedContentStr() if is_unlocked else None
squeak_profile = squeak_entry_with_profile.squeak_profile
is_author_known = squeak_profile is not None
author_name = squeak_profile.profile_name if squeak_profile else None
author_address = str(squeak.GetAddress())
return squeak_admin_pb2.SqueakDisplayEntry(
squeak_hash=get_hash(squeak).hex(),
is_unlocked=squeak.HasDecryptionKey(),
content_str=content_str,
block_height=squeak.nBlockHeight,
block_time=block_header.nTime,
is_author_known=is_author_known,
author_name=author_name,
author_address=author_address,
)
def _squeak_profile_to_message(self, squeak_profile):