Skip to content

Commit

Permalink
Project creation overhaul and minor fix (#721)
Browse files Browse the repository at this point in the history
* Currently, the email gets displayed on the user profile.  (#714)

* Fixed issue with comment form submitting when empty

* Add validation of username when creating new creator to make sure username is not entered as an email

* Fixed issue with comment form submitting when empty

* -

* Wrap error string with translation method

* Project creation (#718)

* Fixed issue with comment form submitting when empty

* Add validation of username when creating new creator to make sure username is not entered as an email

* Fixed issue with comment form submitting when empty

* -

* Wrap error string with translation method

* Create project creation form and navigation layouts

* Fix form spacing and made banner fixed on mobile

* modify videoInput component so the user can only add either a video or a video link. Not both at the same time

* Create Rich text editor component

* -

* create project in steps and modified project details page

* +

* removed extra linear gradient on project details page

* add method to display the right message based on current step and create mode

* Add success dialog to project details page after successful project creation

* bypass validation of image and video fields when publish mode is draft

* Added modal

* Create modal component

* Add dialogs for step 3 for user to add tags

* Add confetti to successfull project creation dialog

* refactored the dropdown component to allow maximum selection when the multiple prop is set and also add checkboxes when the withCheckbox property is set

* Add query to exclude a project in the list of projects of a creator

* Add more projects to project details page

* +

* validate multiple categories

* refactor sidenav

* Add project mode selection page

* +

* Fix edit

* +

* Add correct links to sidenav and modified the styles of the associated pages

* Fixes

* Accept multiple categories in a project

* refactor sidenav

* Add project mode selection page

* +

* Fix edit

* +

* Add correct links to sidenav and modified the styles of the associated pages

* Fixes

* +

* Update multiple categories

* +

* Add comments in project details

* Add cat to draft and my projects empty page

* unauthorized user navbar and categories new ui

* remove publish without tags dialog when tags are available

* Add preview page

* +

* Add link preview

* Made preview project to render in a modal

* Make landing page visible to non logged in users

* Add old search bar

* Fixes on profile

* +

* +

* +

* fix grid on other projects for non logged in users

* Add create activity to sidenav for staff users

* remove commented code and some clogs

* fixes

* update email regex

* Text & Font & Design changes

* Fix

* input improvement

---------

Co-authored-by: Yaya Mamoudou <[email protected]>
  • Loading branch information
tuxology and yaya-mamoudou authored Aug 23, 2023
1 parent 86c8f8c commit 4b3a255
Show file tree
Hide file tree
Showing 111 changed files with 6,820 additions and 4,392 deletions.
9 changes: 9 additions & 0 deletions zubhub_backend/zubhub/creators/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ class CustomRegisterSerializer(RegisterSerializer):
bio = serializers.CharField(allow_blank=True, default="", max_length=255)
subscribe = serializers.BooleanField(default=False)

def validate_username(self, username):
# Check if the value is a valid email
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
if re.match(pattern, username):
# If it's a valid email, raise an error
raise serializers.ValidationError(_("Username cannot be an email."))

return username

def validate_email(self, email):
if (len(email) == 0 and len(self.initial_data.get("phone", "")) == 0):
raise serializers.ValidationError(
Expand Down
4 changes: 1 addition & 3 deletions zubhub_backend/zubhub/creators/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
name="add_comment"),
path('delete/', DeleteCreatorAPIView.as_view(), name='delete_creator'),
path('locations/', LocationListAPIView.as_view(), name='location_list'),
path('<str:username>/projects/',
UserProjectsAPIView.as_view(),
name="user_projects"),
path('<str:username>/projects/',UserProjectsAPIView.as_view(),name="user_projects"),
path('<str:username>/drafts/',
UserDraftsAPIView.as_view(),
name="user_drafts"),
Expand Down
5 changes: 5 additions & 0 deletions zubhub_backend/zubhub/creators/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,24 @@ class UserProjectsAPIView(ListAPIView):
def get_queryset(self):
username = self.kwargs.get("username")
limit = self.request.GET.get("limit")
project_to_omit = self.request.GET.get('project_to_omit')
creator = Creator.objects.get(username=username)

if limit:
if hasattr(creator, "creatorgroup"):
return creator.creatorgroup.get_projects(limit=limit)
else:
all = creator.projects.exclude(publish__type=PublishingRule.DRAFT)
if(project_to_omit):
all = all.exclude(id=project_to_omit)
return get_published_projects_for_user(self.request.user, all)[:int(limit)]
else:
if hasattr(creator, "creatorgroup"):
return creator.creatorgroup.get_projects()
else:
all = creator.projects.exclude(publish__type=PublishingRule.DRAFT)
if(project_to_omit):
all = all.exclude(id=project_to_omit)
return get_published_projects_for_user(self.request.user, all)

class UserDraftsAPIView(ListAPIView):
Expand Down
Loading

0 comments on commit 4b3a255

Please sign in to comment.