-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into new/…
…default-favorite-channels * 'develop' of github.com:RocketChat/Rocket.Chat: (27 commits) [FIX] Missing edited icon in newly created messages (#16484) Regression: allow private channels to hide system messages (#16483) Regression: Fix uikit modal closing on click (#16475) Regression: Fix undefined presence after reconnect (#16477) [FIX] Read Message after receive a message and the room is opened (#16473) [FIX] Send message with pending messages (#16474) Fix tests (#16469) Bump version to 3.0.0-develop [NEW] Button to download admin server info (#16059) Revert importer streamed uploads (#16465) [NEW] UiKit - Interactive UI elements for Rocket.Chat Apps (#16048) [FIX] Result of get avatar from url can be null (#16123) [IMPROVE] Request user presence on demand (#16348) [IMPROVE] Major overhaul on data importers (#16279) [BREAK] Filter System messages per room (#16369) Regression: Fix app user status change for non-existing user (#16458) [FIX] `stdout` streamer infinite loop (#16452) Regression: Fix sending a message not scrolling to bottom (#16451) LingoHub based on develop (#16450) [IMPROVE] Changes App user's status when the app was enabled/disabled (#16392) ...
- Loading branch information
Showing
164 changed files
with
14,119 additions
and
13,921 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,30 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
import { hasPermission } from '../../../authorization'; | ||
import { Statistics } from '../../../models'; | ||
import { API } from '../api'; | ||
import { getStatistics, getLastStatistics } from '../../../statistics/server'; | ||
|
||
API.v1.addRoute('statistics', { authRequired: true }, { | ||
get() { | ||
let refresh = false; | ||
if (typeof this.queryParams.refresh !== 'undefined' && this.queryParams.refresh === 'true') { | ||
refresh = true; | ||
} | ||
|
||
let stats; | ||
Meteor.runAsUser(this.userId, () => { | ||
stats = Meteor.call('getStatistics', refresh); | ||
}); | ||
|
||
return API.v1.success({ | ||
statistics: stats, | ||
}); | ||
const { refresh } = this.requestParams(); | ||
return API.v1.success(Promise.await(getLastStatistics({ | ||
userId: this.userId, | ||
refresh: refresh && refresh === 'true', | ||
}))); | ||
}, | ||
}); | ||
|
||
API.v1.addRoute('statistics.list', { authRequired: true }, { | ||
get() { | ||
if (!hasPermission(this.userId, 'view-statistics')) { | ||
return API.v1.unauthorized(); | ||
} | ||
|
||
const { offset, count } = this.getPaginationItems(); | ||
const { sort, fields, query } = this.parseJsonQuery(); | ||
|
||
const statistics = Statistics.find(query, { | ||
sort: sort || { name: 1 }, | ||
skip: offset, | ||
limit: count, | ||
fields, | ||
}).fetch(); | ||
|
||
return API.v1.success({ | ||
statistics, | ||
count: statistics.length, | ||
offset, | ||
total: Statistics.find(query).count(), | ||
}); | ||
return API.v1.success(Promise.await(getStatistics({ | ||
userId: this.userId, | ||
query, | ||
pagination: { | ||
offset, | ||
count, | ||
sort, | ||
fields, | ||
}, | ||
}))); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.