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

#50 - 3.4 compatibility #51

Merged
merged 2 commits into from
Dec 23, 2023
Merged

Conversation

mariuszsienkiewicz
Copy link
Contributor

@mariuszsienkiewicz mariuszsienkiewicz commented Oct 3, 2023

Resolves: #50.

I tried to maintain the existing plugin structure. The main changes are that the callback function has been renamed to sendSubmissionFiles and is called from the PlagiarismSubmissionSubmitListener class. Maybe it would be better to move the entire method to the listener, but as I mentioned, I didn't want to make too significant changes to the structure so I left it like that.

@asmecher
Copy link
Member

asmecher commented Oct 3, 2023

Thanks, @mariuszsienkiewicz! @touhidurabir, could you review this one?

**/
function getForcedCredentials() {
**/
function getForcedCredentials()
Copy link
Member

@touhidurabir touhidurabir Dec 8, 2023

Choose a reason for hiding this comment

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

How about adding proper return type hint as starting from 3.4 we start following more strict type implementation like adding proper param type and return type . It can be here and anywhere possible .

Copy link
Member

Choose a reason for hiding this comment

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

Yes please!

function getActions($request, $verb)
{
$router = $request->getRouter();
import('lib.pkp.classes.linkAction.request.AjaxModal');
Copy link
Member

Choose a reason for hiding this comment

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

we can remove these import method calls to load class as we have proper namespace feature now

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that should be part of adapting any code forward from 3.3 (along with the other things in the 3.4 Release Notebook).

}

/**
* Low-budget mock class for \bsobbe\ithenticate\Ithenticate -- Replace the
* constructor above with this class name to log API usage instead of
* interacting with the iThenticate service.
*/
class TestIthenticate {
public function __construct($username, $password) {
class TestIthenticate
Copy link
Member

Choose a reason for hiding this comment

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

Instead of having this TestIthenticate in the PlagiarismPlugin.php class file, it's better to have it in own file with proper namespace .

error_log("Constructing iThenticate: $username $password");
}

public function fetchGroupList() {
public function fetchGroupList()
{
error_log('Fetching iThenticate group list');
return array();
Copy link
Member

Choose a reason for hiding this comment

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

As we are using newer array syntax [], better to keep that same format everywhere like return [] ;

$this->_plugin->updateSetting($this->_contextId, 'ithenticateUser', trim($this->getData('ithenticateUser'), "\"\';"), 'string');
$this->_plugin->updateSetting($this->_contextId, 'ithenticatePass', trim($this->getData('ithenticatePass'), "\"\';"), 'string');
$this->_plugin->updateSetting($this->_contextId, 'ithenticateUser', trim($this->getData('ithenticateUser'), "\"\';"), 'string');
$this->_plugin->updateSetting($this->_contextId, 'ithenticatePass', trim($this->getData('ithenticatepass'), "\"\';"), 'string');
Copy link
Member

Choose a reason for hiding this comment

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

It should be be ithenticatePass instead of ithenticatepass that is with capital P .

{

/** @var PlagiarismPlugin $plugin */
private $plugin;
Copy link
Member

Choose a reason for hiding this comment

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

perhaps better to use exact property type hint like private PlagiarismPlugin $plugin ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, throughout.

{
$events->listen(
SubmissionSubmitted::class,
PlagiarismSubmissionSubmitListener::class
Copy link
Member

Choose a reason for hiding this comment

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

instead of specifying the exact class name here, we can do it like

$events->listen(
            SubmissionSubmitted::class,
            [static::class, 'handle']
)

public function sendErrorMessage($submissionid, $message) {
**/
public function sendErrorMessage($submissionid, $message)
{
$request = Application::get()->getRequest();
$context = $request->getContext();
import('classes.notification.NotificationManager');
Copy link
Member

Choose a reason for hiding this comment

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

@touhidurabir
Copy link
Member

@mariuszsienkiewicz sorry for the late, I have added few comments . can you check those ?

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.

OJS 3.4 support
3 participants