Page MenuHomePhabricator

Add "inlinecomments-view" permission
Closed, ResolvedPublic

Description

The InlineComments extension has an "inlinecomments-add" permission, to dictate who can create and delete comments. (By default, it is open to all logged-in users.) There should additionally be an "inlinecomments-view" permission, to dictate who can view all these comments, to allow administrators to simply hide them from certain readers. This permission should by default be given to either all logged-in users or to everyone - I'm not sure.

Event Timeline

@Jatinder190124 - your enthusiasm is appreciated, but please just stick to one microtask - otherwise we will run out!

Hi @Yaron_Koren ,
I was working on this microtask. I have created another branch and made changes to the code, and when I push the code, it is giving me this error.
Can you help me with this?

image.png (432×1 px, 71 KB)

Hi @Yaron_Koren

Can you check this once I have Added the "inlinecomments-view" permission to the "AvailableRights" section as well as "GroupPermissions"

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1008028

I'm glad you got "git push" working, maybe! But there are two big problems with this patch: first, it's for the wrong repository - you should create a patch in the InlineComments repository, not in core MediaWiki's. (And you should "abandon" this patch.)

Second is that, though this patch defines the "inlinecomments-view" permission, it doesn't do anything with it - that is, there is nothing that only users with this permission can do.

Hey @Yaron_Koren can you provide me with more context about the inlinecomments-view permission.We want to enable certain user groups to view comments while restricting access for others. What steps should I take to define this permission?

I am thinking something like this,

$canViewComments = $this->permissionManager->userCan(
    'inlinecomments-view',
    $out->getUser(),
    $out->getTitle(),
    PermissionManager::RIGOR_QUICK
);

if ($canViewComments) {
    $this->loadComments($out);
} else {
    $this->hideComments($out);
}

Sure, it needs to look something like that - there would probably need to be an "if" check in at least one place in the code.

Hello @Yaron_Koren can you please check this patch once and provide any insights or changes required.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/InlineComments/+/1008107

Hi @Yaron_Koren I agree with you code was a bit more complex than it needs to be. I have tried to fix it,can you please review this patch.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/InlineComments/+/1008409

If possible, can you modify the original patch, instead of creating a new patch on top of it?

@Solaris22 Please try to give a empty space at the start and end of a parenthesis like this

Function add ( a, b ){

}

and for square brackets as well otherwise the final production build will fail due to the linting errors.

You can refer to other code written in the same file

Hey @Yaron_Koren , @Jatinder190124 ,Can you please review the latest patch. Sorry for any inconvenience caused, as I am still learning and exploring and might have caused some trouble while creating multiple patches. 

It looks better! I added my comments there. Also, please "abandon" the two other patches - the MediaWiki core patch, and 1008409.

Change 1008107 had a related patch set uploaded (by Solaris122; author: Solaris122):

[mediawiki/extensions/InlineComments@master] added inlinecomments-view permission

https://gerrit.wikimedia.org/r/1008107

Thank you, @Yaron_Koren, for helping me out throughout the patch. Can you tell me if there is anything else that needs to be done in this patch?
I really want to work under your guidance on the GSOC 2024 program.
Is there any other microtask that I can work on? Also, can I start working on my GSOC proposal?

Thank You

Change 1008107 merged by jenkins-bot:

[mediawiki/extensions/InlineComments@master] added inlinecomments-view permission

https://gerrit.wikimedia.org/r/1008107

Yaron_Koren claimed this task.

@Solaris22 - thank you for your work on this!

Hi @Yaron_Koren
I also want to take part in GSOC 2024, for which I have created the proposal, can you please take a look at it and review it.

Thank you.

https://phabricator.wikimedia.org/T359976

I just read through your proposal. It looks good!