Skip to content

Refactor more methods to the SearchService#3775

Merged
demiankatz merged 14 commits intovufind-org:devfrom
demiankatz:search-service
Jun 13, 2024
Merged

Refactor more methods to the SearchService#3775
demiankatz merged 14 commits intovufind-org:devfrom
demiankatz:search-service

Conversation

@demiankatz
Copy link
Member

@demiankatz demiankatz commented Jun 8, 2024

This fills in more methods of the search service. Note that some of the work here is redundant with #3732 because I had to copy some test refactoring from there to get things passing here. If that PR is reviewed first, it will reduce the diffs here. Also note that I haven't updated the expiration command yet; that will be easier after #3714 is merged.

TODO

  • Update changelog when merging (VuFind\Search\SearchNormalizer and VuFindConsole\Command\ScheduledSearch\NotifyCommand constructors)

@demiankatz demiankatz added the architecture pull requests that involve significant refactoring / architectural changes label Jun 8, 2024
@demiankatz demiankatz added this to the 10.0 milestone Jun 8, 2024
@demiankatz demiankatz requested review from EreMaijala and aleksip June 9, 2024 19:59
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class SecretCalculator
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't love this class, but the search unsubscribe calculation had to go into a shared location, and it seemed better to create a new class than to overload the existing HMAC class, which seemed like inappropriate scope creep.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well at least the name of the class made me smile. 😄

);
return false;
}
if (!$user = $s->getUser()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Due to changes in the way the search and user entities relate to one another, it seemed cleanest to eliminate the user caching logic in order to simplify the code and reduce dependencies. In some situations, this may put slightly higher load on the database, but looking up a user by primary key is not an expensive operation, so I'm not too concerned about it.

*
* @return void
*/
public function testNotificationsWithMissingUser()
Copy link
Member Author

Choose a reason for hiding this comment

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

Due to changes in user handling in the command, this test no longer applies, so I simply deleted it.

* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class SecretCalculator
Copy link
Contributor

Choose a reason for hiding this comment

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

Well at least the name of the class made me smile. 😄

* @return void
*/
public function testDestroy(): void
public function ztestDestroy(): void
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is how I disable tests, but no idea why I disabled that and forgot to re-enable it. Definitely not intentional; reverted now (and the test is passing :-) ).

@demiankatz demiankatz removed the request for review from EreMaijala June 13, 2024 16:05
@demiankatz demiankatz merged commit 692b8bd into vufind-org:dev Jun 13, 2024
@demiankatz demiankatz deleted the search-service branch June 13, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

architecture pull requests that involve significant refactoring / architectural changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants