Skip to content
Snippets Groups Projects
Unverified Commit 0217998c authored by graywolf336's avatar graywolf336
Browse files

Start work on the channel history rest api

parent 12f24dc7
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ rocketchat:api
rocketchat:assets
rocketchat:authorization
rocketchat:autolinker
rocketchat:cas
#rocketchat:cas
rocketchat:channel-settings
rocketchat:channel-settings-mail-messages
rocketchat:colors
......@@ -67,7 +67,7 @@ rocketchat:integrations
rocketchat:katex
rocketchat:ldap
rocketchat:lib
rocketchat:livechat
#rocketchat:livechat
rocketchat:logger
rocketchat:mailer
rocketchat:mapview
......
......@@ -130,7 +130,6 @@ rocketchat:api@0.0.1
rocketchat:assets@0.0.1
rocketchat:authorization@0.0.1
rocketchat:autolinker@0.0.1
rocketchat:cas@1.0.0
rocketchat:channel-settings@0.0.1
rocketchat:channel-settings-mail-messages@0.0.1
rocketchat:colors@0.0.1
......@@ -157,7 +156,6 @@ rocketchat:katex@0.0.1
rocketchat:ldap@0.0.1
rocketchat:ldapjs@1.0.0
rocketchat:lib@0.0.1
rocketchat:livechat@0.0.1
rocketchat:logger@0.0.1
rocketchat:mailer@0.0.1
rocketchat:mapview@0.0.1
......@@ -191,7 +189,6 @@ rocketchat:slashcommands-open@0.0.1
rocketchat:slashcommands-topic@0.0.1
rocketchat:slashcommands-unarchive@0.0.1
rocketchat:smarsh-connector@0.0.1
rocketchat:sms@0.0.1
rocketchat:spotify@0.0.1
rocketchat:statistics@0.0.1
rocketchat:streamer@0.5.0
......
......@@ -105,6 +105,39 @@ RocketChat.API.v1.addRoute 'channels.create', authRequired: true,
return RocketChat.API.v1.success
channel: RocketChat.models.Rooms.findOneById(id.rid)
RocketChat.API.v1.addRoute 'channels.history', authRequired: true,
post: ->
if not @bodyParams.roomId?
return RocketChat.API.v1.failure 'Body parameter "roomId" is required.'
latestDate = new Date
if @bodyParams.latest?
latestDate = new Date(@bodyParams.latest)
oldestDate = undefined
if @bodyParams.oldest?
oldestDate = new Date(@bodyParams.oldest)
inclusive = false
if @bodyParams.inclusive?
inclusive = @bodyParams.inclusive
count = 20
if @bodyParams.count?
count = parseInt @bodyParams.count
unreads = false
if @bodyParams.unreads?
unreads = @bodyParams.unreads
result = {}
Meteor.runAsUser this.userId, =>
result = Meteor.call 'getChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive, count, unreads
return RocketChat.API.v1.success
result: result
# List Private Groups a user has access to
RocketChat.API.v1.addRoute 'groups.list', authRequired: true,
get: ->
......
......@@ -418,6 +418,7 @@
"error-invalid-channel-start-with-chars" : "Invalid channel. Start with @ or #",
"error-invalid-custom-field" : "Invalid custom field",
"error-invalid-custom-field-name" : "Invalid custom field name. Use only letters, numbers, hyphens and underscores.",
"error-invalid-date": "Invalid date provided.",
"error-invalid-description" : "Invalid description",
"error-invalid-domain" : "Invalid domain",
"error-invalid-email" : "Invalid email __email__",
......
......@@ -132,7 +132,7 @@ Importer.Slack = class Importer.Slack extends Importer.Base
url = user.profile.image_original
else if user.profile.image_512
url = user.profile.image_512
Meteor.call 'setAvatarFromService', url, null, 'url'
Meteor.call 'setAvatarFromService', url, undefined, 'url'
# Slack's is -18000 which translates to Rocket.Chat's after dividing by 3600
if user.tz_offset
Meteor.call 'userSetUtcOffset', user.tz_offset / 3600
......
......@@ -131,6 +131,7 @@ Package.onUse(function(api) {
api.addFiles('server/methods/updateMessage.coffee', 'server');
api.addFiles('server/methods/filterBadWords.js', ['server']);
api.addFiles('server/methods/filterATAllTag.js', 'server');
api.addFiles('server/methods/getChannelHistory.js', 'server');
// SERVER STARTUP
api.addFiles('server/startup/settingsOnLoadCdnPrefix.coffee', 'server');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment