diff --git a/pontoon/base/forms.py b/pontoon/base/forms.py
index 181cb26864..217d79c2b0 100644
--- a/pontoon/base/forms.py
+++ b/pontoon/base/forms.py
@@ -93,7 +93,7 @@ def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user")
super().__init__(*args, **kwargs)
# Track if user reached new level for Community Builder Badge
- self.community_builder_level = 0
+ self.community_builder_level_reached = 0
def assign_users_to_groups(self, group_name, users):
"""
@@ -142,7 +142,7 @@ def save(self, *args, **kwargs):
after_count > before_count
and after_count in settings.BADGES_PROMOTION_THRESHOLDS
):
- self.community_builder_level = (
+ self.community_builder_level_reached = (
settings.BADGES_PROMOTION_THRESHOLDS.index(after_count) + 1
)
desc = """
@@ -152,7 +152,7 @@ def save(self, *args, **kwargs):
You can view this badge on your profile page .
""".format(
- level=self.community_builder_level,
+ level=self.community_builder_level_reached,
profile_href=reverse(
"pontoon.contributors.contributor.username",
kwargs={
@@ -163,11 +163,11 @@ def save(self, *args, **kwargs):
notify.send(
sender=self.user,
recipient=self.user,
- verb="", # Triggers render of description only
+ verb="ignore", # Triggers render of description only
description=desc,
)
- return self.community_builder_level
+ return self.community_builder_level_reached
class ProjectLocalePermsForm(UserPermissionLogFormMixin, forms.ModelForm):
diff --git a/pontoon/contributors/templates/contributors/widgets/notifications_menu.html b/pontoon/contributors/templates/contributors/widgets/notifications_menu.html
index 0f528ef5f6..00ee2800d3 100644
--- a/pontoon/contributors/templates/contributors/widgets/notifications_menu.html
+++ b/pontoon/contributors/templates/contributors/widgets/notifications_menu.html
@@ -76,7 +76,9 @@
+ {% if notification.verb != 'ignore' %}
{{ notification.verb.replace("has added a comment in", "has added a comment") }}
+ {% endif %}
{% if target %}
diff --git a/pontoon/teams/static/js/permissions.js b/pontoon/teams/static/js/permissions.js
index e99a3f89fc..2fb1fafc3f 100644
--- a/pontoon/teams/static/js/permissions.js
+++ b/pontoon/teams/static/js/permissions.js
@@ -46,6 +46,8 @@ $(function () {
});
});
+ const $tooltip = $('#badge-tooltip-container');
+
$.ajax({
url: $('#permissions-form').prop('action'),
type: $('#permissions-form').prop('method'),
@@ -56,23 +58,12 @@ $(function () {
// Check for new badge notification
if (badgeLevel > 0) {
- const $tooltip = $('#badge-tooltip-container');
-
- if ($tooltip.length) {
- $tooltip.show();
+ $tooltip.show();
- // Force a re-render of the text with the proper badge level
- $tooltip
- .find('p:nth-of-type(2)')
- .text(
- `Community Builder Badge level gained: Level ${badgeLevel}`,
- );
-
- $tooltip.find('button').one('click', function (e) {
- e.preventDefault();
- $tooltip.hide();
- });
- }
+ // Force a re-render of the text with the proper badge level
+ $tooltip
+ .find('.badge-tooltip-info')
+ .text(`Community Builder Badge level gained: Level ${badgeLevel}`);
const duration = 2000;
const animationEnd = Date.now() + duration;
@@ -113,6 +104,11 @@ $(function () {
Pontoon.endLoader('Oops, something went wrong.', 'error');
},
});
+
+ $tooltip.find('button').one('click', function (e) {
+ e.preventDefault();
+ $tooltip.hide();
+ });
});
// Switch available users
diff --git a/pontoon/teams/templates/teams/includes/permissions.html b/pontoon/teams/templates/teams/includes/permissions.html
index 83722307b4..408c0b6c19 100644
--- a/pontoon/teams/templates/teams/includes/permissions.html
+++ b/pontoon/teams/templates/teams/includes/permissions.html
@@ -3,11 +3,10 @@