Skip to content

Commit

Permalink
[BREAK] Remove REST endpoint /api/v1/info (#15197)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored Aug 19, 2019
1 parent f971ce6 commit 9632cb7
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions app/api/server/v1/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,12 @@ import { check } from 'meteor/check';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import s from 'underscore.string';

import { hasRole } from '../../../authorization';
import { Info } from '../../../utils';
import { Users } from '../../../models';
import { settings } from '../../../settings';
import { Users } from '../../../models/server';
import { settings } from '../../../settings/server';
import { API } from '../api';
import { getDefaultUserFields } from '../../../utils/server/functions/getDefaultUserFields';
import { getURL } from '../../../utils/lib/getURL';


// DEPRECATED
// Will be removed after v1.12.0
API.v1.addRoute('info', { authRequired: false }, {
get() {
const warningMessage = 'The endpoint "/v1/info" is deprecated and will be removed after version v1.12.0';
console.warn(warningMessage);
const user = this.getLoggedInUser();

if (user && hasRole(user._id, 'admin')) {
return API.v1.success(this.deprecationWarning({
endpoint: 'info',
versionWillBeRemoved: '1.12.0',
response: {
info: Info,
},
}));
}

return API.v1.success(this.deprecationWarning({
endpoint: 'info',
versionWillBeRemoved: '1.12.0',
response: {
info: {
version: Info.version,
},
},
}));
},
});

API.v1.addRoute('me', { authRequired: true }, {
get() {
return API.v1.success(this.getUserInfo(Users.findOneById(this.userId, { fields: getDefaultUserFields() })));
Expand Down

0 comments on commit 9632cb7

Please sign in to comment.