Skip to content

Add back trimChar method to remove trailing +/-

Samantha Ming requested to merge 59028-fix-extra-plus-in-diffs into master

What does this MR do?

Trim first char of diff line text on diff discussions. Unfortunately the data that comes through includes the leading - or + (depending if user makes a comment on a deleted or newly added code).

props > discussion image

So on the frontend, we're going to manually remove it. I'm reusing the same method that was removed in MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24568

Issue

image

Solution

image

Test Case

  1. Navigate to Merge Requests > [select a MR] > Changes
  2. Make a comment in the source code
  3. Add a comment on the source code
  4. Leave any comment and click the "Comment" button to submit
  5. Now navigate to > Discussion (Do not refresh the page)
  6. Find the code when you left a comment, note there is no double + + or - - sign. Only one + or - exists.

note: if you left a comment on a deleted code, then the sign would be -. if you left a comment on a newly created code, then the sign would be +.

Tested on:

  • IE11
  • Edge
  • Safari
  • Firefox
  • Chrome

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #59028 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports