Skip to content

feat!: rewrite the whole group model and add chat app#9

Merged
dsh0416 merged 2 commits into
mainfrom
dsh0416/chat
Jul 9, 2026
Merged

feat!: rewrite the whole group model and add chat app#9
dsh0416 merged 2 commits into
mainfrom
dsh0416/chat

Conversation

@dsh0416

@dsh0416 dsh0416 commented Jul 9, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 9, 2026 12:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 performs a breaking refactor from Groups to Organizations (including project ownership/visibility changes) and adds a new Chats app (direct messages + organization channels + threads), while also introducing a reusable MarkdownEditor component and wiring it into existing editors.

Changes:

  • Replace group-centric user management with organization-centric flows (frontend routes/views/components + backend models/controllers/policies/search visibility).
  • Add chat conversations/messages/channels end-to-end (backend API + frontend view/components + store tests).
  • Introduce a shared MarkdownEditor and migrate task/drive/task-detail editing to it.

Reviewed changes

Copilot reviewed 160 out of 161 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
frontend/src/views/UserProfileView.vue Switch profile UI from groups to organizations.
frontend/src/views/UserGroupsView.vue Removed legacy groups view container.
frontend/src/views/TaskDetailPage.vue Swap description Textarea for MarkdownEditor.
frontend/src/views/ProjectsView.vue Project creation now uses organizations + current user.
frontend/src/views/OrganizationsView.vue New org directory view replacing groups view.
frontend/src/views/OrganizationEditorView.vue New editor shell for organization profile/memberships.
frontend/src/views/GroupEditorView.vue Removed legacy group editor view.
frontend/src/views/DashboardView.vue Add Chats tile; rename Users/Groups to Users/Organizations.
frontend/src/views/ChatsView.vue New chats workspace view and orchestration.
frontend/src/views/AuthView.vue Preload organizations after login.
frontend/src/views/AuthCallbackView.vue Preload organizations after callback auth.
frontend/src/stores/tests/userGroups.spec.ts Removed tests for deprecated userGroups store.
frontend/src/stores/tests/projects.spec.ts Update project owner fields in tests.
frontend/src/stores/tests/organizations.spec.ts New organizations store tests.
frontend/src/stores/tests/chats.spec.ts New chats store tests.
frontend/src/stores/tests/board.spec.ts Update board/project fixtures to owner fields.
frontend/src/services/api/types.ts Replace Group with Organization; add chat types; update project ownership types.
frontend/src/services/api/organizations.ts New organizations API client.
frontend/src/services/api/groups.ts Removed legacy groups API client.
frontend/src/services/api/chats.ts New chats API client.
frontend/src/services/api.ts Export chats + organizations APIs (remove groups).
frontend/src/router/index.ts Replace groups routes with organizations; add /chats route.
frontend/src/lib/markdown.ts Export shared markdownRenderer instance.
frontend/src/i18n/locales/zh-CN.json Add chats and organizations strings.
frontend/src/i18n/locales/en.json Add chats and organizations strings.
frontend/src/components/user-groups/GroupTree.vue Removed legacy group tree UI.
frontend/src/components/user-groups/GroupsTab.vue Removed legacy groups tab.
frontend/src/components/search/ResourceSearch.vue Rename result type from group to organization.
frontend/src/components/projects/ProjectList.vue Display owner_name instead of group_name.
frontend/src/components/projects/ProjectForm.vue Owner selector replaces group selector.
frontend/src/components/organizations/UsersTab.vue Users tab updated to show organization memberships.
frontend/src/components/organizations/UserProfileForm.vue Profile form updated to show organization memberships.
frontend/src/components/organizations/UserProfileDetails.vue Profile details updated to show organization memberships.
frontend/src/components/organizations/UserPagination.vue New pagination component under organizations UI.
frontend/src/components/organizations/OrganizationTree.vue New organization list/tree UI.
frontend/src/components/organizations/OrganizationsTab.vue New organizations tab wrapper.
frontend/src/components/organizations/OrganizationForm.vue New organization form (no group hierarchy parent).
frontend/src/components/organizations/OrganizationCreateDialog.vue New create dialog wired to OrganizationForm.
frontend/src/components/markdown/MarkdownEditor.vue New reusable markdown editor (edit/preview/split).
frontend/src/components/markdown/tests/MarkdownEditor.spec.ts Unit test for MarkdownEditor behavior.
frontend/src/components/kanban/TaskForm.vue Use MarkdownEditor for task description.
frontend/src/components/kanban/IterationsView.vue Minor refactor in tasks-by-iteration map logic.
frontend/src/components/drive/MarkdownEditorPanel.vue Replace custom editor/preview toggle with MarkdownEditor.
frontend/src/components/chats/ChatThreadPanel.vue New thread side panel UI.
frontend/src/components/chats/ChatSidebar.vue New chat sidebar (direct + org channels + search).
frontend/src/components/chats/ChatMessageList.vue New message list component.
frontend/src/components/chats/ChatMessageItem.vue New message item with markdown + context menu thread action.
frontend/src/components/chats/ChatConversationPane.vue New main conversation pane UI.
frontend/src/components/chats/ChatComposer.vue New composer using MarkdownEditor.
frontend/src/components/chats/ChannelDialog.vue New channel create/edit dialog.
frontend/src/components/chats/tests/ChatMessageItem.spec.ts Unit tests for message threading UX.
frontend/src/App.vue Preload organizations; clear chats/orgs on sign-out; update search routing to organizations.
frontend/e2e/kanban.spec.ts Update mocks from groups to organizations + owner fields.
frontend/e2e/drive.spec.ts Update mocks from groups to organizations + owner fields.
backend/spec/requests/api/v1/users_spec.rb Update managed user membership fields to organizations.
backend/spec/requests/api/v1/tasks_spec.rb Update access logic to project owner model.
backend/spec/requests/api/v1/search_spec.rb Update search visibility + resource types to organizations/owners.
backend/spec/requests/api/v1/organizations_spec.rb New request specs for organizations API.
backend/spec/requests/api/v1/openapi/search_spec.rb Update enum types from group to organization.
backend/spec/requests/api/v1/openapi/projects_spec.rb Update project create params to owner_type/owner_id.
backend/spec/requests/api/v1/openapi/organizations_spec.rb New OpenAPI request spec coverage for organizations.
backend/spec/requests/api/v1/openapi/groups_spec.rb Removed OpenAPI specs for deprecated groups endpoints.
backend/spec/rails_helper.rb Update database cleanup from groups to organizations.
backend/spec/openapi_helper.rb Update schemas for owner/org + add chat schemas.
backend/spec/models/user_spec.rb Update membership/admin checks from groups to organizations.
backend/spec/models/search_document_spec.rb Update indexing/visibility from group_id to polymorphic owner.
backend/spec/models/project_spec.rb Validate polymorphic owner; add user-owned projects coverage.
backend/spec/models/organization_spec.rb New Organization model specs.
backend/spec/models/organization_membership_spec.rb New OrganizationMembership model specs.
backend/spec/models/group_spec.rb Removed legacy group model specs.
backend/spec/models/group_membership_spec.rb Removed legacy group membership specs.
backend/spec/models/group_hierarchy_spec.rb Removed legacy hierarchy specs.
backend/spec/models/drive_item_spec.rb Update drive indexing expectations to owner visibility.
backend/spec/models/chat_message_spec.rb New ChatMessage model specs.
backend/spec/models/chat_conversation_spec.rb New ChatConversation model specs.
backend/spec/models/chat_channel_spec.rb New ChatChannel model specs.
backend/spec/factories/projects.rb Projects now owned by organization by default; add :user_owned trait.
backend/spec/factories/organizations.rb New Organization factory.
backend/spec/factories/organization_memberships.rb Rename factory to organization_membership.
backend/spec/factories/groups.rb Removed Group factory.
backend/spec/factories/chat_messages.rb New chat_message factory.
backend/spec/factories/chat_conversations.rb New chat_conversation factory.
backend/spec/factories/chat_conversation_participants.rb New participant factory for directs.
backend/spec/factories/chat_channels.rb New chat_channel factory wiring conversation/org.
backend/db/migrate/20260709103000_create_drive_item_versions.rb Removed migration file (schema rewrite).
backend/db/migrate/20260709102000_add_soft_delete_to_drive_items.rb Removed migration file (schema rewrite).
backend/db/migrate/20260709101000_create_drive_items.rb Removed migration file (schema rewrite).
backend/db/migrate/20260709100000_create_active_storage_tables.rb Removed migration file (schema rewrite).
backend/db/migrate/20260709091000_add_admin_to_group_memberships.rb Removed migration file (groups removal).
backend/db/migrate/20260709090000_add_system_admin_to_users.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708032000_create_task_developer_and_reviewer_memberships.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708031000_add_starts_at_to_iterations.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708030000_create_iterations.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708002002_create_pghero_space_stats.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708002001_create_pghero_query_stats.rb Removed migration file (schema rewrite).
backend/db/migrate/20260708002000_create_group_hierarchies.rb Removed migration file (groups removal).
backend/db/migrate/20260707164000_add_group_scope_to_projects_and_search_documents.rb Removed migration file (ownership rewrite).
backend/db/migrate/20260707153000_create_initial_schema.rb Removed migration file (schema rewrite).
backend/config/routes.rb Swap groups routes for organizations; add chats + channels endpoints.
backend/config/locales/zh-CN.yml Update AR attribute/model translations for organization/owner.
backend/app/views/api/v1/users/_managed_user.json.jbuilder Emit organization_ids/count instead of group_ids/count.
backend/app/views/api/v1/projects/_project.json.jbuilder Emit owner_type/owner_id/owner_name instead of group fields.
backend/app/views/api/v1/organizations/show.json.jbuilder New organization show JSON view.
backend/app/views/api/v1/organizations/index.json.jbuilder New organization index JSON view.
backend/app/views/api/v1/organizations/_organization.json.jbuilder New organization JSON partial (members/admins/can_admin).
backend/app/views/api/v1/groups/show.json.jbuilder Removed groups JSON view.
backend/app/views/api/v1/groups/index.json.jbuilder Removed groups JSON view.
backend/app/views/api/v1/groups/_group.json.jbuilder Removed group JSON partial.
backend/app/views/api/v1/chats/messages/show.json.jbuilder New chat message show JSON view.
backend/app/views/api/v1/chats/messages/index.json.jbuilder New chat message index JSON view.
backend/app/views/api/v1/chats/messages/_message.json.jbuilder New chat message JSON partial incl. thread metadata.
backend/app/views/api/v1/chats/conversations/show.json.jbuilder New chat conversation show JSON view.
backend/app/views/api/v1/chats/conversations/index.json.jbuilder New chat conversation index JSON view.
backend/app/views/api/v1/chats/conversations/_conversation.json.jbuilder New conversation JSON partial incl. participants/title/parent.
backend/app/views/api/v1/chat_channels/show.json.jbuilder New chat channel show JSON view.
backend/app/views/api/v1/chat_channels/index.json.jbuilder New chat channel index JSON view.
backend/app/views/api/v1/chat_channels/_chat_channel.json.jbuilder New chat channel JSON partial.
backend/app/services/chats/thread_creator.rb Service to create/find a thread conversation safely.
backend/app/services/chats/direct_conversation_finder.rb Service to find/create direct conversations safely.
backend/app/services/chats/channel_creator.rb Service to create channel + backing conversation atomically.
backend/app/policies/task_policy.rb Update task access to project owner visibility.
backend/app/policies/project_policy.rb Update authorization to polymorphic owner (User/Organization).
backend/app/policies/organization_policy.rb New organization policy for membership/admin checks.
backend/app/policies/iteration_policy.rb Update iteration access to project owner visibility.
backend/app/policies/group_policy.rb Removed legacy group policy.
backend/app/policies/drive_item_version_policy.rb Update access to project owner visibility.
backend/app/policies/drive_item_policy.rb Update access to project owner visibility.
backend/app/policies/chat_message_policy.rb New chat message policy and scope via visible conversations.
backend/app/policies/chat_conversation_policy.rb New chat conversation policy and scope.
backend/app/policies/chat_channel_policy.rb New chat channel policy scoped to organizations.
backend/app/models/user.rb Replace group memberships with organization memberships + chat relations.
backend/app/models/task.rb Search indexing now uses polymorphic owner.
backend/app/models/search_document.rb Replace user/group visibility with polymorphic owner visibility.
backend/app/models/project.rb Projects now owned polymorphically; update search metadata.
backend/app/models/organization.rb New Organization model + searchable resource.
backend/app/models/organization_membership.rb New membership model with “keep at least one admin” rules.
backend/app/models/group.rb Removed legacy Group model.
backend/app/models/group_membership.rb Removed legacy GroupMembership model.
backend/app/models/group_hierarchy.rb Removed legacy GroupHierarchy model.
backend/app/models/drive_item.rb Search indexing now uses polymorphic owner.
backend/app/models/chat_message.rb New chat message model; updates conversation last_message_at.
backend/app/models/chat_conversation.rb New conversation model + visibility scope.
backend/app/models/chat_conversation_participant.rb New participant model enforcing direct-only membership.
backend/app/models/chat_channel.rb New channel model bound to channel conversation + org.
backend/app/controllers/api/v1/users_controller.rb Includes organizations when listing users.
backend/app/controllers/api/v1/projects_controller.rb Projects include owner; permit owner_type/owner_id.
backend/app/controllers/api/v1/organizations_controller.rb New organizations controller (CRUD + membership syncing).
backend/app/controllers/api/v1/chats/messages_controller.rb New chat messages controller + thread creation endpoint.
backend/app/controllers/api/v1/chats/direct_conversations_controller.rb New direct conversation creation endpoint.
backend/app/controllers/api/v1/chats/conversations_controller.rb New conversation index/show endpoints.
backend/app/controllers/api/v1/chat_channels_controller.rb New chat channel CRUD endpoints (scoped to orgs).
Comments suppressed due to low confidence (1)

backend/app/controllers/api/v1/organizations_controller.rb:58

  • If a membership save raises ActiveRecord::RecordInvalid (e.g., demoting the last admin), render_errors(organization) can return an empty/irrelevant error hash because the invalid record is the membership, not the organization. Rendering e.record preserves the real validation errors for API clients.

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

Comment on lines +62 to +66
const organizationed = new Map<number, Task[]>()

for (const status of props.statuses) {
for (const task of status.tasks) {
const tasks = grouped.get(task.iteration_id) ?? []
const tasks = organizationed.get(task.iteration_id) ?? []
Comment on lines 110 to 115
<p
v-if="!props.loadingGroups && adminGroups.length === 0"
v-if="!props.loadingOrganizations && ownerOptions.length === 0"
class="text-muted-foreground text-sm"
>
You need group admin access before creating a project.
You need an account before creating a project.
</p>
Comment on lines +60 to +61
<DialogTitle>{{ props.channel ? 'Edit channel' : 'New channel' }}</DialogTitle>
<DialogDescription>Channels belong to a organization and use Markdown messages.</DialogDescription>
expect(store.organizationLookup.get(1)?.name).toBe('Engineering')
})

it('syncs user memberships when creating a organization', async () => {
require "rails_helper"

RSpec.describe ChatChannel, type: :model do
it "requires names to be unique within a organization case-insensitively" do
end
end

post "Creates a organization" do
path "/api/v1/organizations/{id}" do
parameter name: :id, in: :path, type: :integer

get "Returns a organization" do
end
end

patch "Updates a organization" do
end
end

put "Replaces a organization" do
end
end

delete "Deletes a organization" do
@dsh0416
dsh0416 merged commit 2581fe1 into main Jul 9, 2026
5 checks passed
@dsh0416
dsh0416 deleted the dsh0416/chat branch July 9, 2026 12:20
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