• Oswaldo Ferreira's avatar
    Adjust unnapliable suggestions in expanded lines · 7998e114
    Oswaldo Ferreira authored
    When expanding diff lines and leaving suggestion comments,
    eventually, they showed as unnapliable
    even with no changes in the diff.
    
    It happened given the `DiffNote#supports_suggestion?` check was
    being made at `Suggestion#appliable?` in the discussions iteration.
    
    The problem with `DiffNote#supports_suggestion?` as it is that
    it uses `Position#diff_file`, which has a RequestStore "cache".
    
    So for instance, if we have 3 comments in expanded diff lines
    for the same diff file, just the _first_ expansion would be
    considered, therefore, just the _first_ suggestion within
    this set of comments on expanded lines would be
    appliable.
    
    All in all, we're able to simply remove this check from the
    `appliable?` method given we already check if the note supports
    suggestions uppon creation (`Suggestions::CreateService`).
    
    As an extra outcome, we'll submit less Gitaly requests.
    7998e114
position_spec.rb 18.3 KB