kudos.views

Define view for the Kudos app.

Copyright (C) 2018 Gitcoin Core

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

get_profile

get_profile(handle)

Get the gitcoin profile. TODO: This might be depreacted in favor of the sync_profile function in the future.

Args: handle (str): The github handle.

Returns: obj: The profile model object.

about

about(request)

Render the Kudos 'about' page.

marketplace

marketplace(request)

Render the Kudos 'marketplace' page.

search

search(request)

Render the search page.

TODO: This might no longer be used.

details

details(request, kudos_id, name)

Render the Kudos 'detail' page.

mint

mint(request)

Render the Kudos 'mint' page. This is mostly a placeholder for future functionality.

get_primary_from_email

get_primary_from_email(params, request)

Find the primary_from_email address. This function finds the address using this priority:

  1. If the email field is filed out in the Send POST request, use the fromEmail field.
  2. If the user is logged in, they should have an email address associated with their account. Use this as the second option. request_user_email.
  3. If all else fails, attempt to pull the email from the user's github account.

Args: params (dict): A dictionary parsed form the POST request. Typically this is a POST request coming in from a Tips/Kudos send.

Returns: str: The primary_from_email string.

kudos_preferred_wallet

kudos_preferred_wallet(request, handle)

Returns the address, if any, that someone would like to be send kudos directly to.

send_2

send_2(request)

Handle the first start of the Kudos email send.

This form is filled out before the 'send' button is clicked.

send_3

send_3(request)

Handle the third stage of sending a kudos (the POST).

This function is derived from send_tip_3. The request to send the kudos is added to the database, but the transaction has not happened yet. The txid is added in send_kudos_4.

Returns: JsonResponse: The response with success state.

csrf_exempt

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

send_4

send_4(request)

Handle the fourth stage of sending a tip (the POST).

Once the metamask transaction is complete, add it to the database.

Returns: JsonResponse: response with success state.

csrf_exempt

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

receive

receive(request, key, txid, network)

Handle the receiving of a kudos (the POST).

Returns: TemplateResponse: the UI with the kudos confirmed