Skip to content

Commit

Permalink
feat(billing): merge NLP addons feature into main TASK-1255 (#5265)
Browse files Browse the repository at this point in the history
### 📣 Summary
Adds billing and tracking support for one-time addons.


### 💭 Notes
This PR is for merging the `billing-addons-backend` feature branch into
`main`. All substantive changes have already been reviewed and tested,
though further testing will be conducted on the beta server once the
merge is completed. The frontend feature has been placed behind a
feature flag, and so will require the param
`?ff_oneTimeAddonsEnabled=true`.

---------

Co-authored-by: Jessica Thomas <jessica.thomas@kobotoolbox.org>
Co-authored-by: RuthShryock <ruthieshryock@gmail.com>
Co-authored-by: Guillermo <lgar89@gmail.com>
Co-authored-by: RuthShryock <81720958+RuthShryock@users.noreply.github.com>
Co-authored-by: Olivier Léger <olivierleger@gmail.com>
  • Loading branch information
6 people authored Nov 14, 2024
1 parent c47f297 commit cd3d200
Show file tree
Hide file tree
Showing 109 changed files with 3,235 additions and 982 deletions.
15 changes: 9 additions & 6 deletions hub/admin/extend_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from kobo.apps.trash_bin.models.account import AccountTrash
from kobo.apps.trash_bin.utils import move_to_trash
from kpi.models.asset import AssetDeploymentStatus

from .filters import UserAdvancedSearchFilter
from .mixins import AdvancedSearchMixin

Expand Down Expand Up @@ -167,9 +168,7 @@ class ExtendedUserAdmin(AdvancedSearchMixin, UserAdmin):
actions = ['remove', 'delete']

class Media:
css = {
'all': ('admin/css/inline_as_fieldset.css',)
}
css = {'all': ('admin/css/inline_as_fieldset.css',)}

@admin.action(description='Remove selected users (delete everything but their username)')
def remove(self, request, queryset, **kwargs):
Expand Down Expand Up @@ -293,9 +292,13 @@ def _filter_queryset_for_organization_user(self, queryset):
"""
Displays only users whose organization has a single member.
"""
return queryset.annotate(
user_count=Count('organizations_organization__organization_users')
).filter(user_count__lte=1).order_by('username')
return (
queryset.annotate(
user_count=Count('organizations_organization__organization_users')
)
.filter(user_count__lte=1)
.order_by('username')
)

def _remove_or_delete(
self,
Expand Down
18 changes: 6 additions & 12 deletions jsapp/js/account/accountSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ function AccountSidebar() {
setShowPlans(true);
}, [subscriptionStore.isInitialised]);

const showAddOnsLink = useMemo(() => {
return !subscriptionStore.planResponse.length;
}, [subscriptionStore.isInitialised]);

return (
<nav className={styles.accountSidebar}>
<AccountNavLink
Expand All @@ -78,14 +74,12 @@ function AccountSidebar() {
name={t('Plans')}
to={ACCOUNT_ROUTES.PLAN}
/>
{showAddOnsLink && (
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
)}
<AccountNavLink
iconName='plus'
name={t('Add-ons')}
to={ACCOUNT_ROUTES.ADD_ONS}
isNew
/>
</>
)}
</>
Expand Down
Loading

0 comments on commit cd3d200

Please sign in to comment.