-
Notifications
You must be signed in to change notification settings - Fork 73
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
editedBy item sort option for group libraries #154
base: master
Are you sure you want to change the base?
Conversation
vs INSERT IGNORE
controllers/ApiController.php
Outdated
@@ -482,7 +482,7 @@ public function init($extra) { | |||
|
|||
// Sorting by Item Type or Added By currently require writing to shard tables, so don't | |||
// send those to the read replicas | |||
if ($this->queryParams['sort'] == 'itemType' || $this->queryParams['sort'] == 'addedBy') { | |||
if ($this->queryParams['sort'] == 'itemType' || $this->queryParams['sort'] == 'addedBy' || $this->queryParams['sort'] == 'editedBy') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can switch this to in_array($this->queryParams['sort'], ['itemType', 'addedBy', 'editedBy'])
@@ -274,13 +274,15 @@ public static function search($libraryID, $onlyTopLevel = false, array $params = | |||
// Join temp table to query | |||
$sql .= "JOIN tmpItemTypeNames TITN ON (TITN.itemTypeID=$itemTypeIDSelector) "; | |||
break; | |||
|
|||
|
|||
case 'editedBy': | |||
case 'addedBy': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
editedBy
goes second, here and below
model/Items.inc.php
Outdated
case 'addedBy': | ||
$isGroup = Zotero_Libraries::getType($libraryID) == 'group'; | ||
$userParameter = $params['sort'] == "editedBy" ? 'lastModifiedByUserID' : 'createdByUserID'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use == 'addedBy'
instead
Fixes: #153