Junior — Senior
Conduct a review of the presented code
livecode
Task condition
Situation:
- A pull request from a novice developer from a neighboring team has appeared on your desk.
- The project has been around for a long time, and it has almost no supporting developers.
- Nevertheless, you will need to carefully study and evaluate the changes.
- This module is responsible for sending notifications to users, and its history spans years.
from myapp import *
@shared_task
def send_deep_link_to_phone(phone_number, ip_addr):
# code = unicode(random.randrange(MIN_VER_INT, MAX_VER_INT))
# hash_code = sha256(code)
# phone_auth = PhoneAuth(**dict(phone=phone_number, code=hash_code, ip_address=ip_addr))
# phone_auth.save()
# url = request('post', settings.BRANCH_URL_DEEP_LINK, {'branch_key': settings.BRANCH_API_KEY,
# 'channel': 'sms',
# 'data': json.dumps({'phone': phone_number, 'code': code})},
# need_auth=False)
# url = json.loads(url)['url']
# deep = DeepLinkRedirect.generate_with_url(url)
# full_url_redirect = site_base_url('l/' + deep.object_id)
full_url_redirect = site_base_url('l/app')
message_text = 'Install the app: %s' % full_url_redirect
sms_msg = SMSMessage(**dict(text=message_text, phone=phone_number))
sms_msg.save()
send_sms.delay(sms_msg)