mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Removed OAuth leftover: emit event when calling /users/me (#9061)
refs #8342
- was added in this commit 319a388277
- we can remove this event
This commit is contained in:
parent
3002747b68
commit
baf8116d6b
@ -7,7 +7,6 @@ var Promise = require('bluebird'),
|
|||||||
canThis = require('../permissions').canThis,
|
canThis = require('../permissions').canThis,
|
||||||
models = require('../models'),
|
models = require('../models'),
|
||||||
errors = require('../errors'),
|
errors = require('../errors'),
|
||||||
events = require('../events'),
|
|
||||||
i18n = require('../i18n'),
|
i18n = require('../i18n'),
|
||||||
docName = 'users',
|
docName = 'users',
|
||||||
// TODO: implement created_by, updated_by
|
// TODO: implement created_by, updated_by
|
||||||
@ -60,11 +59,10 @@ users = {
|
|||||||
*/
|
*/
|
||||||
read: function read(options) {
|
read: function read(options) {
|
||||||
var attrs = ['id', 'slug', 'status', 'email', 'role'],
|
var attrs = ['id', 'slug', 'status', 'email', 'role'],
|
||||||
tasks,
|
tasks;
|
||||||
isMe = options.id === 'me';
|
|
||||||
|
|
||||||
// Special handling for /users/me request
|
// Special handling for /users/me request
|
||||||
if (isMe && options.context && options.context.user) {
|
if (options.id === 'me' && options.context && options.context.user) {
|
||||||
options.id = options.context.user;
|
options.id = options.context.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +87,6 @@ users = {
|
|||||||
// Pipeline calls each task passing the result of one to be the arguments for the next
|
// Pipeline calls each task passing the result of one to be the arguments for the next
|
||||||
return pipeline(tasks, options).then(function formatResponse(result) {
|
return pipeline(tasks, options).then(function formatResponse(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
if (isMe) {
|
|
||||||
events.emit('read:users:me', result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {users: [result.toJSON(options)]};
|
return {users: [result.toJSON(options)]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user