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

Simplify getserver2serverproperties method #799

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

settermjd
Copy link

@settermjd settermjd commented Oct 4, 2018

Fixes: No specific issue number. The commit seemed worthwhile, as I was reviewing the code.

Licence: MIT or AGPL

Description

This PR simplifies (and adds tests to) PageController::getServer2ServerProperties(). I noticed that it could be streamlined while conducting a code audit.

Features

n/a

Screenshots or screencasts

n/a

Caveats

n/a

Tests

Added tests for:

  • When a password is set and serve-to-server sharing is enabled
  • When a password is not set or null and serve-to-server sharing is enabled

Tested on

  • Windows/Firefox
  • Android 6.1/Chrome
  • macOS/command-line

TODO

  • Add more test data to the test's data provider method

Check list

  • Code is properly documented
  • Code is properly formatted
  • Commits have been squashed
  • Tests (unit, integration, api and/or acceptance) are included
  • Documentation (manuals or wiki) has been updated or is not required

Reviewers

@patrickjahns

While reviewing this method as part of a software audit, I noticed a
couple of areas where the method could, potentially, be streamlined, and
improved. This commit adds the initial set of tests which make those
improvements possible.
$server2ServerSharing doesn't need to be instantiated, as the comparison
natively returns true or false. As a result, returning the result of the
comparison can be done when initialising the returned array.
While there's nothing wrong with how it's currently done, I feel that
it's overly verbose, and can be simplified, as in this commit. By doing
so, it should make it that much easier to read and maintain.
Potentially not necessary, but having the function arguments listed
underneath each other seemed to be that much easier to read. Perhaps
it's just me, but it seems worth doing.
@settermjd
Copy link
Author

settermjd commented Oct 11, 2018

@patrickjahns, would you mind reviewing this PR?

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.

2 participants