Skip to content

Commit

Permalink
Rename user-facing instances of 'personal token' to 'time token' (#8322)
Browse files Browse the repository at this point in the history
* Rename user-facing instances of 'personal token' to 'time token'

* add new migration file

Co-authored-by: Aditya Anand M C <[email protected]>
  • Loading branch information
mds1 and thelostone-mc authored Feb 2, 2021
1 parent e89b62c commit ed7f904
Show file tree
Hide file tree
Showing 29 changed files with 130 additions and 77 deletions.
2 changes: 1 addition & 1 deletion app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
# board
re_path(r'^dashboard/?', dashboard.views.board, name='dashboard'),

# personal_tokens
# personal_tokens (now called Time Tokens)
re_path(r'^ptoken/quickstart/?', ptokens.views.quickstart, name='ptoken_quickstart'),
re_path(r'^ptoken/faq/?', ptokens.views.faq, name='ptokens_faq'),
path('ptokens/redemptions/<int:redemption_id>/', ptokens.views.ptoken_redemption, name='token_redemption'),
Expand Down
17 changes: 11 additions & 6 deletions app/assets/v2/js/board.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Personal token constants
// Time token constants
// Note: "Time Tokens" used to be called "Personal Tokens". To simplify the renaming process,
// variables, classes, and contracts continue to use the old name, but user-facing text uses the
// new name. Personal tokens and Time tokens are the same thing, so you will likely see those two
// phrases used interchangeably throughout the codebase

// Note that this address is also duplicated in profile_tokens.js and app/ptokens/models.py
const factoryAddress = document.contxt.ptoken_factory_address;

Expand Down Expand Up @@ -425,7 +430,7 @@ Vue.mixin({
change_price(pTokenId, price, transactionHash, network);
document.ptoken.price = price;

const successMsg = 'The price of your personal token has successfully been updated!';
const successMsg = 'The price of your time token has successfully been updated!';
const errorMsg = 'Oops, something went wrong changing your token price. Please try again or contact [email protected]';

await updatePtokenStatusinDatabase(transactionHash, successMsg, errorMsg);
Expand All @@ -450,7 +455,7 @@ Vue.mixin({
document.ptoken.supply = supply;
document.ptoken.available = supply - (document.ptoken.purchases - document.ptoken.redemptions);

const successMsg = 'The supply of your personal token has successfully been increased!';
const successMsg = 'The supply of your time token has successfully been increased!';
const errorMsg = 'Oops, something went wrong increasing your token supply. Please try again or contact [email protected]';

await updatePtokenStatusinDatabase(transactionHash, successMsg, errorMsg);
Expand All @@ -470,7 +475,7 @@ Vue.mixin({
document.ptoken.supply = supply;
document.ptoken.available = supply - (document.ptoken.purchases - document.ptoken.redemptions);

const successMsg = 'The supply of your personal token has successfully been decreased!';
const successMsg = 'The supply of your time token has successfully been decreased!';
const errorMsg = 'Oops, something went wrong decreased your token supply. Please try again or contact [email protected]';

await updatePtokenStatusinDatabase(transactionHash, successMsg, errorMsg);
Expand Down Expand Up @@ -536,8 +541,8 @@ Vue.mixin({

vm.user_has_token = true;
console.log('Token saved in database', ptokenReponse);
const successMsg = 'Congratulations, your personal token has been created successfully!';
const errorMsg = 'Oops, something went wrong trying to create your personal token. Please try again or contact [email protected]';
const successMsg = 'Congratulations, your time token has been created successfully!';
const errorMsg = 'Oops, something went wrong trying to create your time token. Please try again or contact [email protected]';

await updatePtokenStatusinDatabase(transactionHash, successMsg, errorMsg);
}).on('error', function(err) {
Expand Down
7 changes: 6 additions & 1 deletion app/assets/v2/js/pages/profile_tokens.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Personal token constants
// Time token constants
// Note: "Time Tokens" used to be called "Personal Tokens". To simplify the renaming process,
// variables, classes, and contracts continue to use the old name, but user-facing text uses the
// new name. Personal tokens and Time tokens are the same thing, so you will likely see those two
// phrases used interchangeably throughout the codebase

// Note that this address is also duplicated in board.js
const factoryAddress = document.contxt.ptoken_factory_address;
const purchaseTokenName = 'DAI';
Expand Down
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0169_auto_20210202_0726.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2021-02-02 07:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0168_auto_20201216_2058'),
]

operations = [
migrations.AlterField(
model_name='activity',
name='activity_type',
field=models.CharField(blank=True, choices=[('wall_post', 'Wall Post'), ('status_update', 'Update status'), ('hypercharge_bounty', 'Hypercharged bounty'), ('new_bounty', 'New Bounty'), ('start_work', 'Work Started'), ('stop_work', 'Work Stopped'), ('work_submitted', 'Work Submitted'), ('work_done', 'Work Done'), ('worker_approved', 'Worker Approved'), ('worker_rejected', 'Worker Rejected'), ('worker_applied', 'Worker Applied'), ('increased_bounty', 'Increased Funding'), ('killed_bounty', 'Canceled Bounty'), ('new_tip', 'New Tip'), ('receive_tip', 'Tip Received'), ('bounty_abandonment_escalation_to_mods', 'Escalated checkin from @gitcoinbot about bounty status'), ('bounty_abandonment_warning', 'Checkin from @gitcoinbot about bounty status'), ('bounty_removed_slashed_by_staff', 'Dinged and Removed from Bounty by Staff'), ('bounty_removed_by_staff', 'Removed from Bounty by Staff'), ('bounty_removed_by_funder', 'Removed from Bounty by Funder'), ('new_crowdfund', 'New Crowdfund Contribution'), ('new_grant', 'New Grant'), ('update_grant', 'Updated Grant'), ('killed_grant', 'Cancelled Grant'), ('negative_contribution', 'Negative Grant Contribution'), ('new_grant_contribution', 'Contributed to Grant'), ('new_grant_subscription', 'Subscribed to Grant'), ('killed_grant_contribution', 'Cancelled Grant Contribution'), ('new_kudos', 'New Kudos'), ('created_kudos', 'Created Kudos'), ('receive_kudos', 'Receive Kudos'), ('joined', 'Joined Gitcoin'), ('played_quest', 'Played Quest'), ('beat_quest', 'Beat Quest'), ('created_quest', 'Created Quest'), ('updated_avatar', 'Updated Avatar'), ('mini_clr_payout', 'Mini CLR Payout'), ('leaderboard_rank', 'Leaderboard Rank'), ('consolidated_leaderboard_rank', 'Consolidated Leaderboard Rank'), ('consolidated_mini_clr_payout', 'Consolidated CLR Payout'), ('hackathon_registration', 'Hackathon Registration'), ('hackathon_new_hacker', 'Hackathon Registration'), ('new_hackathon_project', 'New Hackathon Project'), ('flagged_grant', 'Flagged Grant'), ('create_ptoken', 'Create time token'), ('mint_ptoken', 'Mint time token'), ('edit_price_ptoken', 'Edit time token price'), ('buy_ptoken', 'Edit time token price'), ('accept_redemption_ptoken', 'Accepts a redemption request of ptoken'), ('denies_redemption_ptoken', 'Denies a redemption request of ptoken'), ('complete_redemption_ptoken', 'Completes an outgoing redemption'), ('incoming_redemption_ptoken', 'Has an incoming redemption finalized by the Buyer')], db_index=True, max_length=50),
),
]
10 changes: 5 additions & 5 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2286,11 +2286,11 @@ class Activity(SuperModel):
('hackathon_new_hacker', 'Hackathon Registration'),
('new_hackathon_project', 'New Hackathon Project'),
('flagged_grant', 'Flagged Grant'),
# ptokens
('create_ptoken', 'Create personal token'),
('mint_ptoken', 'Mint personal token'),
('edit_price_ptoken', 'Edit personal token price'),
('buy_ptoken', 'Edit personal token price'),
# ptokens (formerly called personal tokens, now called time tokens)
('create_ptoken', 'Create time token'),
('mint_ptoken', 'Mint time token'),
('edit_price_ptoken', 'Edit time token price'),
('buy_ptoken', 'Edit time token price'),
('accept_redemption_ptoken', 'Accepts a redemption request of ptoken'),
('denies_redemption_ptoken', 'Denies a redemption request of ptoken'),
('complete_redemption_ptoken', 'Completes an outgoing redemption'),
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/board/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<a class="nav-item nav-link nav-line active" id="funder-tab" data-toggle="tab" href="#nav-funder" role="tab" aria-controls="funder" aria-selected="false" @click="checkData('funder')">Funder</a>
<a class="nav-item nav-link nav-line " id="contributor-tab" data-toggle="tab" href="#nav-contributor" role="tab" aria-controls="contributor" aria-selected="true" @click="checkData('contributor')">Contributor</a>
{% if is_staff %}
<a class="nav-item nav-link nav-line alpha-warning" id="ptokens-tab" data-toggle="tab" href="#nav-ptokens" role="tab" aria-controls="ptokens" aria-selected="true" @click="checkData('personal-tokens')">Personal Tokens</a>
<a class="nav-item nav-link nav-line alpha-warning" id="ptokens-tab" data-toggle="tab" href="#nav-ptokens" role="tab" aria-controls="ptokens" aria-selected="true" @click="checkData('personal-tokens')">Time Tokens</a>
{% endif %}
</div>
</nav>
Expand Down
9 changes: 7 additions & 2 deletions app/dashboard/templates/board/ptokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
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/>.

Note: "Time Tokens" used to be called "Personal Tokens". To simplify the renaming process,
variables, classes, and contracts continue to use the old name, but user-facing text uses the
new name. Personal tokens and Time tokens are the same thing, so you will likely see those two
phrases used interchangeably throughout the codebase
{% endcomment %}
{% load i18n static add_url_schema avatar_tags %}

Expand Down Expand Up @@ -64,7 +69,7 @@
<div class="d-flex justify-content-between align-items-center p-4 border-bottom">
<template v-if="!user_has_token">
<div>
Create a personal token to get paid today for work tomorrow <a href="{% url 'ptoken_quickstart' %}" class="underline">Learn more</a>
Create a time token to get paid today for work tomorrow <a href="{% url 'ptoken_quickstart' %}" class="underline">Learn more</a>
</div>
<div id="showCreationSuccessModal" hidden data-toggle="modal" data-target="#createTokenSuccessModal"></div>
<button class="btn btn-sm btn-outline-gc-blue m-2" data-toggle="modal" data-target="#createTokenModal">
Expand All @@ -79,7 +84,7 @@
</button>
</template>
<template v-else-if="pToken.tx_status === 'success'">
<div>Modify your Personal Token</div>
<div>Modify your Time Token</div>
<button class="btn btn-sm btn-outline-gc-blue m-2" data-toggle="modal" data-target="#editpTokenModal">
Edit
</button>
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/dashboard/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</div>
</div>
<div class="g-multiselect pb-4 border-bottom form-group">
<label for="only-with-token" class="font-weight-bold">Personal Token?</label>
<label for="only-with-token" class="font-weight-bold">Time Token?</label>
<input v-model.lazy="params.only_with_token" type="checkbox" id="only-with-token" />
</div>
<div v-if="persona != 'tribe'" class="g-multiselect pb-4 border-bottom form-group">
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/templates/legal/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ <h2 class="font-title">11. GITCOIN CONTRACTS</h2>
<p>
As used herein, a “Service Contract” means, as applicable, the unilateral contractual provisions created by Poster that govern the Hunter Services to be performed by Hunter for Poster for a particular Task posted to the Site and which will typically include a description of the Task or Tasks to be completed, the amount and type of currency as compensation, and the deadline. You acknowledge and agree that Gitcoin is not a party to any Service Contracts, and that the formation of a Service Contract between any Posters and Hunters will not, under any circumstance, create an employment or other service relationship between Gitcoin and Poster or Gitcoin and Hunter.
</p>
<h2 class="font-title">12. GITCOIN PERSONAL TOKENS</h2>
<h2 class="font-title">12. GITCOIN TIME TOKENS</h2>
<p>
Gitcoin offers its Personal Token minting technology to allow users to independently create and distribute their own personal ERC20 tokens. After generating the tokens, users can transfer their personal tokens for a fixed price to purchasers who are users on the platform. In return, the purchaser will get access to 1 hour of time from the seller. All funds are transferred directly from the purchaser to the seller. The seller transfers the personal token directly from the personal token contract to the wallet of the purchaser. Gitcoin does not take custody of the token or the funds and currently does not collect any fees for providing this technology. Sellers shall provide a description of the services that a purchaser may redeem the Seller’s personal tokens for. Users agree to refrain from participating in any illegal activities in all applicable jurisdictions.
Gitcoin offers its Time Token minting technology to allow users to independently create and distribute their own personal ERC20 tokens. After generating the tokens, users can transfer their time tokens for a fixed price to purchasers who are users on the platform. In return, the purchaser will get access to 1 hour of time from the seller. All funds are transferred directly from the purchaser to the seller. The seller transfers the time token directly from the time token contract to the wallet of the purchaser. Gitcoin does not take custody of the token or the funds and currently does not collect any fees for providing this technology. Sellers shall provide a description of the services that a purchaser may redeem the Seller’s time tokens for. Users agree to refrain from participating in any illegal activities in all applicable jurisdictions.
</p>
<h2 class="font-title">13. PAYMENT</h2>
<p>
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/templates/profiles/scorecard_ptoken.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% trans "Token" %}
<div id="tooltip" class="float-right mt-2">
<i class='fa fa-info-circle' data-toggle="tooltip" data-html="true" data-delay="1000"
data-placement="bottom" title="{% if ptoken %}These tokens represent one hour of @{{ profile.handle }}‘s time. Open a redemption quest to use one today!{% else %}Personal Tokens represent an hour of this users time. To learn more, please reference this <a href='{% url "ptokens_faq" %}'>resource</a>.{% endif %} ">
data-placement="bottom" title="{% if ptoken %}These tokens represent one hour of @{{ profile.handle }}‘s time. Open a redemption quest to use one today!{% else %}Time Tokens represent an hour of this users time. To learn more, please reference this <a href='{% url "ptokens_faq" %}'>resource</a>.{% endif %} ">
</i>
</div>
</div>
Expand All @@ -32,7 +32,7 @@
<li id="ptoken-action" data-address="{{ ptoken.token_address }}" data-id="{{ ptoken.id }}">
{% if is_my_profile %}
{% if not ptoken %}
<a class="btn btn-outline-gc-blue btn-sm flex-grow-1 font-smaller-5" href="{% url 'ptoken_quickstart' %}">CREATE A PERSONAL TOKEN</a>
<a class="btn btn-outline-gc-blue btn-sm flex-grow-1 font-smaller-5" href="{% url 'ptoken_quickstart' %}">CREATE A TIME TOKEN</a>
{% endif %}
{% else %}
{% comment %} Buy button: Disable it if user holds no tokens or is not in a valid region {% endcomment %}
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/profiles/tab_ptokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="tab-projects d-flex flex-column">

{% if buyed_ptokens.count == 0 %}
No PTokens
No Time Tokens
{% endif %}
{% for ptoken in buyed_ptokens %}
<div class="tab-projects__item d-flex mb-0 {% cycle 'odd' 'even' %} pt-1 pb-1">
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/profiles/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{% endif %}
{% if is_staff and personal_tokens_count %}
<button type="button" id="nav-description" href="{{profile.url}}/ptokens" class="text-center section-tab {% if tab == "ptokens" %} active {% endif %}">
{% trans "PERSONAL TOKENS" %}
{% trans "TIME TOKENS" %}
{% if personal_tokens_count %}<span class="nav-badge">({{personal_tokens_count}})</span>{%endif%}
</button>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions app/grants/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
get_interrupted_contributions, get_replaced_tx, grant_activity, grant_categories, grant_details, grant_details_api,
grant_details_contributions, grant_details_contributors, grant_edit, grant_fund, grant_new, grant_new_whitelabel,
grants, grants_addr_as_json, grants_bulk_add, grants_by_grant_type, grants_cart_view, grants_info,
grants_stats_view, invoice, leaderboard, manage_ethereum_cart_data, new_matching_partner, profile, quickstart,
remove_grant_from_collection, save_collection, subscription_cancel, toggle_grant_favorite, verify_grant,
ingest_contributions_view, ingest_contributions
grants_stats_view, ingest_contributions, ingest_contributions_view, invoice, leaderboard, manage_ethereum_cart_data,
new_matching_partner, profile, quickstart, remove_grant_from_collection, save_collection, subscription_cancel,
toggle_grant_favorite, verify_grant,
)

app_name = 'grants'
Expand Down
2 changes: 1 addition & 1 deletion app/inbox/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def create_notification(sender, **kwargs):
activity.profile.user,
activity.profile.absolute_url,
'create_ptoken',
f'You <b>new personal token {activity.ptoken.token_symbol}</b> has been created!'
f'You <b>new time token {activity.ptoken.token_symbol}</b> has been created!'
)

if activity.activity_type == 'buy_ptoken':
Expand Down
10 changes: 9 additions & 1 deletion app/ptokens/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@
from retail.emails import premailer_transform


"""
Note: "Time Tokens" used to be called "Personal Tokens". To simplify the renaming process,
variables, classes, and contracts continue to use the old name, but user-facing text uses the
new name. Personal tokens and Time tokens are the same thing, so you will likely see those two
phrases used interchangeably throughout the codebase
"""


def render_ptoken_created(ptoken):
params = {'ptoken': ptoken}

response_html = premailer_transform(render_to_string("emails/ptoken_created.html", params))
response_txt = render_to_string("emails/ptoken_created.txt", params)
subject = _("🎉 Your new personal token is ready 🎉")
subject = _("🎉 Your new time token is ready 🎉")

return response_html, response_txt, subject

Expand Down
2 changes: 1 addition & 1 deletion app/ptokens/management/commands/update_ptoken_tx_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


class Command(BaseCommand):
help = 'gets the tx status of PTokens'
help = 'gets the tx status of Time Tokens'

def process_ptokens(self):
non_terminal_states = ['pending', 'na', 'unknown']
Expand Down
13 changes: 10 additions & 3 deletions app/ptokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@


class PersonalTokenQuerySet(models.QuerySet):
"""Handle the manager queryset for Personal Tokens."""
"""Handle the manager queryset for Personal Tokens (now called Time Tokens)."""

def visible(self):
"""Filter results down to visible tokens only."""
Expand All @@ -77,7 +77,14 @@ def keyword(self, keyword):


class PersonalToken(SuperModel):
"""Define the structure of a Personal Token"""
"""
Define the structure of a Time Token
Note: "Time Tokens" used to be called "Personal Tokens". To simplify the renaming process,
variables, classes, and contracts continue to use the old name, but user-facing text uses the
new name. Personal tokens and Time tokens are the same thing, so you will likely see those two
phrases used interchangeably throughout the codebase
"""

TOKEN_STATUS_CHOICES = [
('open', 'open'),
Expand Down Expand Up @@ -247,7 +254,7 @@ def update_tx_status(self):


class RedemptionToken(SuperModel):
"""Define the structure of a Redemption PToken"""
"""Define the structure of a Redemption Time token"""

REDEMPTION_STATUS_CHOICES = [
('request', 'requested'),
Expand Down
Loading

0 comments on commit ed7f904

Please sign in to comment.