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

fix: Response card issues #1957

Merged
merged 11 commits into from
Jan 25, 2024
Merged

fix: Response card issues #1957

merged 11 commits into from
Jan 25, 2024

Conversation

Dhruwang
Copy link
Contributor

What does this PR do?

Fixes
Deleted response not being removed from response list (1710)
Changes in response note not being reflected (1745)
Changes in tags not being reflected

How should this be tested?

Delete Response
Play with response notes
Response tags

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Jan 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 11:39am
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Jan 25, 2024 11:39am

Copy link
Contributor

github-actions bot commented Jan 24, 2024

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

packages/ui/SingleResponseCard/index.tsx

The function isValidValue checks if a value is valid based on several conditions. It would be more readable to break this function into smaller functions, each checking a specific condition.
Create Issue
See the diff
Checkout the fix

    function isNonEmptyString(value: any) {
      return typeof value === "string" && value.trim() !== "";
    }

    function isNonEmptyArray(value: any) {
      return Array.isArray(value) && value.length > 0;
    }

    function isNumber(value: any) {
      return typeof value === "number";
    }

    function isValidValue(value: any) {
      return isNonEmptyString(value) || isNonEmptyArray(value) || isNumber(value);
    }
git fetch origin && git checkout -b ReviewBot/The-n-jkwdpvz origin/ReviewBot/The-n-jkwdpvz

packages/ui/SingleResponseCard/actions.ts

Consider using a more descriptive error message when throwing an AuthorizationError. This will help in debugging and understanding the context of the error. Also, consider extracting the authorization check into a separate function to improve readability and maintainability.
Create Issue
See the diff
Checkout the fix

    export const deleteTagOnResponseAction = async (responseId: string, tagId: string, surveyId: string) => {
      const session = await getServerSession(authOptions);
      if (!session) throw new AuthorizationError("Not authorized");

      await checkAuthorization(session.user!.id, tagId, responseId);

      const tag = await getTag(tagId);
      const { hasDeleteAccess } = await verifyUserRoleAccess(tag!.environmentId, session.user!.id);
      if (!hasDeleteAccess) throw new AuthorizationError("Not authorized");

      return await deleteTagOnResponse(responseId, tagId, surveyId);
    };
git fetch origin && git checkout -b ReviewBot/Impro-ew34v10 origin/ReviewBot/Impro-ew34v10

@Dhruwang Dhruwang mentioned this pull request Jan 24, 2024
12 tasks
Copy link
Member

@mattinannt mattinannt left a comment

Choose a reason for hiding this comment

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

@Dhruwang seems like everything's working now 😊💪🔥 Let's merge this and get the release ready 🚀

@mattinannt mattinannt added this pull request to the merge queue Jan 25, 2024
Merged via the queue into main with commit c29c580 Jan 25, 2024
12 checks passed
@mattinannt mattinannt deleted the response-note-issue branch January 25, 2024 12:05
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.

None yet

2 participants