Skip to content
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

feat(CLNP-2026): support reactions for super group channel #159

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

bang9
Copy link
Collaborator

@bang9 bang9 commented Jan 30, 2024

External Contributions

This project is not yet set up to accept pull requests from external contributors.

If you have a pull request that you believe should be accepted, please contact
the Developer Relations team [email protected] with details
and we'll evaluate if we can setup a CLA to allow for the contribution.

For Internal Contributors

CLNP-2026

Description Of Changes

Add a brief description of the changes that you have involved in this PR

Types Of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply_

  • Bugfix
  • New feature
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance (ex) Prettier)
  • Build configuration
  • Improvement (refactor code)
  • Test

@bang9 bang9 requested a review from HoonBaek January 30, 2024 05:48
@bang9 bang9 self-assigned this Jan 30, 2024
@bang9 bang9 changed the title feat: support reactions for super group channel feat(CLNP-2026): support reactions for super group channel Jan 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 13.00%. Comparing base (48aa109) to head (8ab0720).

Files Patch % Lines
...native/src/components/ChannelMessageList/index.tsx 0.00% 3 Missing ⚠️
...c/components/GroupChannelMessageRenderer/index.tsx 0.00% 2 Missing ⚠️
...es/uikit-react-native/src/contexts/ReactionCtx.tsx 0.00% 1 Missing ⚠️
packages/uikit-utils/src/sendbird/message.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
- Coverage   13.01%   13.00%   -0.01%     
==========================================
  Files         334      334              
  Lines        7430     7434       +4     
  Branches     2050     2052       +2     
==========================================
  Hits          967      967              
- Misses       6392     6396       +4     
  Partials       71       71              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bang9 bang9 marked this pull request as draft February 2, 2024 02:24
@bang9 bang9 force-pushed the feat/reactions-super-group branch from 9e3de0f to a566725 Compare February 2, 2024 02:25
@bang9 bang9 removed the request for review from HoonBaek February 2, 2024 02:25
@bang9 bang9 marked this pull request as ready for review March 15, 2024 02:44
@bang9 bang9 requested a review from HoonBaek March 22, 2024 06:23
@bang9 bang9 force-pushed the feat/reactions-super-group branch from a566725 to 8ab0720 Compare March 22, 2024 06:43
Copy link

@HoonBaek HoonBaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing the param reactionEnabled to config for the shouldRenderReaction?

// Usage
const configs = sbOptions.uikitWithAppInfo.groupChannel.channel;
shouldRenderReaction(channel, configs)

// Function
export function shouldRenderReaction(channel: SendbirdBaseChannel, configs: CustomDefinedConfigType) {
  if (channel.isOpenChannel()) {
    return false;
  }

  if (channel.isGroupChannel()) {
    if (channel.isBroadcast) return false;
    if (channel.isEphemeral) return false;
    if (channel.isChatNotification) return false;
  }

  return channel.isSuper ? configs.enableReactionsSupergroup : configs.enableReactions;
}

@bang9
Copy link
Collaborator Author

bang9 commented Mar 25, 2024

How about changing the param reactionEnabled to config for the shouldRenderReaction?

// Usage
const configs = sbOptions.uikitWithAppInfo.groupChannel.channel;
shouldRenderReaction(channel, configs)

// Function
export function shouldRenderReaction(channel: SendbirdBaseChannel, configs: CustomDefinedConfigType) {
  if (channel.isOpenChannel()) {
    return false;
  }

  if (channel.isGroupChannel()) {
    if (channel.isBroadcast) return false;
    if (channel.isEphemeral) return false;
    if (channel.isChatNotification) return false;
  }

  return channel.isSuper ? configs.enableReactionsSupergroup : configs.enableReactions;
}

In such cases, it's preferable to receive a single value determined externally rather than adding logic internally to handle multiple values.

For example, if we need to determine the enabled status of a reaction and it requires adding a flag at the module level rather than in the config, then we should add a new parameter.

This is similar to why we can pass anything to the children when rendering components. (we should not write code that brings outside events inside the house to resolve them.)

@bang9 bang9 merged commit e8c2a86 into main Mar 26, 2024
6 checks passed
@bang9 bang9 deleted the feat/reactions-super-group branch March 26, 2024 01:23
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.

3 participants