-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix(flow_notifications): Improve app loading by checking if notificat… #227
fix(flow_notifications): Improve app loading by checking if notificat… #227
Conversation
add1f8a
to
34921ea
Compare
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.
Hi @falghamdi125 and thanks for your contribution!
I have a small nitpick in the code, and also please run composer i && composer run cs:fix
and amend the resulting code style changes to the commit.
) { | ||
} | ||
|
||
public function handle(Event $event): void { | ||
if (!$event instanceof RegisterOperationsEvent) { | ||
return; | ||
} else if(!$this->appManager->isInstalled('notifications') || | ||
!$this->appManager->isEnabledForUser('notifications')) { | ||
$logger = \OC::$server->get(LoggerInterface::class); |
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.
please either inject the LoggerInterface in the constructor, or use \OCP\Log\logger(Application::APP_ID)->error(…)
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.
Done!
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.
Thanks! I pushed a followup commit for the style, that is not reflected in the cs-fixer rules yet, to have the operators on a new line.
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.
… on hindsight, the isInstalled check is not necessary, having !$this->appManager->isEnabledForUser('notifications')
is already sufficient.
Also, a brief hint into the descriptions https://github.com/nextcloud/flow_notifications/blob/master/appinfo/info.xml#L11 that notifications app is required could be a good addition, perhaps also into the Readme.
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.
Good point. You can't get isEnabledForUser true if the app wasn't installed. Code updated!
f7d2b8f
to
67d3855
Compare
1cb3566
to
b9228f1
Compare
…ions app is not installed and enabled when registering the app Signed-off-by: Faisal Alghamdi <[email protected]>
b9228f1
to
cc540d3
Compare
/backport to stable30 |
/backport to stable29 |
/backport to stable28 |
The backport to # Switch to the target branch and update it
git checkout stable29
git pull origin stable29
# Create the new backport branch
git checkout -b backport/227/stable29
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick cc540d37
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/227/stable29 Error: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
The backport to # Switch to the target branch and update it
git checkout stable28
git pull origin stable28
# Create the new backport branch
git checkout -b backport/227/stable28
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick cc540d37
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/227/stable28 Error: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
fwiw, code diverted a bit so backports to 29 and below do not apply. |
The PR basically improves app loading by checking if the notifications app is not installed and enabled when registering flow_notifications to prevent user workflow page from crashing by aborting app registering and log the error.
The error log message suggests & guides sysadmin to install the notifications app to allow registering flow_notifications.