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

Implement Core Feedback Object Hierarchy #4366

Closed
ozer550 opened this issue Dec 19, 2023 · 0 comments · Fixed by #4373
Closed

Implement Core Feedback Object Hierarchy #4366

ozer550 opened this issue Dec 19, 2023 · 0 comments · Fixed by #4373
Assignees
Labels
DEV: frontend javascript Pull requests that update Javascript code P1 - important Priority: High impact on UX TAG: new feature TAG: unit tests

Comments

@ozer550
Copy link
Member

ozer550 commented Dec 19, 2023

Overview

Implement the base feedback object hierarchy, consisting of BaseFeedback, BaseFeedbackEvent, BaseFeedbackInteractionEvent, BaseFlagFeedback, and FlagFeedbackEvent. These classes should form the foundation for creating feedback objects in the feedback mechanism.

Description and outcomes

  • Create a utility file called feedbackApiUtils.js in frontend/shared folder.
  • Define constants FLAG_FEEDBACK_EVENT_URL and FeedbackTypeOptions to ensure consistency.
    FeedbackTypeOptions should be:
      {
              imported: 'imported',
              rejected: 'rejected',
              previewed: 'previewed',
              showmore: 'showmore',
              ignored: 'ignored',
              flagged: 'flagged',
      }
  • BaseFeedBack Class:

    • Create a class named BaseFeedback with the constructor accepting parameters for context, contentnode_id, and content_id.
    • Include the properties: id, context, contentnode_id, and content_id.
    • Add class method getDataObject to construct a data object excluding functions from the current instance. This should be used to convert the feedback object into a format suitable for API requests.
    • The getDataObject method should return an object excluding the URL field of the class.
    • Add class method getUrl to retrieve the object's URL. Throw an error if URL is not defined.
  • BaseFeedbackEvent Class:

    • Extend BaseFeedback to create the class BaseFeedbackEvent.
    • Utilize the parameters from the BaseFeedback class by passing them to the super constructor.
    • Add fields for user and target_channel_id to the constructor.
  • BaseFeedbackInteractionEvent Class:

    • Extend BaseFeedback to create the class BaseFeedbackInteractionEvent.
    • Utilize the parameters from the BaseFeedbackInteractionEven class by passing them to the super constructor.
    • Add fields for feedback_type and feedback_reason to the constructor.
  • BaseFlagFeedback Class:

    • Extend BaseFeedbackInteractionEvent to create the class BaseFlagFeedback.
    • Add fields for target_topic_id to the constructor.
  • FlagFeedbackEvent Class:

    • Extend BaseFlagFeedback to create the class FlagFeedbackEvent.
    • Add the URL property and set it to FLAG_FEEDBACK_EVENT_URL.

Acceptance criteria

  • Inheritance should be maintained with each subsequent class extending the previous one.
  • Constants FLAG_FEEDBACK_EVENT_URL and FeedbackTypeOptions should be appropriately defined.
  • The BaseFeedback class should be correctly implemented with properties and methods as specified.
  • Unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: frontend javascript Pull requests that update Javascript code P1 - important Priority: High impact on UX TAG: new feature TAG: unit tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant