-
Notifications
You must be signed in to change notification settings - Fork 89
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
feature/Display "<user> has joined <community>" message when unregistered user joins[NEW] #2067
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6b081b4
featrue: basic functionality
Kacper-RF 0859cca
feat: logic in verify saga, selector by pubKey
Kacper-RF 83a4c33
feat: handle owner case, add error log, extened selector
Kacper-RF 97aa140
feat: verifySaga tests, fix e2e tests, changelog
Kacper-RF 2d5c138
feat: merge
Kacper-RF 4339aef
feat: cleanup
Kacper-RF 6ef3084
Revert "feat: cleanup"
Kacper-RF 2904eef
feat: cleanup
Kacper-RF b80c480
fix: message in invitationLink.test
Kacper-RF 0c7daee
feat: lint
Kacper-RF 34d63b5
test: selector tests
Kacper-RF a29f81a
fix: selector and e2e test
Kacper-RF dce52e7
docs: add comment to verifySaga
Kacper-RF a52ccad
fix: code review
Kacper-RF 8d4565f
fix: CR fixes part I
Kacper-RF e62fb53
fix: take channelsReplicated
Kacper-RF c4b73b6
feat: merge
Kacper-RF 3120b11
fix: check action from take
Kacper-RF 0081c34
fix: types for channel
Kacper-RF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { PublicChannelStorage } from '@quiet/types' | ||
import { generateChannelId } from './channelAddress' | ||
import { userCreatedChannelMessage, userJoinedMessage, verifyUserInfoMessage } from './messages' | ||
|
||
describe('messages helper', () => { | ||
const username = 'johnny' | ||
|
||
const generalChannel: PublicChannelStorage = { | ||
name: 'general', | ||
description: 'Welcome to #general', | ||
timestamp: 1, | ||
owner: username, | ||
id: generateChannelId('general'), | ||
messages: { ids: [], entities: {} }, | ||
} | ||
|
||
const sportChannel: PublicChannelStorage = { | ||
name: 'sport', | ||
description: 'Welcome to #sport', | ||
timestamp: 1, | ||
owner: username, | ||
id: generateChannelId('sport'), | ||
messages: { ids: [], entities: {} }, | ||
} | ||
it('userCreatedChannelMessage', () => { | ||
const expectedMessage = '@johnny created #sport' | ||
const message = userCreatedChannelMessage(username, sportChannel.name) | ||
expect(message).toEqual(expectedMessage) | ||
}) | ||
|
||
it('userJoinedMessage', () => { | ||
const expectedMessage = | ||
'**@johnny** has joined and will be registered soon. 🎉 [Learn more](https://github.com/TryQuiet/quiet/wiki/Quiet-FAQ#how-does-username-registration-work)' | ||
const message = userJoinedMessage(username) | ||
expect(message).toEqual(expectedMessage) | ||
}) | ||
|
||
it('verifyUserInfoMessage - general channel', () => { | ||
const expectedMessage = | ||
'**@johnny** has joined and will be registered soon. 🎉 [Learn more](https://github.com/TryQuiet/quiet/wiki/Quiet-FAQ#how-does-username-registration-work)' | ||
const message = verifyUserInfoMessage(username, generalChannel) | ||
expect(message).toEqual(expectedMessage) | ||
}) | ||
|
||
it('verifyUserInfoMessage - other channel', () => { | ||
const expectedMessage = '@johnny created #sport' | ||
const message = verifyUserInfoMessage(username, sportChannel) | ||
expect(message).toEqual(expectedMessage) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { PublicChannelStorage } from '@quiet/types' | ||
|
||
export const userCreatedChannelMessage = (username: string, channelName: string) => | ||
`@${username} created #${channelName}` | ||
|
||
export const generalChannelDeletionMessage = (username: string) => `@${username} deleted all messages in #general` | ||
|
||
export const userJoinedMessage = (username: string) => | ||
`**@${username}** has joined and will be registered soon. 🎉 [Learn more](https://github.com/TryQuiet/quiet/wiki/Quiet-FAQ#how-does-username-registration-work)` | ||
|
||
export const verifyUserInfoMessage = (username: string, channel: PublicChannelStorage) => { | ||
if (channel.name === 'general') { | ||
return userJoinedMessage(username) | ||
} else { | ||
return userCreatedChannelMessage(username, channel.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/state-manager/src/sagas/messages/messages.selectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally you'd use factory-girl for mocking channel objects. It's minor though.