Skip to content

Commit

Permalink
feat: implement forum comment author new (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
LIEN-YUHSIANG authored Oct 16, 2023
1 parent 216201d commit ea3dff4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/lambda/get-comments/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def get_comments(thread_id, uid=""):
r["mod"] = False
if r["uid"] == uid:
r["mod"] = True
r["uid"] = uid_encoder(uid)
del r["uid"]
r["uid_mod"] = uid_encoder(uid)

body = JsonPayloadBuilder().add_status(
True).add_data(results).add_message('').compile()
Expand Down
3 changes: 1 addition & 2 deletions src/lambda/get-comments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def uid_encoder(uid):
:return: Sha256 encoded uid
"""
hashed_uid = hashlib.sha256(uid.encode()).hexdigest()
transformed_uid = hashed_uid
# transformed_uid = hashed_uid[:6] #! Might cause collision if shorten it
transformed_uid = hashed_uid[:6]
return transformed_uid


Expand Down

0 comments on commit ea3dff4

Please sign in to comment.