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

Add user block api call #4301

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AntonKhorev
Copy link
Collaborator

This lets block users by id, which helps in case they frequently change their username.

lib/oauth.rb Outdated Show resolved Hide resolved
app/controllers/api/user_blocks_controller.rb Outdated Show resolved Hide resolved
test/controllers/api/user_blocks_controller_test.rb Outdated Show resolved Hide resolved
lib/oauth.rb Outdated Show resolved Hide resolved
test/controllers/api/user_blocks_controller_test.rb Outdated Show resolved Hide resolved
@AntonKhorev AntonKhorev force-pushed the blocks-api branch 5 times, most recently from d1e66e6 to f65029c Compare October 21, 2023 16:53
@AntonKhorev AntonKhorev requested a review from tomhughes October 21, 2023 16:59
@AntonKhorev AntonKhorev force-pushed the blocks-api branch 2 times, most recently from 083162b to 68ebbad Compare December 22, 2023 12:13
@mmd-osm mmd-osm added the api Related to the XML or JSON APIs label Jun 21, 2024
@AntonKhorev AntonKhorev added the moderation Related to moderator features, like reports, issues or user blocks label Jul 3, 2024
@AntonKhorev
Copy link
Collaborator Author

Updated to align with #5155.

@AntonKhorev AntonKhorev force-pushed the blocks-api branch 2 times, most recently from a7a96a1 to da15d99 Compare September 11, 2024 08:36
raise OSM::APIBadUserInput, "No period was given" unless params[:period]

period = Integer(params[:period], :exception => false)
raise OSM::APIBadUserInput, "Period should be a number of hours" unless period
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if the permitted values should be more in line with user_block_periods in settings.yml:

# Periods (in hours) which are allowed for user blocks
user_block_periods: [0, 1, 3, 6, 12, 24, 48, 96, 168, 336, 731, 4383, 8766, 87660]

Are values not explicitly mentioned there ok for the UI, or would they cause issues in dropdown lists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Block durations are not stored directly. Dropdowns show the closes value to the remaining time: #5011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the XML or JSON APIs moderation Related to moderator features, like reports, issues or user blocks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants