Skip to content

Commit

Permalink
feat: reaction details are now paginated
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Sep 16, 2024
1 parent 1e7b3bf commit d10a8e0
Show file tree
Hide file tree
Showing 38 changed files with 930 additions and 373 deletions.
61 changes: 45 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
"ngx-float-ui": "^15.0.0",
"pretty-bytes": "^6.1.1",
"rxjs": "~7.4.0",
"stream-chat": "^8.26.0",
"starwars-names": "^1.6.0",
"stream-chat": "^8.40.1",
"ts-node": "^10.9.2",
"tslib": "^2.3.0",
"uuid": "^9.0.1",
Expand All @@ -141,10 +141,10 @@
"@semantic-release/exec": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@types/jasmine": "~3.8.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@types/starwars-names": "^1.6.2",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"copyfiles": "^2.4.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -161,7 +161,7 @@
"karma-jasmine-html-reporter": "~1.7.0",
"lint-staged": "^11.1.2",
"ng-packagr": "^15.2.2",
"prettier": "^2.4.0",
"prettier": "^2.8.8",
"prettier-eslint": "^13.0.0",
"semantic-release": "^18.0.0",
"typedoc": "^0.25.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<div class="message">{{ message?.text }}</div>
<div class="sender-info">
{{ message?.user?.name || message?.user?.id }} |
{{ message?.created_at | date: "long" }}
{{ message?.created_at | date : "long" }}
</div>
</div>
3 changes: 2 additions & 1 deletion projects/stream-chat-angular/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"rules": {
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off"
"@typescript-eslint/no-unsafe-member-access": "off",
"@angular-eslint/component-max-inline-declarations": "off"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,7 @@
></ng-container>
<ng-template #defaultFile let-attachmentContext="attachment">
<div
class="
str-chat__message-attachment-file--item
str-chat-angular__message-attachment-file-single
"
class="str-chat__message-attachment-file--item str-chat-angular__message-attachment-file-single"
>
<stream-icon-placeholder
class="str-chat__attachment-type-icon"
Expand Down Expand Up @@ -447,10 +444,7 @@
<div class="stream-chat-angular__image-modal str-chat__image-carousel">
<img
#imgElement
class="
stream-chat-angular__image-modal-image
str-chat__image-carousel-image
"
class="stream-chat-angular__image-modal-image str-chat__image-carousel-image"
data-testid="modal-image"
[src]="
getCarouselImageAttachmentConfiguration(
Expand Down Expand Up @@ -484,10 +478,7 @@
/>
<div>
<button
class="
stream-chat-angular__image-modal-stepper
str-chat__image-carousel-stepper str-chat__image-carousel-stepper-prev
"
class="stream-chat-angular__image-modal-stepper str-chat__image-carousel-stepper str-chat__image-carousel-stepper-prev"
data-testid="image-modal-prev"
type="button"
[ngStyle]="{
Expand All @@ -499,10 +490,7 @@
<stream-icon-placeholder icon="arrow-left"></stream-icon-placeholder>
</button>
<button
class="
stream-chat-angular__image-modal-stepper
str-chat__image-carousel-stepper str-chat__image-carousel-stepper-next
"
class="stream-chat-angular__image-modal-stepper str-chat__image-carousel-stepper str-chat__image-carousel-stepper-next"
type="button"
data-testid="image-modal-next"
[ngStyle]="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
<div class="str-chat__header-livestream-left str-chat__channel-header-end">
<p
data-testid="name"
class="
str-chat__header-livestream-left--title str-chat__channel-header-title
"
class="str-chat__header-livestream-left--title str-chat__channel-header-title"
>
{{ displayText }}
</p>
Expand All @@ -25,10 +23,7 @@
<ng-template #defaultChannelInfo>
<p
data-testid="info"
class="
str-chat__header-livestream-left--members
str-chat__channel-header-info
"
class="str-chat__header-livestream-left--members str-chat__channel-header-info"
>
{{'streamChat.{{ memberCount }} members' | translate:memberCountParam}}
{{canReceiveConnectEvents ? ('streamChat.{{ watcherCount }} online' |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@
>
<div class="str-chat__loading-channels-avatar"></div>
<div
class="
str-chat__loading-channels-meta str-chat__channel-preview-end-loading
"
class="str-chat__loading-channels-meta str-chat__channel-preview-end-loading"
>
<div class="str-chat__loading-channels-username"></div>
<div class="str-chat__loading-channels-status"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
></stream-avatar-placeholder>
</div>
<div
class="
str-chat__channel-preview-messenger--right str-chat__channel-preview-end
"
class="str-chat__channel-preview-messenger--right str-chat__channel-preview-end"
>
<ng-container
*ngTemplateOutlet="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ describe('ChannelPreviewComponent', () => {
component.channel = channel;
fixture.detectChanges();
const deletedMessage = mockMessage();
deletedMessage.deleted_at = new Date().toISOString();
deletedMessage.deleted_at = new Date();
channel.state.latestMessages[channel.state.latestMessages.length - 1] =
deletedMessage;
channel.handleEvent('message.updated', { message: deletedMessage });
Expand Down
10 changes: 8 additions & 2 deletions projects/stream-chat-angular/src/lib/channel.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ describe('ChannelService', () => {
service.activeChannel$.subscribe((c) => (activeChannel = c!));
const message =
activeChannel.state.messages[activeChannel.state.messages.length - 1];
message.deleted_at = new Date().toISOString();
message.deleted_at = new Date();
(activeChannel as MockChannel).handleEvent('message.deleted', { message });

expect(spy).toHaveBeenCalledWith(jasmine.arrayContaining([message]));
Expand Down Expand Up @@ -2153,7 +2153,13 @@ describe('ChannelService', () => {
expect(mockChatClient.queryChannels).toHaveBeenCalledWith(
jasmine.any(Object),
jasmine.any(Object),
{ limit: 20, state: true, presence: true, watch: true, message_limit: 25 }
{
limit: 20,
state: true,
presence: true,
watch: true,
message_limit: 25,
}
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe('ChannelService - threads', () => {
messages: [messageToDelete],
} as any as GetRepliesAPIResponse<DefaultStreamChatGenerics>);
await service.setAsActiveParentMessage(parentMessage);
messageToDelete.deleted_at = new Date().toISOString();
messageToDelete.deleted_at = new Date();
activeChannel.state.threads = { [parentMessage.id]: [messageToDelete] };
(activeChannel as MockChannel).handleEvent('message.deleted', {
message: messageToDelete,
Expand Down
2 changes: 2 additions & 0 deletions projects/stream-chat-angular/src/lib/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,7 @@ export class ChannelService<

/**
* Get the last 1200 reactions of a message in the current active channel. If you need to fetch more reactions please use the [following endpoint](https://getstream.io/chat/docs/javascript/send_reaction/?language=javascript#paginating-reactions).
* @deprecated use [`messageReactionsService.queryReactions()`](https://getstream.io/chat/docs/sdk/angular/services/MessageReactionsService/#queryreactions) instead
* @param messageId
* @returns all reactions of a message
*/
Expand Down Expand Up @@ -1768,6 +1769,7 @@ export class ChannelService<
message.reaction_scores = { ...e.message?.reaction_scores };
message.latest_reactions = [...(e.message?.latest_reactions || [])];
message.own_reactions = [...(e.message?.own_reactions || [])];
message.reaction_groups = { ...e.message?.reaction_groups };

messages[messageIndex] = { ...message };
isThreadMessage
Expand Down
4 changes: 3 additions & 1 deletion projects/stream-chat-angular/src/lib/chat-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class ChatClientService<
apiKey: string,
userOrId: string | OwnUserResponse<T> | UserResponse<T> | undefined,
userTokenOrProvider: TokenOrProvider,
clientOptions?: StreamChatOptions & { trackPendingChannelInvites?: boolean }
clientOptions?: StreamChatOptions & {
trackPendingChannelInvites?: boolean;
}
): ConnectAPIResponse<T> {
if (this.chatClient && this.chatClient.key !== apiKey) {
this.appSettingsSubject.next(undefined);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<div
#actionBox
data-testid="action-box"
class="
str-chat__message-actions-box
str-chat__message-actions-box-angular
str-chat__message-actions-box--open
"
class="str-chat__message-actions-box str-chat__message-actions-box-angular str-chat__message-actions-box--open"
>
<ul class="str-chat__message-actions-list">
<ng-container
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<textarea
#input
data-testid="textarea"
class="
rta__textarea
str-chat__textarea__textarea
str-chat__angular-textarea
str-chat__message-textarea
"
class="rta__textarea str-chat__textarea__textarea str-chat__angular-textarea str-chat__message-textarea"
rows="1"
[value]="value || ''"
[autofocus]="autoFocus"
Expand Down
Loading

0 comments on commit d10a8e0

Please sign in to comment.