Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promote: develop changes to preview #3280

Merged
merged 17 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
05eb728
chore: cycle & module sidebar improvement (#3251)
anmolsinghbhatia Dec 27, 2023
78428fb
chore: estimates and issue parent id fixes (#3188)
NarayanBavisetti Dec 27, 2023
ff8008c
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Dec 27, 2023
5496492
fix: adding links to dashboard summary items
sriramveeraghanta Dec 27, 2023
10bdcc9
fix: adding links to workspace sidebar dropdown
sriramveeraghanta Dec 27, 2023
d9bd43f
fix: adding links to the sidebar
sriramveeraghanta Dec 28, 2023
685e62a
fix: replacing onclick redirections with link tag. (#3263)
sriramveeraghanta Dec 28, 2023
71bf049
Style/UI improvements (#3269)
prateekshourya29 Dec 28, 2023
91e84ae
fix: onboarding redirection loop and bug fixes (#3250)
anmolsinghbhatia Dec 28, 2023
62b9b25
fix: adding issue title to the activity (#3271)
sriramveeraghanta Dec 28, 2023
1d5a3a0
fix: issue parent select (#3267)
anmolsinghbhatia Dec 29, 2023
10ab081
chore: cycle current status (#3270)
NarayanBavisetti Dec 29, 2023
a77ceb6
Merge branches 'develop' and 'develop' of github.com:makeplane/plane …
sriramveeraghanta Dec 29, 2023
e584259
feat: add external id and external source field to issue, cycle, modu…
pablohashescobar Dec 29, 2023
f132fe5
Chore/user role validation (#3260)
prateekshourya29 Dec 29, 2023
5de94c5
fix: workspace invitation status fixes (#3279)
sriramveeraghanta Dec 29, 2023
23001d4
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apiserver/plane/app/serializers/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CycleSerializer(BaseSerializer):
started_estimates = serializers.IntegerField(read_only=True)
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")
project_detail = ProjectLiteSerializer(read_only=True, source="project")
status = serializers.CharField(read_only=True)

def validate(self, data):
if (
Expand Down
10 changes: 10 additions & 0 deletions apiserver/plane/app/serializers/estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from plane.db.models import Estimate, EstimatePoint
from plane.app.serializers import WorkspaceLiteSerializer, ProjectLiteSerializer

from rest_framework import serializers

class EstimateSerializer(BaseSerializer):
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")
Expand All @@ -19,6 +20,15 @@ class Meta:


class EstimatePointSerializer(BaseSerializer):

def validate(self, data):
if not data:
raise serializers.ValidationError("Estimate points are required")
value = data.get("value")
if value and len(value) > 20:
raise serializers.ValidationError("Value can't be more than 20 characters")
return data

class Meta:
model = EstimatePoint
fields = "__all__"
Expand Down
34 changes: 31 additions & 3 deletions apiserver/plane/app/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
Count,
Prefetch,
Sum,
Case,
When,
Value,
CharField
)
from django.core import serializers
from django.utils import timezone
Expand Down Expand Up @@ -157,6 +161,28 @@ def get_queryset(self):
),
)
)
.annotate(
status=Case(
When(
Q(start_date__lte=timezone.now()) & Q(end_date__gte=timezone.now()),
then=Value("CURRENT")
),
When(
start_date__gt=timezone.now(),
then=Value("UPCOMING")
),
When(
end_date__lt=timezone.now(),
then=Value("COMPLETED")
),
When(
Q(start_date__isnull=True) & Q(end_date__isnull=True),
then=Value("DRAFT")
),
default=Value("DRAFT"),
output_field=CharField(),
)
)
.prefetch_related(
Prefetch(
"issue_cycle__issue__assignees",
Expand All @@ -177,7 +203,7 @@ def list(self, request, slug, project_id):
queryset = self.get_queryset()
cycle_view = request.GET.get("cycle_view", "all")

queryset = queryset.order_by("-is_favorite","-created_at")
queryset = queryset.order_by("-is_favorite", "-created_at")

# Current Cycle
if cycle_view == "current":
Expand Down Expand Up @@ -575,7 +601,9 @@ def list(self, request, slug, project_id, cycle_id):
)
)

issues = IssueStateSerializer(issues, many=True, fields=fields if fields else None).data
issues = IssueStateSerializer(
issues, many=True, fields=fields if fields else None
).data
issue_dict = {str(issue["id"]): issue for issue in issues}
return Response(issue_dict, status=status.HTTP_200_OK)

Expand Down Expand Up @@ -805,4 +833,4 @@ def post(self, request, slug, project_id, cycle_id):
updated_cycles, ["cycle_id"], batch_size=100
)

return Response({"message": "Success"}, status=status.HTTP_200_OK)
return Response({"message": "Success"}, status=status.HTTP_200_OK)
8 changes: 4 additions & 4 deletions apiserver/plane/app/views/estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def create(self, request, slug, project_id):
)

estimate_points = request.data.get("estimate_points", [])

if not len(estimate_points) or len(estimate_points) > 8:

serializer = EstimatePointSerializer(data=request.data.get("estimate_points"), many=True)
if not serializer.is_valid():
return Response(
{"error": "Estimate points are required"},
status=status.HTTP_400_BAD_REQUEST,
serializer.errors, status=status.HTTP_400_BAD_REQUEST
)

estimate_serializer = EstimateSerializer(data=request.data.get("estimate"))
Expand Down
3 changes: 2 additions & 1 deletion apiserver/plane/app/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def filter_issues(self, query, slug, project_id, workspace_search):
q = Q()
for field in fields:
if field == "sequence_id":
sequences = re.findall(r"\d+\.\d+|\d+", query)
# Match whole integers only (exclude decimal numbers)
sequences = re.findall(r"\b\d+\b", query)
for sequence_id in sequences:
q |= Q(**{"sequence_id": sequence_id})
else:
Expand Down
4 changes: 2 additions & 2 deletions apiserver/plane/bgtasks/issue_activites_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def track_parent(
epoch,
):
if current_instance.get("parent") != requested_data.get("parent"):
old_parent = Issue.objects.filter(pk=current_instance.get("parent")).first()
new_parent = Issue.objects.filter(pk=requested_data.get("parent")).first()
old_parent = Issue.objects.filter(pk=current_instance.get("parent")).first() if current_instance.get("parent") is not None else None
new_parent = Issue.objects.filter(pk=requested_data.get("parent")).first() if requested_data.get("parent") is not None else None

issue_activities.append(
IssueActivity(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Generated by Django 4.2.7 on 2023-12-29 10:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('db', '0050_user_use_case_alter_workspace_organization_size'),
]

operations = [
migrations.AddField(
model_name='cycle',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='cycle',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='inboxissue',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='inboxissue',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='issue',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='issue',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='issuecomment',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='issuecomment',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='label',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='label',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='module',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='module',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='state',
name='external_id',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='state',
name='external_source',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
2 changes: 2 additions & 0 deletions apiserver/plane/db/models/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Cycle(ProjectBaseModel):
)
view_props = models.JSONField(default=dict)
sort_order = models.FloatField(default=65535)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

class Meta:
verbose_name = "Cycle"
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/db/models/inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class InboxIssue(ProjectBaseModel):
"db.Issue", related_name="inbox_duplicate", on_delete=models.SET_NULL, null=True
)
source = models.TextField(blank=True, null=True)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

class Meta:
verbose_name = "InboxIssue"
Expand Down
6 changes: 6 additions & 0 deletions apiserver/plane/db/models/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class Issue(ProjectBaseModel):
completed_at = models.DateTimeField(null=True)
archived_at = models.DateField(null=True)
is_draft = models.BooleanField(default=False)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

objects = models.Manager()
issue_objects = IssueManager()
Expand Down Expand Up @@ -366,6 +368,8 @@ class IssueComment(ProjectBaseModel):
default="INTERNAL",
max_length=100,
)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

def save(self, *args, **kwargs):
self.comment_stripped = (
Expand Down Expand Up @@ -416,6 +420,8 @@ class Label(ProjectBaseModel):
description = models.TextField(blank=True)
color = models.CharField(max_length=255, blank=True)
sort_order = models.FloatField(default=65535)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

class Meta:
unique_together = ["name", "project"]
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/db/models/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class Module(ProjectBaseModel):
)
view_props = models.JSONField(default=dict)
sort_order = models.FloatField(default=65535)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

class Meta:
unique_together = ["name", "project"]
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/db/models/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class State(ProjectBaseModel):
max_length=20,
)
default = models.BooleanField(default=False)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)

def __str__(self):
"""Return name of the state"""
Expand Down
7 changes: 4 additions & 3 deletions web/components/auth-screens/not-authorized-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type Props = {

export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
const { user } = useUser();
const { asPath: currentPath } = useRouter();
const { query } = useRouter();
const { next_path } = query;

return (
<DefaultLayout>
Expand All @@ -37,15 +38,15 @@ export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
{user ? (
<p>
You have signed in as {user.email}. <br />
<Link href={`/?next=${currentPath}`}>
<Link href={`/?next_path=${next_path}`}>
<span className="font-medium text-custom-text-100">Sign in</span>
</Link>{" "}
with different account that has access to this page.
</p>
) : (
<p>
You need to{" "}
<Link href={`/?next=${currentPath}`}>
<Link href={`/?next_path=${next_path}`}>
<span className="font-medium text-custom-text-100">Sign in</span>
</Link>{" "}
with an account that has access to this page.
Expand Down
Loading
Loading