-
Couldn't load subscription status.
- Fork 240
Closed
Labels
DEV: frontendP1 - importantPriority: High impact on UXPriority: High impact on UXTAG: new featureTAG: unit testsjavascriptPull requests that update Javascript codePull requests that update Javascript code
Milestone
Description
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_URLandFeedbackTypeOptionsto ensure consistency.
FeedbackTypeOptions should be:
{
imported: 'imported',
rejected: 'rejected',
previewed: 'previewed',
showmore: 'showmore',
ignored: 'ignored',
flagged: 'flagged',
}
-
BaseFeedBack Class:
- Create a class named
BaseFeedbackwith the constructor accepting parameters forcontext,contentnode_id, andcontent_id. - Include the properties:
id,context,contentnode_id, andcontent_id. - Add class method
getDataObjectto 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
getDataObjectmethod should return an object excluding theURLfield of the class. - Add class method
getUrlto retrieve the object's URL. Throw an error if URL is not defined.
- Create a class named
-
BaseFeedbackEvent Class:
- Extend
BaseFeedbackto create the classBaseFeedbackEvent. - Utilize the parameters from the
BaseFeedbackclass by passing them to the super constructor. - Add fields for
userandtarget_channel_idto the constructor.
- Extend
-
BaseFeedbackInteractionEvent Class:
- Extend
BaseFeedbackto create the classBaseFeedbackInteractionEvent. - Utilize the parameters from the
BaseFeedbackInteractionEvenclass by passing them to the super constructor. - Add fields for
feedback_typeandfeedback_reasonto the constructor.
- Extend
-
BaseFlagFeedback Class:
- Extend
BaseFeedbackInteractionEventto create the classBaseFlagFeedback. - Add fields for
target_topic_idto the constructor.
- Extend
-
FlagFeedbackEvent Class:
- Extend
BaseFlagFeedbackto create the classFlagFeedbackEvent. - Add the URL property and set it to
FLAG_FEEDBACK_EVENT_URL.
- Extend
Acceptance criteria
- Inheritance should be maintained with each subsequent class extending the previous one.
- Constants
FLAG_FEEDBACK_EVENT_URLandFeedbackTypeOptionsshould be appropriately defined. - The
BaseFeedback classshould be correctly implemented with properties and methods as specified. - Unit tests
Metadata
Metadata
Assignees
Labels
DEV: frontendP1 - importantPriority: High impact on UXPriority: High impact on UXTAG: new featureTAG: unit testsjavascriptPull requests that update Javascript codePull requests that update Javascript code