Migrate schema to service ids

This commit is contained in:
Fedor Indutny 2023-08-16 22:54:39 +02:00 committed by Jamie Kyle
parent 71958f8a01
commit 8b0da36caa
258 changed files with 4795 additions and 2613 deletions

View file

@ -53,7 +53,7 @@ import enMessages from '../../../../_locales/en/messages.json';
import {
getDefaultConversation,
getDefaultGroup,
getDefaultConversationWithUuid,
getDefaultConversationWithServiceId,
} from '../../helpers/getDefaultConversation';
import {
defaultStartDirectConversationComposerState,
@ -89,12 +89,12 @@ describe('both/state/selectors/conversations-extra', () => {
});
}
function makeConversationWithUuid(
function makeConversationWithServiceId(
id: string
): ConversationType & { uuid: ServiceIdString } {
): ConversationType & { serviceId: ServiceIdString } {
const title = `${id} title`;
return getDefaultConversationWithUuid(
return getDefaultConversationWithServiceId(
{
id,
searchableTitle: title,
@ -165,7 +165,7 @@ describe('both/state/selectors/conversations-extra', () => {
conversationsByE164: {
[id]: wrongConversation,
},
conversationsByUuid: {
conversationsByServiceId: {
[id]: conversation,
},
conversationsByGroupId: {
@ -359,17 +359,17 @@ describe('both/state/selectors/conversations-extra', () => {
});
it('returns "hydrated" invited contacts', () => {
const abc = makeConversationWithUuid('abc');
const def = makeConversationWithUuid('def');
const abc = makeConversationWithServiceId('abc');
const def = makeConversationWithServiceId('def');
const state = {
...getEmptyRootState(),
conversations: {
...getEmptyState(),
conversationsByUuid: {
[abc.uuid]: abc,
[def.uuid]: def,
conversationsByServiceId: {
[abc.serviceId]: abc,
[def.serviceId]: def,
},
invitedServiceIdsForNewlyCreatedGroup: [def.uuid, abc.uuid],
invitedServiceIdsForNewlyCreatedGroup: [def.serviceId, abc.serviceId],
},
};
const result = getInvitedContactsForNewlyCreatedGroup(state);
@ -1640,13 +1640,13 @@ describe('both/state/selectors/conversations-extra', () => {
const group: ConversationType = {
...makeGroup('group'),
sortedGroupMembers: [
makeConversationWithUuid('fff'),
makeConversationWithUuid('f00'),
makeConversationWithUuid('e00'),
makeConversationWithUuid('d00'),
makeConversationWithUuid('c00'),
makeConversationWithUuid('b00'),
makeConversationWithUuid('a00'),
makeConversationWithServiceId('fff'),
makeConversationWithServiceId('f00'),
makeConversationWithServiceId('e00'),
makeConversationWithServiceId('d00'),
makeConversationWithServiceId('c00'),
makeConversationWithServiceId('b00'),
makeConversationWithServiceId('a00'),
],
};
const state = {

View file

@ -24,7 +24,7 @@ import { makeLookup } from '../../../util/makeLookup';
import { generateAci } from '../../../types/ServiceId';
import {
getDefaultConversation,
getDefaultConversationWithUuid,
getDefaultConversationWithServiceId,
} from '../../helpers/getDefaultConversation';
import { ReadStatus } from '../../../messages/MessageReadStatus';
@ -58,7 +58,7 @@ describe('both/state/selectors/search', () => {
received_at: NOW,
sent_at: NOW,
source: 'source',
sourceUuid: generateAci(),
sourceServiceId: generateAci(),
timestamp: NOW,
type: 'incoming' as const,
readStatus: ReadStatus.Read,
@ -188,7 +188,7 @@ describe('both/state/selectors/search', () => {
const searchId = 'search-id';
const toId = 'to-id';
const from = getDefaultConversationWithUuid();
const from = getDefaultConversationWithServiceId();
const to = getDefaultConversation({ id: toId });
const state = {
@ -199,8 +199,8 @@ describe('both/state/selectors/search', () => {
[from.id]: from,
[toId]: to,
},
conversationsByUuid: {
[from.uuid]: from,
conversationsByServiceId: {
[from.serviceId]: from,
},
},
search: {
@ -209,7 +209,7 @@ describe('both/state/selectors/search', () => {
[searchId]: {
...getDefaultMessage(searchId),
type: 'incoming' as const,
sourceUuid: from.uuid,
sourceServiceId: from.serviceId,
conversationId: toId,
snippet: 'snippet',
body: 'snippet',
@ -243,8 +243,8 @@ describe('both/state/selectors/search', () => {
const searchId = 'search-id';
const myId = 'my-id';
const from = getDefaultConversationWithUuid();
const toId = from.uuid;
const from = getDefaultConversationWithServiceId();
const toId = from.serviceId;
const meAsRecipient = getDefaultConversation({ id: myId });
const state = {
@ -255,8 +255,8 @@ describe('both/state/selectors/search', () => {
[from.id]: from,
[myId]: meAsRecipient,
},
conversationsByUuid: {
[from.uuid]: from,
conversationsByServiceId: {
[from.serviceId]: from,
},
},
ourConversationId: myId,
@ -266,7 +266,7 @@ describe('both/state/selectors/search', () => {
[searchId]: {
...getDefaultMessage(searchId),
type: 'incoming' as const,
sourceUuid: from.uuid,
sourceServiceId: from.serviceId,
conversationId: toId,
snippet: 'snippet',
body: 'snippet',
@ -290,7 +290,7 @@ describe('both/state/selectors/search', () => {
const searchId = 'search-id';
const toId = 'to-id';
const from = getDefaultConversationWithUuid();
const from = getDefaultConversationWithServiceId();
const to = getDefaultConversation({ id: toId });
const state = {
@ -305,8 +305,8 @@ describe('both/state/selectors/search', () => {
[from.id]: from,
[toId]: to,
},
conversationsByUuid: {
[from.uuid]: from,
conversationsByServiceId: {
[from.serviceId]: from,
},
},
search: {
@ -360,9 +360,9 @@ describe('both/state/selectors/search', () => {
...state,
conversations: {
...state.conversations,
conversationsByUuid: {
...state.conversations.conversationsByUuid,
[from.uuid]: {
conversationsByServiceId: {
...state.conversations.conversationsByServiceId,
[from.serviceId]: {
...from,
name: 'new-name',
},