Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactor-create-co…
Browse files Browse the repository at this point in the history
…mmunity
  • Loading branch information
Lucas Leblow committed Feb 19, 2024
2 parents fb54928 + 9693d0d commit 6322613
Show file tree
Hide file tree
Showing 75 changed files with 595 additions and 697 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

### Pull Request Checklist

- [ ] I have linked this PR to related GitHub issue.
- [ ] I have updated the CHANGELOG.md file with relevant changes (the file is located at the root of monorepo).
- [ ] I have linked this PR to a related GitHub issue.
- [ ] I have added a description of the change (and Github issue number, if any) to the root [CHANGELOG.md](https://github.com/TryQuiet/quiet/blob/develop/CHANGELOG.md).

### (Optional) Mobile checklist

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ lerna-debug.log
c4/.structurizr
c4/workspace.json
.ignore
.DS_Store
.vscode
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

# Refactorings:

* refactor: Rename LOAD_MESSAGES event and incomingMessages reducer
* refactor: Use socket.io ack for CREATE_CHANNEL event
* refactor: Introduce socket.io acknowledgements
* Rename and reorganize frontend/backend events API
* Rename message retrieval events/sagas and use ack feature
* Rename LOAD_MESSAGES event and incomingMessages reducer
* Use socket.io ack for CREATE_CHANNEL event
* Introduce socket.io acknowledgements

# Fixes:

* Remove duplicate introduction messages once again
* Prevent channel creation with names that start with special character, then a hyphen
* Choose random ports for Tor services (iOS)

[2.1.1]

Expand Down
3 changes: 2 additions & 1 deletion PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ From this moment, all the fixes (patches) for the last supported version are bei

## Release candidates (alpha releases)
Pre-release builds should only be triggered from the release branch and then delivered to QA.
Alpha versions should be delivered to QA by updating GitHub with a link to the correct versions (for desktop) and numbers of current versions (for mobile). All GitHub issues included in the released alpha version should be moved to the Ready for QA column.
If QA reports problems that needs to be solved, the fixes must be merged into the release and develop branches, then a patched pre-release is to be built.


Expand Down Expand Up @@ -65,7 +66,7 @@ By the time release is ready, ask @holmes for <b>CHANGELOG.md</b> cosmetic revie
## Changelog / Releases Page
Root <b>CHANGELOG.md</b> file contents are being copied into each packages' ones.
This process is automated by `copy-changelog.js` script hooked on `postpublish` action.

- [ ] Edit release notes to match style guide (See: [RELEASE_NOTES_GUIDE.md](RELEASE_NOTES_GUIDE.md))

## QA
QA tests for issues on all the supported platforms and moves discovered blocking issues intoto the Sprint column, then mentions them in Slack <b>#qa</b> channel, following the criteria:
Expand Down
39 changes: 39 additions & 0 deletions RELEASE_NOTES_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Release notes process & style guide

We want users to know what's new in Quiet with each release, and we want people interested in using Quiet to be able to follow our progress. This document describes a process for creating release notes that are readable and informative to a wide audience.

## Model release notes

* https://github.com/TryQuiet/quiet/releases/tag/%40quiet%2Fmobile%402.1.1
* https://github.com/TryQuiet/quiet/releases/tag/%40quiet%2Fmobile%402.0.1

## Process / checklist

Follow these steps to make sure the changelog is maximally readable and informative:

**Add:**
- [ ] All significant items since the last release, including items from the preceding alpha releases.
- [ ] Any big high level features that are broken into small changelog entries (e.g. "user can join community without owner being online")
- [ ] Thank you's to external contributors (check items to see if they were contributed by somebody external, and add "Thanks @username!")

**Remove:**
- [ ] Changelog items that cannot be made understandable to the user.
- [ ] "Refactor" items unless they bring some user benefit like performance.
- [ ] Any items about tests because they're not always relevant to the user.
- [ ] Any items about dependency updates.
- [ ] Any items about minor dependency updates. We can still list major ones (like Electron, React Native, OrbitDB, IPFS, Tor, libp2p, etc.) under improvements.
- [ ] Any fixes that relate to previously-unreleased features, since from the user's point of view these are included in the new feature.

**Group & rewrite:**
- [ ] Group new features, improvements, fixes, breaking changes, and notes
- [ ] Rewrite items as result-oriented complete sentences under "Fixes:" category like "peers now dial..." or "long messages are no longer truncated..."
- [ ] Rewrite improvements as noun phrases. e.g. "Better descriptions of the joining process"
- [ ] Use standard capitalization and punctuation of sentences.

## Changelog best practices

- [ ] fixes in the changelog should reference the issue they fix!
- [ ] Make all changelog items understandable to a technical user whenever possible, assuming no knowledge of Quiet internals.
- [ ] When the fix refers to an issue, mention the problem the fix is solving in the changelog entry (e.g. "network data proceeding when using custom protocol multiple times" should be "fixes unclear UI when joining a second community by changing how we handle custom URIs" or something like that)
- [ ] Be consistent. Let’s use “fix:” “improvement”, “breaking change:” and not “fixed” or “fixes”.
- [ ] When possible, keep in mind the release notes style guide when writing changelog items; this will make assembling release notes easier.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import PeerId from 'peer-id'
import { getLibp2pAddressesFromCsrs, removeFilesFromDir } from '../common/utils'

import {
AskForMessagesPayload,
ChannelMessagesIdsResponse,
GetMessagesPayload,
ChannelMessageIdsResponse,
type DeleteChannelResponse,
ChannelsReplicatedPayload,
Community,
Expand Down Expand Up @@ -43,7 +43,7 @@ import {
CommunityMetadata,
type PermsData,
type UserProfile,
type UserProfilesLoadedEvent,
type UserProfilesStoredEvent,
} from '@quiet/types'
import { CONFIG_OPTIONS, QUIET_DIR, SERVER_IO_PROVIDER, SOCKS_PROXY_AGENT } from '../const'
import { ConfigOptions, GetPorts, ServerIoProviderTypes } from '../types'
Expand Down Expand Up @@ -254,7 +254,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
} catch (e) {
this.logger.error(`Creating network for community ${community.id} failed`, e)
emitError(this.serverIoProvider.io, {
type: SocketActionTypes.NETWORK,
type: SocketActionTypes.CREATE_NETWORK,
message: ErrorMessages.NETWORK_SETUP_FAILED,
community: community.id,
})
Expand All @@ -272,7 +272,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
if (!isPSKcodeValid(psk)) {
this.logger.error('Creating network: received Libp2p PSK is not valid')
emitError(this.serverIoProvider.io, {
type: SocketActionTypes.NETWORK,
type: SocketActionTypes.CREATE_NETWORK,
message: ErrorMessages.NETWORK_SETUP_FAILED,
community: community.id,
})
Expand All @@ -298,7 +298,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
const pskBase64 = Libp2pService.generateLibp2pPSK().psk
await this.localDbService.put(LocalDBKeys.PSK, pskBase64)
this.logger('Generated Libp2p PSK')
this.serverIoProvider.io.emit(SocketActionTypes.LIBP2P_PSK_SAVED, { psk: pskBase64 })
this.serverIoProvider.io.emit(SocketActionTypes.LIBP2P_PSK_STORED, { psk: pskBase64 })
}

public async createCommunity(payload: InitCommunityPayload) {
Expand All @@ -308,7 +308,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI

await this.launchCommunity(payload)
this.logger(`Created and launched community ${payload.id}`)
this.serverIoProvider.io.emit(SocketActionTypes.NEW_COMMUNITY, { id: payload.id })
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_CREATED, { id: payload.id })
}

public async launchCommunity(payload: InitCommunityPayload) {
Expand All @@ -326,7 +326,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
} catch (e) {
this.logger(`Couldn't launch community for peer ${payload.peerId.id}.`, e)
emitError(this.serverIoProvider.io, {
type: SocketActionTypes.COMMUNITY,
type: SocketActionTypes.LAUNCH_COMMUNITY,
message: ErrorMessages.COMMUNITY_LAUNCH_FAILED,
community: payload.id,
trace: e.stack,
Expand All @@ -336,7 +336,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI

this.logger(`Launched community ${payload.id}`)

this.serverIoProvider.io.emit(SocketActionTypes.CONNECTION_PROCESS_INFO, ConnectionProcessInfo.LAUNCHED_COMMUNITY)
this.serverIoProvider.io.emit(SocketActionTypes.CONNECTION_PROCESS_INFO, ConnectionProcessInfo.COMMUNITY_LAUNCHED)

this.communityId = payload.id
this.communityState = ServiceState.LAUNCHED
Expand All @@ -346,7 +346,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
// Unblock websocket endpoints
this.socketService.resolveReadyness()

this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY, { id: payload.id })
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_LAUNCHED, { id: payload.id })
}

public async spawnTorHiddenService() {
Expand Down Expand Up @@ -448,8 +448,8 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
}

private attachRegistrationListeners() {
this.registrationService.on(SocketActionTypes.SAVED_OWNER_CERTIFICATE, payload => {
this.serverIoProvider.io.emit(SocketActionTypes.SAVED_OWNER_CERTIFICATE, payload)
this.registrationService.on(SocketActionTypes.OWNER_CERTIFICATE_ISSUED, payload => {
this.serverIoProvider.io.emit(SocketActionTypes.OWNER_CERTIFICATE_ISSUED, payload)
})
this.registrationService.on(RegistrationEvents.ERROR, payload => {
emitError(this.serverIoProvider.io, payload)
Expand All @@ -462,14 +462,14 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
// Update Frontend with Initialized Communities
if (this.communityId) {
console.log('Hunting for heisenbug: Backend initialized community and sent event to state manager')
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY, { id: this.communityId })
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_LAUNCHED, { id: this.communityId })
console.log('this.libp2pService.connectedPeers', this.libp2pService.connectedPeers)
console.log('this.libp2pservice', this.libp2pService)
this.serverIoProvider.io.emit(
SocketActionTypes.CONNECTED_PEERS,
Array.from(this.libp2pService.connectedPeers.keys())
)
this.serverIoProvider.io.emit(SocketActionTypes.RESPONSE_GET_CERTIFICATES, {
this.serverIoProvider.io.emit(SocketActionTypes.CERTIFICATES_STORED, {
certificates: await this.storageService?.loadAllCertificates(),
})
await this.storageService?.loadAllChannels()
Expand All @@ -492,7 +492,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
await this.launchCommunity(args)
})
this.socketService.on(
SocketActionTypes.SEND_COMMUNITY_METADATA,
SocketActionTypes.SET_COMMUNITY_METADATA,
async (payload: CommunityMetadata, callback: (response?: CommunityMetadata) => void) => {
const meta = await this.storageService?.updateCommunityMetadata(payload)
callback(meta)
Expand All @@ -503,10 +503,9 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
})

// Username registration
this.socketService.on(SocketActionTypes.SAVE_USER_CSR, async (payload: SaveCSRPayload) => {
this.logger(`socketService - ${SocketActionTypes.SAVE_USER_CSR}`)
this.socketService.on(SocketActionTypes.ADD_CSR, async (payload: SaveCSRPayload) => {
this.logger(`socketService - ${SocketActionTypes.ADD_CSR}`)
await this.storageService?.saveCSR(payload)
this.serverIoProvider.io.emit(SocketActionTypes.SAVED_USER_CSR, payload)
})
this.socketService.on(
SocketActionTypes.REGISTER_OWNER_CERTIFICATE,
Expand All @@ -517,8 +516,8 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
// TODO: Save community CA data in LevelDB. Perhaps save the
// entire Community type in LevelDB. We can probably do this once
// when creating the community.
this.socketService.on(SocketActionTypes.SEND_COMMUNITY_CA_DATA, async (payload: PermsData) => {
this.logger(`socketService - ${SocketActionTypes.SEND_COMMUNITY_CA_DATA}`)
this.socketService.on(SocketActionTypes.SET_COMMUNITY_CA_DATA, async (payload: PermsData) => {
this.logger(`socketService - ${SocketActionTypes.SET_COMMUNITY_CA_DATA}`)
this.registrationService.setPermsData(payload)
})

Expand Down Expand Up @@ -549,9 +548,12 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.socketService.on(SocketActionTypes.SEND_MESSAGE, async (args: SendMessagePayload) => {
await this.storageService?.sendMessage(args.message)
})
this.socketService.on(SocketActionTypes.ASK_FOR_MESSAGES, async (args: AskForMessagesPayload) => {
await this.storageService?.askForMessages(args.channelId, args.ids)
})
this.socketService.on(
SocketActionTypes.GET_MESSAGES,
async (payload: GetMessagesPayload, callback: (response?: MessagesLoadedPayload) => void) => {
callback(await this.storageService?.getMessages(payload.channelId, payload.ids))
}
)

// Files
this.socketService.on(SocketActionTypes.DOWNLOAD_FILE, async (metadata: FileMetadata) => {
Expand All @@ -560,7 +562,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.socketService.on(SocketActionTypes.UPLOAD_FILE, async (metadata: FileMetadata) => {
await this.storageService?.uploadFile(metadata)
})
this.socketService.on(SocketActionTypes.UPLOADED_FILE, async (args: FileMetadata) => {
this.socketService.on(SocketActionTypes.FILE_UPLOADED, async (args: FileMetadata) => {
await this.storageService?.uploadFile(args)
})
this.socketService.on(SocketActionTypes.CANCEL_DOWNLOAD, mid => {
Expand All @@ -573,7 +575,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
})

// User Profile
this.socketService.on(SocketActionTypes.SAVE_USER_PROFILE, async (profile: UserProfile) => {
this.socketService.on(SocketActionTypes.SET_USER_PROFILE, async (profile: UserProfile) => {
await this.storageService?.addUserProfile(profile)
})
}
Expand All @@ -583,58 +585,55 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.storageService.on(SocketActionTypes.CONNECTION_PROCESS_INFO, data => {
this.serverIoProvider.io.emit(SocketActionTypes.CONNECTION_PROCESS_INFO, data)
})
this.storageService.on(StorageEvents.REPLICATED_CERTIFICATES, (payload: SendCertificatesResponse) => {
this.logger(`Storage - ${StorageEvents.REPLICATED_CERTIFICATES}`)
this.serverIoProvider.io.emit(SocketActionTypes.RESPONSE_GET_CERTIFICATES, payload)
this.storageService.on(StorageEvents.CERTIFICATES_STORED, (payload: SendCertificatesResponse) => {
this.logger(`Storage - ${StorageEvents.CERTIFICATES_STORED}`)
this.serverIoProvider.io.emit(SocketActionTypes.CERTIFICATES_STORED, payload)
})
this.storageService.on(StorageEvents.LOAD_PUBLIC_CHANNELS, (payload: ChannelsReplicatedPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.CHANNELS_REPLICATED, payload)
this.storageService.on(StorageEvents.CHANNELS_STORED, (payload: ChannelsReplicatedPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.CHANNELS_STORED, payload)
})
this.storageService.on(StorageEvents.MESSAGES_LOADED, (payload: MessagesLoadedPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.MESSAGES_LOADED, payload)
this.storageService.on(StorageEvents.MESSAGES_STORED, (payload: MessagesLoadedPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.MESSAGES_STORED, payload)
})
this.storageService.on(StorageEvents.SEND_MESSAGES_IDS, (payload: ChannelMessagesIdsResponse) => {
this.storageService.on(StorageEvents.MESSAGE_IDS_STORED, (payload: ChannelMessageIdsResponse) => {
if (payload.ids.length === 0) {
return
}
this.serverIoProvider.io.emit(SocketActionTypes.SEND_MESSAGES_IDS, payload)
this.serverIoProvider.io.emit(SocketActionTypes.MESSAGE_IDS_STORED, payload)
})
this.storageService.on(StorageEvents.CHANNEL_SUBSCRIBED, (payload: ChannelSubscribedPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.CHANNEL_SUBSCRIBED, payload)
})
this.storageService.on(StorageEvents.REMOVE_DOWNLOAD_STATUS, (payload: RemoveDownloadStatus) => {
this.serverIoProvider.io.emit(SocketActionTypes.REMOVE_DOWNLOAD_STATUS, payload)
})
this.storageService.on(StorageEvents.UPLOADED_FILE, (payload: UploadFilePayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.UPLOADED_FILE, payload)
this.storageService.on(StorageEvents.FILE_UPLOADED, (payload: UploadFilePayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.FILE_UPLOADED, payload)
})
this.storageService.on(StorageEvents.UPDATE_DOWNLOAD_PROGRESS, (payload: DownloadStatus) => {
this.storageService.on(StorageEvents.DOWNLOAD_PROGRESS, (payload: DownloadStatus) => {
this.serverIoProvider.io.emit(SocketActionTypes.DOWNLOAD_PROGRESS, payload)
})
this.storageService.on(StorageEvents.UPDATE_MESSAGE_MEDIA, (payload: FileMetadata) => {
this.serverIoProvider.io.emit(SocketActionTypes.UPDATE_MESSAGE_MEDIA, payload)
this.storageService.on(StorageEvents.MESSAGE_MEDIA_UPDATED, (payload: FileMetadata) => {
this.serverIoProvider.io.emit(SocketActionTypes.MESSAGE_MEDIA_UPDATED, payload)
})
this.storageService.on(StorageEvents.UPDATE_PEERS_LIST, (payload: StorePeerListPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.PEER_LIST, payload)
})
this.storageService.on(StorageEvents.SEND_PUSH_NOTIFICATION, (payload: PushNotificationPayload) => {
this.serverIoProvider.io.emit(SocketActionTypes.PUSH_NOTIFICATION, payload)
})
this.storageService.on(StorageEvents.CHECK_FOR_MISSING_FILES, (payload: CommunityId) => {
this.serverIoProvider.io.emit(SocketActionTypes.CHECK_FOR_MISSING_FILES, payload)
})
this.storageService.on(StorageEvents.REPLICATED_CSR, async (payload: { csrs: string[] }) => {
this.logger(`Storage - ${StorageEvents.REPLICATED_CSR}`)
this.storageService.on(StorageEvents.CSRS_STORED, async (payload: { csrs: string[] }) => {
this.logger(`Storage - ${StorageEvents.CSRS_STORED}`)
this.libp2pService.emit(Libp2pEvents.DIAL_PEERS, await getLibp2pAddressesFromCsrs(payload.csrs))
this.serverIoProvider.io.emit(SocketActionTypes.RESPONSE_GET_CSRS, payload)
this.serverIoProvider.io.emit(SocketActionTypes.CSRS_STORED, payload)
this.registrationService.emit(RegistrationEvents.REGISTER_USER_CERTIFICATE, payload)
})
this.storageService.on(StorageEvents.COMMUNITY_METADATA_LOADED, async (meta: CommunityMetadata) => {
this.logger(`Storage - ${StorageEvents.COMMUNITY_METADATA_LOADED}: ${meta}`)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_METADATA_LOADED, meta)
this.storageService.on(StorageEvents.COMMUNITY_METADATA_STORED, async (meta: CommunityMetadata) => {
this.logger(`Storage - ${StorageEvents.COMMUNITY_METADATA_STORED}: ${meta}`)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_METADATA_STORED, meta)
})
this.storageService.on(StorageEvents.LOADED_USER_PROFILES, (payload: UserProfilesLoadedEvent) => {
this.serverIoProvider.io.emit(SocketActionTypes.LOADED_USER_PROFILES, payload)
this.storageService.on(StorageEvents.USER_PROFILES_STORED, (payload: UserProfilesStoredEvent) => {
this.serverIoProvider.io.emit(SocketActionTypes.USER_PROFILES_STORED, payload)
})
}
}
Loading

0 comments on commit 6322613

Please sign in to comment.