Skip to content
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

Warn if draft creator/submitter is blocked #106

Closed
AntiCompositeNumber opened this issue Feb 27, 2019 · 21 comments · Fixed by #219
Closed

Warn if draft creator/submitter is blocked #106

AntiCompositeNumber opened this issue Feb 27, 2019 · 21 comments · Fixed by #219
Labels
C-enhancement Category: enhancement E-good-first-issue Experience needed: zero (good first issue)

Comments

@AntiCompositeNumber
Copy link

If the person who created a draft has been blocked, it would be useful for AFCH to warn reviewers like it does for a lack of {{reflist}} or a deleted page. Users might be blocked for sockpuppetry, spam, paid editing, or other reasons that would necessitate a closer review.

@enterprisey enterprisey added the C-enhancement Category: enhancement label Jan 16, 2021
@enterprisey enterprisey added the E-good-first-issue Experience needed: zero (good first issue) label Mar 12, 2021
@codeswithroh
Copy link

@enterprisey Can I work in this issue ?

@Yash-g17
Copy link

Yash-g17 commented Mar 25, 2021

Hey @enterprisey and @AntiCompositeNumber , I'd love to work on this issue
Can you please assign me ?

@vartikaSaxena
Copy link

Hey @enterprisey, if this issue is still open I would like to work on it.

@paul-111
Copy link

hey @enterprisey can i be assigned in this issue? i would love to work with it

@enterprisey
Copy link
Contributor

enterprisey commented Aug 17, 2021

@codeswithroh @Yash-g17 @vartikaSaxena sorry for the late reply. if you're still interested in working on this issue, please add a comment here saying that. If two or more people are interested, the one who posted the original comment earlier has precedence. Or if you want to work together I'd be happy with that too.
@abarsha if none of them respond in a day you can have it

@Yash-g17
Copy link

@enterprisey I'm still interested

@paul-111
Copy link

@Yash-g17 hey can we work together?

@Yash-g17
Copy link

@abarsha Yeah sure , but I'm not sure if this task requires two people , @enterprisey can you please guide us on this

@paul-111
Copy link

@Yash-g17 well even if this task needs one person other one can have experience and learn things which all we need. I guess it will beneficial for both of us

@enterprisey
Copy link
Contributor

yeah, two people will be fine. there are many ways it can be split up. one way we can split it up is one person does the user interface (the message "this user is blocked", and it should also show the block reason), and the other person does the API call. If that sounds good let me know. there are other ways it can be split up, too. we can coordinate on Zulip if you both would like.

@enterprisey
Copy link
Contributor

yeah. for this PR you will add a new function checkIsSubmitterBlocked() inside getSubmissionWarnings(), which is in src/modules.submissions.js.
@paul-111 you can start with figuring out which API call you would need to check if a particular user is blocked. for now you can start with the URL (i.e. https://en.wikipedia.org/w/api.php?some=stuff&goes=here). once you get that, try writing the JS to perform the API call and pull out the data we're interested in. examples are all throughout src/modules/submission.js, but try looking at the one at the top of checkDeletionLog().
@Yash-g17 read through the function getSubmissionWarnings and try to figure out how we would write that new function checkIsSubmitterBlocked, following the example of the other four functions already defined there (checkReferences, checkDeletionLog, checkReviewState, checkLongComments). assume you'll already have the data from the API, in particular, four strings: the reason for the block, when they were blocked (in the format "2014-10-08T03:21:32Z"), when the block expires (either "infinity" or a timestamp like for when they were blocked), and the other user who blocked them.

@paul-111
Copy link

@enterprisey hey is there any deadline?

@enterprisey
Copy link
Contributor

Nope :)

@Yash-g17
Copy link

@enterprisey I'm done with my part

@enterprisey
Copy link
Contributor

@Yash-g17 cool. Can you post your code in this discussion if it's not too long? paul-111 also finished their part and I've asked them to post it here as well. You all are making great progress.

@Yash-g17
Copy link

@enterprisey I'm sorry i was away for a while , anyways here's the code
function checkIsSubmitterBlocked() { currentTime = new Date().toJSON(); if (expireTime == "infinity" || expireTime > currentTime) { addWarning( "This User is Blocked by " + userWhoBlocked +"on :"+ blockTime + " Till :" + expireTime + ". Reason : " + reason, ); } }

@paul-111
Copy link

paul-111 commented Aug 25, 2021

hey @Yash-g17 if i merge both of our code does this look okey?

function checkIfSubmitterIsBlocked(userName){

var deffered = $.Deffered();
AFCH.api.get( {
    'action': 'query',
    'list': 'user',
    'usprop': 'blockinfo',
    'ususers': userName
} ).then( function( data ) {

	currentTime = new Date().toJSON(); 

if (expireTime == "infinity" || expireTime > currentTime) {
 addWarning( "This User is Blocked by " + userWhoBlocked +"on :"+ blockTime + " Till :" + expireTime + ". Reason : " + reason, );
  } 

} ).catch( function ( error ) {
	 console.log('abort' + error );
   
} )

}```

@Yash-g17
Copy link

I think we should wait for @enterprisey for their opinion

@paul-111
Copy link

yup okey

@enterprisey
Copy link
Contributor

Yes, that looks pretty good! Try testing the code. I have prepared https://test.wikipedia.org/wiki/Draft:AFCH_Issue_106, which is a draft created by a blocked user. If you put the checkIfSubmitterIsBlocked function above into the script, and also add checkIfSubmitterIsBlocked to the list in $.when at the end of getSubmissionWarnings, the new warning should show up. If it works, that's cool; if it doesn't work, try to see if you can figure out why.

@DawnArchi01
Copy link

hey ! I see no assignees to this project . I would love to contribute to the project . Since I'm quite new here , it would be really helpful if you can guide whenever necessary . @enterprisey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancement E-good-first-issue Experience needed: zero (good first issue)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants