Skip to content

Feature/issue 40 viewcomments permission - #41

Open
markuskeunecke wants to merge 2 commits into
ArchiXL:masterfrom
markuskeunecke:feature/issue_40_viewcomments_permission
Open

Feature/issue 40 viewcomments permission#41
markuskeunecke wants to merge 2 commits into
ArchiXL:masterfrom
markuskeunecke:feature/issue_40_viewcomments_permission

Conversation

@markuskeunecke

Copy link
Copy Markdown

Pull request for #40.

@robinwiel

Copy link
Copy Markdown
Collaborator

Dear Markus, thank you for submitting a PR for this new feature. We will take it under review.

@robinwiel robinwiel self-assigned this Jul 30, 2026
mounted() {
// Only initialize selection events in regular page mode
if (!this.store.isSpecialPageMode) {
if (!this.store.isSpecialPageMode && this.userStore.canAddComments) {

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.

it seems userStore isn't avaible here yet. the userStore should be returned inside the setup() function at line 81
Image

Comment thread src/Api.php

private function doListComments() {
if ( !$this->canViewComments() ) {
$this->addError( 'smartcomments-api-list-error-no-permission' );

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've just noticed that the errors should be i18n strings but they are not. could you change this to be prefixed to sc-* just like other i18n and add it to the i18n files. i'll create a seperate mr where i fix the rest of the strings

Comment thread src/Hooks.php
Comment on lines +179 to +182
private static function canViewComments( \User $user ): bool {
return $user->isAllowed( self::PERMISSION_VIEW_COMMENTS ) ||
$user->isAllowed( self::PERMISSION_MANAGE_COMMENTS );
}

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.

Can you make this backwards compatible? Anyone with add-inlinecomments should still be able to view comments and use Special:SmartComments like before. otherwise wikis with custom groups lose access on upgrade without any config change. So the view check should be view || add || manage

Comment thread src/Api.php
);
}

private function canViewComments(): bool {

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.

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.

3 participants