Skip to content

Dev#686

Merged
ashwin31 merged 2 commits into
masterfrom
dev
May 14, 2026
Merged

Dev#686
ashwin31 merged 2 commits into
masterfrom
dev

Conversation

@ashwin31

@ashwin31 ashwin31 commented May 14, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features
    • Added passwordless sign-in via email with one-time codes
    • Introduced knowledge base for creating and managing solutions
    • Added ticket analytics dashboard with FRT, MTTR, and SLA metrics
    • Introduced ticket approval workflow for closure requests
    • Added time tracking with timer and manual entry support
    • Added support for organization-defined custom fields on tickets
    • Enhanced ticket management with watchers, parent linking, and merge operations
    • Improved comment threading with email message integration

Review Change Stack

Copilot AI review requested due to automatic review settings May 14, 2026 20:26
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ef9d84fc-f0e8-4b72-9d06-906a497cec3f

📥 Commits

Reviewing files that changed from the base of the PR and between c6c9a20 and acb54f8.

📒 Files selected for processing (50)
  • backend/common/middleware/rls_context.py
  • backend/common/migrations/0025_magic_link_token_otp.py
  • backend/common/models.py
  • backend/common/serializer.py
  • backend/common/tasks.py
  • backend/common/tests/test_magic_link.py
  • backend/common/urls.py
  • backend/common/views/auth_views.py
  • backend/templates/magic_link_code_email.html
  • mobile/android/app/build.gradle.kts
  • mobile/lib/config/api_config.dart
  • mobile/lib/data/models/approval.dart
  • mobile/lib/data/models/comment.dart
  • mobile/lib/data/models/custom_field_definition.dart
  • mobile/lib/data/models/email_message.dart
  • mobile/lib/data/models/models.dart
  • mobile/lib/data/models/solution.dart
  • mobile/lib/data/models/ticket.dart
  • mobile/lib/data/models/time_entry.dart
  • mobile/lib/providers/analytics_provider.dart
  • mobile/lib/providers/approvals_provider.dart
  • mobile/lib/providers/auth_provider.dart
  • mobile/lib/providers/lookup_provider.dart
  • mobile/lib/providers/solutions_provider.dart
  • mobile/lib/providers/tickets_provider.dart
  • mobile/lib/routes/app_router.dart
  • mobile/lib/screens/auth/forgot_password_screen.dart
  • mobile/lib/screens/auth/login_screen.dart
  • mobile/lib/screens/auth/magic_link_code_screen.dart
  • mobile/lib/screens/auth/magic_link_email_screen.dart
  • mobile/lib/screens/leads/lead_detail_screen.dart
  • mobile/lib/screens/solutions/solution_detail_screen.dart
  • mobile/lib/screens/solutions/solutions_list_screen.dart
  • mobile/lib/screens/tasks/task_detail_screen.dart
  • mobile/lib/screens/tickets/approvals_inbox_screen.dart
  • mobile/lib/screens/tickets/ticket_analytics_screen.dart
  • mobile/lib/screens/tickets/ticket_detail_screen.dart
  • mobile/lib/screens/tickets/ticket_form_screen.dart
  • mobile/lib/screens/tickets/tickets_list_screen.dart
  • mobile/lib/services/api_service.dart
  • mobile/lib/services/auth_service.dart
  • mobile/lib/widgets/cards/deal_card.dart
  • mobile/lib/widgets/cards/task_row.dart
  • mobile/lib/widgets/common/badge.dart
  • mobile/lib/widgets/forms/custom_fields_form.dart
  • mobile/lib/widgets/forms/multi_select_sheet.dart
  • mobile/lib/widgets/tickets/ticket_approval_panel.dart
  • mobile/lib/widgets/tickets/ticket_properties_card.dart
  • mobile/lib/widgets/tickets/ticket_solutions_panel.dart
  • mobile/lib/widgets/tickets/ticket_time_panel.dart

📝 Walkthrough

Walkthrough

This PR implements passwordless magic-link OTP authentication on the backend and mobile platforms, while substantially expanding ticket management capabilities with watchers, time tracking, approvals, solutions, and custom fields. The backend introduces a new OTP delivery mode for magic links; the mobile app adds complete OTP sign-in flows, comprehensive ticket detail views with thread segmentation and actions, and enhanced ticket form/list UI with unified filtering and custom field support.

Changes

Passwordless Authentication and Ticket Management Expansion

Layer / File(s) Summary
Backend: Magic Link OTP Schema and Models
backend/common/migrations/0025_*, backend/common/models.py
Migration adds delivery, code_hash, attempts fields. MagicLinkToken model expands to support both link and code delivery modes with OTP-specific storage.
Backend: OTP Request and Verification Endpoints
backend/common/serializer.py, backend/common/views/auth_views.py
Serializers validate magic-link requests (with optional delivery mode) and OTP verification (email + 6-digit code). MagicLinkRequestView generates and hashes 6-digit OTPs for code delivery. MagicLinkVerifyCodeView atomically verifies OTP, enforces attempt limits, marks tokens used, issues JWTs with org context.
Backend: Email Template and Celery Task
backend/templates/magic_link_code_email.html, backend/common/tasks.py
HTML email template renders OTP code with expiration note. Celery task branches on delivery mode: for code delivery, renders plaintext OTP; for link delivery, constructs verification URL.
Backend: Middleware and URL Routing
backend/common/middleware/rls_context.py, backend/common/urls.py
Middleware exempts /verify-code endpoint from org-context enforcement. URL routing registers magic-link request and verify-code endpoints.
Backend: OTP Tests and Fixtures
backend/common/tests/test_magic_link.py
Test suite covers code delivery request, default link delivery, successful verification, replay protection, attempt tracking and lockout, expired tokens, field validation, and link-token rejection.
Mobile: AuthService OTP Support
mobile/lib/services/auth_service.dart
AuthService.requestMagicCode calls backend with delivery='code'. AuthService.signInWithMagicCode verifies OTP code, parses tokens/user/org, syncs state to storage with org preselection.
Mobile: AuthProvider OTP Methods
mobile/lib/providers/auth_provider.dart
AuthNotifier adds requestMagicCode and signInWithMagicCode with loading/error state management and Riverpod state population on success.
Mobile: Login and Magic Link Screens
mobile/lib/screens/auth/login_screen.dart, magic_link_email_screen.dart, magic_link_code_screen.dart
LoginScreen refactors to passwordless options (Google Sign-In, email code button). MagicLinkEmailScreen collects email with validation. MagicLinkCodeScreen accepts 6-digit input with 30-second resend cooldown.
Mobile: New Data Models for Ticket Features
mobile/lib/data/models/approval.dart, email_message.dart, custom_field_definition.dart, solution.dart, time_entry.dart, comment.dart, models.dart
New model files define Approval (with state enum and nested refs), EmailMessage (with direction/addresses and parseList helper), CustomFieldDefinition (with options/type enum), Solution (with status enum and copyWith), TimeEntry/TimeSummary (with live duration and aggregates). Comment.fromJson gains user_details fallback.
Mobile: Ticket Model Expansion
mobile/lib/data/models/ticket.dart
Ticket model gains tagIds, customFields, SLA deadlines/pauses, escalation counts, parentSummary, childCount, isProblem. fromJson parses all new fields, toJson serializes with formatting, copyWith propagates new fields. New TicketParentSummary class.
Mobile: Approvals and Solutions Providers
mobile/lib/providers/approvals_provider.dart, solutions_provider.dart
ApprovalsProvider fetches approvals by state/mine filters with action methods. SolutionsProvider manages CRUD, caching, publish/unpublish, ticket linking, and suggestions. Both use Riverpod Notifier with async state.
Mobile: Analytics Provider
mobile/lib/providers/analytics_provider.dart
AnalyticsProvider fetches multiple analytics endpoints in parallel, derives agent list, exposes query model for dynamic reloading.
Mobile: Tickets Provider Refactoring
mobile/lib/providers/tickets_provider.dart
Refactored to use TicketListFilters object. _fetchPage builds multi-value query params, applies client-side date filtering. Ticket detail expanded to include emails, mergedFromCases, linkedSolutions. New methods for watchers, time entries, timer, tree, parent linking, merge/unmerge, watching. New public models (TicketTreeNode, MergedFromSummary, TicketListFilters, TicketWatchers).
Mobile: Lookup Provider Custom Fields
mobile/lib/providers/lookup_provider.dart
customFieldDefinitionsProvider fetches per-org custom field schema, parses into CustomFieldDefinition objects, sorts by displayOrder/label.
Mobile: Ticket Detail Screen Comprehensive Redesign
mobile/lib/screens/tickets/ticket_detail_screen.dart
Fetches detail, watchers, tree concurrently. Overview tab renders TicketPropertiesCard, conditional merged-from and tree cards. Comments tab redesigned with public/internal/email segments, mention insertion, local comment folding. App bar gains watch icon and "More" action sheet. Activity rendering refactored with centralized description logic and icon mappers. Tree card renders recursive hierarchy.
Mobile: Ticket UI Widgets and Panels
ticket_properties_card.dart, ticket_approval_panel.dart, ticket_solutions_panel.dart, ticket_time_panel.dart, mobile/lib/widgets/common/badge.dart
TicketPropertiesCard renders SLA state, escalation, watchers. TicketApprovalPanel manages approval requests/actions. TicketSolutionsPanel manages linked/suggested solutions. TicketTimePanel manages time entries and running timer. Badge classes refactored with factory constructors (fromPriority, fromTicketStatus, fromTicketType).
Mobile: Solutions, Approvals, Analytics Screens
solutions_list_screen.dart, solution_detail_screen.dart, approvals_inbox_screen.dart, ticket_analytics_screen.dart
SolutionsListScreen with debounced search and filters. SolutionDetailScreen supports create/edit/publish/delete. ApprovalsInboxScreen with "Mine"/"All" tabs and state filters. TicketAnalyticsScreen with date/priority filters and metric/agent breakdown.
Mobile: Tickets List with Unified Filtering
mobile/lib/screens/tickets/tickets_list_screen.dart
Refactored to TicketListFilters object with debounced search. Filter UI derives from provider lookup data. Implemented _pick* bottom-sheet flows (status, priority, account, assignees, tags, date range). Added ToggleChip for watching. Expanded app bar navigation.
Mobile: Ticket Form with Assignees, Tags, Custom Fields
mobile/lib/screens/tickets/ticket_form_screen.dart
Form state tracks assignees, tags, custom fields, closed-on date. Payload includes assigned_to, tags, custom_fields with formatting. UI adds "People" section (multi-select), "Closed on" date picker (visible when closed), custom-fields section. Account read-only in edit mode.
Mobile: Form Widgets and Inputs
mobile/lib/widgets/forms/custom_fields_form.dart, multi_select_sheet.dart
CustomFieldsForm watches customFieldDefinitionsProvider, renders field inputs by type (text/textarea/number/dropdown/date/checkbox) with normalized callbacks. MultiSelectSheet generic bottom-sheet with search and selection toggle.
Mobile: Routes and Navigation
mobile/lib/routes/app_router.dart
Added route constants for magic-link email/code, solutions (list/new/detail), approvals inbox, ticket analytics. Marked new magic-link routes as public. Removed forgot-password route.
Mobile: API Configuration Expansion
mobile/lib/config/api_config.dart
Updated development base URL. Added magicLinkRequest/magicLinkVerifyCode getters. Expanded ticket-related URL builders (watching, merge/unmerge, tree, time entries, solutions, approvals, analytics). Added customFieldDefinitions getter.
Mobile: Supporting Changes
comment.dart, badge.dart, models.dart, auth_service.dart, api_service.dart, build.gradle.kts, lead_detail_screen.dart, task_*.dart, deal_card.dart
Comment model gains user_details fallback path. Badge widgets updated to use new factories. Models barrel exports new modules. ApiService error extraction enhanced. AuthService GoogleSignIn uses explicit serverClientId. Android NDK bumped. Lead/task/deal screens use new badge factories.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A magic spell cast from email to code,
Six digits typed down the passwordless road,
With tickets now tracked and approvals in sight,
Time entries ticking and solutions alight!
No passwords needed—just dreams and OTP light!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

@ashwin31 ashwin31 merged commit d98cfb1 into master May 14, 2026
6 of 8 checks passed
@ashwin31 ashwin31 deleted the dev branch May 14, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the mobile ticketing experience with passwordless email-code sign-in, ticket filters and editing enhancements, approvals, analytics, knowledge-base solutions, custom fields, watchers/time-tracking support, and related backend OTP support.

Changes:

  • Adds mobile OTP authentication screens and backend verify-code flow.
  • Adds ticket-related mobile surfaces for analytics, approvals, solutions, custom fields, properties, and time tracking.
  • Extends providers/models/API configuration for tickets, solutions, approvals, analytics, custom fields, and OTP.

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
mobile/lib/widgets/tickets/ticket_time_panel.dart Adds ticket time-tracking panel with timers and manual entries.
mobile/lib/widgets/tickets/ticket_solutions_panel.dart Adds linked and suggested solution panel for tickets.
mobile/lib/widgets/tickets/ticket_properties_card.dart Adds ticket SLA/escalation/watcher properties card.
mobile/lib/widgets/tickets/ticket_approval_panel.dart Adds per-ticket approval status and actions.
mobile/lib/widgets/forms/multi_select_sheet.dart Adds reusable searchable multi-select bottom sheet.
mobile/lib/widgets/forms/custom_fields_form.dart Adds schema-driven custom-field form renderer.
mobile/lib/widgets/common/badge.dart Extends badges for ticket status/type/priority.
mobile/lib/widgets/cards/task_row.dart Updates priority badge usage.
mobile/lib/widgets/cards/deal_card.dart Updates priority badge usage.
mobile/lib/services/auth_service.dart Adds OTP request/verify auth methods and Google server client ID.
mobile/lib/services/api_service.dart Improves error parsing and preserves structured failure bodies for POST/PUT.
mobile/lib/screens/tickets/tickets_list_screen.dart Adds server-backed ticket filters and new navigation actions.
mobile/lib/screens/tickets/ticket_form_screen.dart Adds assignees, tags, custom fields, closed-on date, and edit account read-only behavior.
mobile/lib/screens/tickets/ticket_analytics_screen.dart Adds mobile ticket analytics dashboard.
mobile/lib/screens/tickets/approvals_inbox_screen.dart Adds approvals inbox with filters and inline actions.
mobile/lib/screens/tasks/task_detail_screen.dart Updates priority badge usage.
mobile/lib/screens/solutions/solutions_list_screen.dart Adds solutions list/search/filter screen.
mobile/lib/screens/solutions/solution_detail_screen.dart Adds solution create/edit/publish/delete screen.
mobile/lib/screens/leads/lead_detail_screen.dart Updates priority badge usage.
mobile/lib/screens/auth/magic_link_email_screen.dart Adds email step for OTP sign-in.
mobile/lib/screens/auth/magic_link_code_screen.dart Adds code-entry step for OTP sign-in.
mobile/lib/screens/auth/login_screen.dart Replaces password form with Google and email-code sign-in options.
mobile/lib/screens/auth/forgot_password_screen.dart Removes legacy forgot-password screen.
mobile/lib/routes/app_router.dart Registers OTP, solutions, approvals, and analytics routes.
mobile/lib/providers/tickets_provider.dart Extends ticket list filters and ticket detail/time/tree/watcher operations.
mobile/lib/providers/solutions_provider.dart Adds solutions state/actions provider.
mobile/lib/providers/lookup_provider.dart Adds custom-field definition provider.
mobile/lib/providers/auth_provider.dart Exposes OTP request/verify actions in auth state.
mobile/lib/providers/approvals_provider.dart Adds approvals provider and actions.
mobile/lib/providers/analytics_provider.dart Adds analytics provider and query model.
mobile/lib/data/models/time_entry.dart Adds time entry and time summary models.
mobile/lib/data/models/ticket.dart Extends ticket model with tags, custom fields, SLA, parent/child, and problem metadata.
mobile/lib/data/models/solution.dart Adds solution model and status enum.
mobile/lib/data/models/models.dart Exports new models.
mobile/lib/data/models/email_message.dart Adds ticket email message model.
mobile/lib/data/models/custom_field_definition.dart Adds custom-field definition model.
mobile/lib/data/models/comment.dart Improves commenter email parsing compatibility.
mobile/lib/data/models/approval.dart Adds approval model and related summaries.
mobile/lib/config/api_config.dart Adds new API endpoint constants and updates dev URL.
mobile/android/app/build.gradle.kts Updates NDK/signing behavior.
backend/templates/magic_link_code_email.html Adds OTP email template.
backend/common/views/auth_views.py Adds OTP delivery and verify-code view.
backend/common/urls.py Registers OTP verify-code endpoint.
backend/common/tests/test_magic_link.py Adds OTP request/verify tests and adjusts task mocking.
backend/common/tasks.py Supports sending either magic-link or OTP emails.
backend/common/serializer.py Adds delivery and verify-code serializers.
backend/common/models.py Extends magic-link token model for OTP delivery.
backend/common/migrations/0025_magic_link_token_otp.py Adds OTP fields to magic-link token table.
backend/common/middleware/rls_context.py Allows OTP verify-code without org context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

controller: _descController,
maxLines: 2,
decoration: InputDecoration(
hintText: 'What did you work on? (optional)',
Comment on lines +120 to +128
// Date range is enforced client-side — the list endpoint doesn't expose
// a created_at filter. Acceptable because the user already paginates.
newTickets = _applyDateRange(newTickets, filters);

return TicketsListData(
tickets: newTickets,
totalCount: totalCount,
hasMore: newTickets.length >= _pageSize,
currentOffset: offset + newTickets.length,
currentOffset: offset + ticketsList.length,
Comment on lines +156 to +158
: ListView.builder(
itemCount: filtered.length,
itemBuilder: (_, i) {
Comment on lines +105 to +108
Widget _textInput({required int maxLines}) {
return FloatingLabelInput(
label: _label(),
controller: TextEditingController(text: value?.toString() ?? ''),
),
const SizedBox(height: 2),
Text(
_subtitle(deadline: deadline, met: met, metAt: metAt),
if (status != null && status.isNotEmpty) queryParams['status'] = status;
if (priority != null && priority.isNotEmpty) {
queryParams['priority'] = priority;
if (filters.search.isNotEmpty) queryParams['search'] = filters.search;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants