text:
<?php
class WPCOM_JSON_API_List_Users_Endpoint extends WPCOM_JSON_API_Endpoint {

	var $response_format = array(
		'found'    => '(int) The total number of authors found that match the request (i
gnoring limits and offsets).',
		'users'  => '(array:author) Array of user objects',
	);

	// /sites/%s/users/ -> $blog_id
	function callback( $path = '', $blog_id = 0 ) {
		$blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) );
		if ( is_wp_error( $blog_id ) ) {
			return $blog_id;
		}

		$args = $this->query_args();

		$authors_only = ( ! empty( $args['authors_only'] ) );

		if ( $args['number'] < 1 ) {
			$args['number'] = 20;
		} elseif ( 100 < $args['number'] ) {
			return new WP_Error( 'invalid_number',  'The NUMBER parameter must be less than or equal to 100.', 400 );
		}

		if ( $authors_only ) {
			if ( empty( $args['type'] ) )
				$args['type'] = 'post';

			if ( ! $this->is_post_type_allowed( $args['type'] ) ) {
				return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );
			}

			$post_type_object = get_post_type_object( $args['type'] );
			if ( ! $post_type_object || ! current_user_can( $post_type_object->cap->edit_others_posts ) ) {
				return new WP_Error( 'unauthorized', 'User cannot view authors for specified post type', 403 );
			}
		} elseif ( ! current_user_can( 'list_users' ) ) {
			return new WP_Error( 'unauthorized', 'User cannot view users for specified site', 403 );
		}

		$query = array(
			'number'    => $args['number'],
			'offset'    => $args['offset'],
			'order'     => $args['order'],
			'orderby'   => $args['order_by'],
			'fields'    => 'ID',
		);

		if ( $authors_only )
			$query['who'] = 'authors';

		$user_query = new WP_User_Query( $query );

		$return = array();
		foreach ( array_keys( $this->response_format ) as $key ) {
			switch ( $key ) {
				case 'found' :
					$return[$key] = (int) $user_query->get_total();
					break;
				case 'users' :
					$users = array();
					foreach ( $user_query->get_results() as $u ) {
						$the_user = $this->get_author( $u, true );
						if ( $the_user && ! is_wp_error( $the_user ) ) {
							$users[] = $the_user;
						}
					}

					$return[$key] = $users;
					break;
			}
		}

		return $return;
	}
}


text:
[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.3.1...v1.4.0)

**Closed issues:**

- phraseapp-ruby locked to ~\> 1.2.7, current is 1.3.3 [\#19](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/19)

**Merged pull requests:**

- Ruby 3.0 support [\#49](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/49) ([sbruhns](https://github.com/sbruhns))
- remove all dynport.de references [\#47](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/47) ([tobstarr](https://github.com/tobstarr))
- Update license decisions [\#46](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/46) ([forelabs](https://github.com/forelabs))
- Tests: Upgrade to modern RSpec syntax [\#45](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/45) ([docstun](https://github.com/docstun))
- GitHub actions [\#44](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/44) ([docstun](https://github.com/docstun))
- Licenses: fix project name [\#43](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/43) ([forelabs](https://github.com/forelabs))
- Licenses: Ignore dev&test dependencies [\#42](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/42) ([forelabs](https://github.com/forelabs))
- Introduce LicenseFinder config [\#41](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/41) ([forelabs](https://github.com/forelabs))
- fix pa licenses [\#40](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/40) ([forelabs](https://github.com/forelabs))
- Add pa licenses yml [\#39](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/39) ([forelabs](https://github.com/forelabs))

## [v1.3.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.3.1) (2019-08-29)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.3.0...v1.3.1)

**Merged pull requests:**

- Update docs [\#38](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/38) ([timleers](https://github.com/timleers))
- Update documentation URLs [\#37](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/37) ([docstun](https://github.com/docstun))

## [v1.3.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.3.0) (2018-04-19)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.2.1...v1.3.0)

**Closed issues:**

- Using translation in data-x attributes replaces entire string. [\#33](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/33)

**Merged pull requests:**

- Set ruby 2.1 as minimum version [\#36](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/36) ([theSoenke](https://github.com/theSoenke))
- use RequestStore instead of Thread\[:current\] [\#32](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/32) ([zuchmanski](https://github.com/zuchmanski))

## [v1.2.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.2.1) (2017-03-13)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.2.0...v1.2.1)

**Closed issues:**

- Implicit Translations [\#17](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/17)

**Merged pull requests:**

- Fix simple form exception [\#22](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/22) ([docstun](https://github.com/docstun))
- Version update, Ruby 2.4.0 support because of json-dependency change  [\#20](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/20) ([fredv](https://github.com/fredv))

## [v1.2.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.2.0) (2017-02-24)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.1.0...v1.2.0)

**Merged pull requests:**

- Changes json dependency to json \>= 1.8 [\#18](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/18) ([fredv](https://github.com/fredv))

## [v1.1.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.1.0) (2016-10-04)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.2...v1.1.0)

**Closed issues:**

- rails\_admin json issue with phraseapp and rails\_admin-i18n [\#16](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/16)
- Per thread config [\#14](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/14)
- RuntimeError: not found? [\#12](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/12)
- Editor conflicts the angular router [\#9](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/9)
- Edit icons missing if the enabled false by default [\#8](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/8)
- Introduce a changelog [\#7](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/7)

**Merged pull requests:**

- Proper storage of config on Thread.current [\#15](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/15) ([docstun](https://github.com/docstun))
- disable dependency loading on before as fix for rails5 [\#13](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/13) ([koljaa](https://github.com/koljaa))
- Update LICENSE [\#11](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/11) ([sbruhns](https://github.com/sbruhns))
- i18n set to \>= 0.6 [\#10](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/10) ([jethroo](https://github.com/jethroo))

## [v1.0.2](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.0.2) (2015-10-12)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.1...v1.0.2)

**Closed issues:**

- Method missing error [\#5](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/5)

**Merged pull requests:**

- 18n delegate refactoring [\#6](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/6) ([koljaa](https://github.com/koljaa))

## [v1.0.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.0.1) (2015-10-07)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.0...v1.0.1)

**Closed issues:**

- Two translations in one HTML element [\#4](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/4)
- Why PhraseApp In-Context Editor can be enabled/disabled only for entire application? [\#3](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/3)
- Why Access Token is mandatory in configuration for In-Context Editor?  [\#2](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/2)
- Problems chaneging suffix and prefix [\#1](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/1)

## [v1.0.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.0.0) (2015-08-21)

[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/4a0e284a7acad8529eef882863b226858384b757...v1.0.0)

\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

redpajama_set_name: RedPajamaGithub