Skip to content

Fix notices in tag admin code.#2249

Merged
demiankatz merged 1 commit into
vufind-org:devfrom
demiankatz:tag-admin-fixes
Jan 5, 2022
Merged

Fix notices in tag admin code.#2249
demiankatz merged 1 commit into
vufind-org:devfrom
demiankatz:tag-admin-fixes

Conversation

@demiankatz
Copy link
Copy Markdown
Member

This PR fixes some notices discovered while working on PR #2233. There were some incorrect assumptions about operator precedence and types which are corrected here.

Copy link
Copy Markdown
Contributor

@EreMaijala EreMaijala left a comment

Choose a reason for hiding this comment

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

While the fixes seem to work, I'd like a couple of tweaks to the current code. Can I ask them here while we're at it? :)

@@ -198,18 +198,18 @@ protected function getConfirmDeleteMessages($count)
$user = $this->getTable('user')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd like an explicit null check for getParam return value for each type. Currently, in the unlikely case that the object selected gets deleted before the form is submitted, the current code results in "All", which is not right. I think the code should first check getParam(), and if it's set, either fetch the data or set the message to '' or something.

Later on, when adding the 'tag_delete_filter' message, I'd rather check for message strings other than 'All' rather than comparing them with false.

->current();
$userMsg = (false !== $user)
$userMsg = is_object($user)
? $user->username . " (" . $user->id . ")" : "All";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"All" here doesn't have a leading space while the others do. Any reason for that?

@demiankatz demiankatz merged commit cd4a458 into vufind-org:dev Jan 5, 2022
@demiankatz
Copy link
Copy Markdown
Member Author

Thanks, @EreMaijala -- I have merged the fixes as-is and will open a separate PR to address your suggestions (since they are not directly related to the work here).

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