Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
20666126
Commit
20666126
authored
8 years ago
by
graywolf336
Browse files
Options
Downloads
Patches
Plain Diff
Ignore the __MACOSX folders in the importers
parent
2a6969ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/rocketchat-importer-hipchat/server.coffee
+3
-0
3 additions, 0 deletions
packages/rocketchat-importer-hipchat/server.coffee
packages/rocketchat-importer-slack/server.coffee
+16
-8
16 additions, 8 deletions
packages/rocketchat-importer-slack/server.coffee
with
19 additions
and
8 deletions
packages/rocketchat-importer-hipchat/server.coffee
+
3
−
0
View file @
20666126
...
...
@@ -19,6 +19,9 @@ Importer.HipChat = class Importer.HipChat extends Importer.Base
tempMessages
=
{}
for
entry
in
zipEntries
do
(
entry
)
=>
if
entry
.
entryName
.
indexOf
(
'__MACOSX'
)
>
-
1
#ignore all of the files inside of __MACOSX
console
.
log
(
"Ignoring the file:
#{
entry
.
entryName
}
"
)
if
not
entry
.
isDirectory
if
entry
.
entryName
.
indexOf
(
Importer
.
HipChat
.
RoomPrefix
)
>
-
1
roomName
=
entry
.
entryName
.
split
(
Importer
.
HipChat
.
RoomPrefix
)[
1
]
...
...
This diff is collapsed.
Click to expand it.
packages/rocketchat-importer-slack/server.coffee
+
16
−
8
View file @
20666126
...
...
@@ -17,7 +17,10 @@ Importer.Slack = class Importer.Slack extends Importer.Base
tempMessages
=
{}
for
entry
in
zipEntries
do
(
entry
)
=>
if
entry
.
entryName
==
'channels.json'
if
entry
.
entryName
.
indexOf
(
'__MACOSX'
)
>
-
1
#ignore all of the files inside of __MACOSX
console
.
log
(
"Ignoring the file:
#{
entry
.
entryName
}
"
)
else
if
entry
.
entryName
==
'channels.json'
@
updateProgress
Importer
.
ProgressStep
.
PREPARING_CHANNELS
tempChannels
=
JSON
.
parse
entry
.
getData
().
toString
()
else
if
entry
.
entryName
==
'users.json'
...
...
@@ -75,6 +78,7 @@ Importer.Slack = class Importer.Slack extends Importer.Base
@
addCountToTotal
messagesCount
if
tempUsers
.
length
is
0
or
tempChannels
.
length
is
0
or
messagesCount
is
0
console
.
log
"The loaded users count
#{
tempUsers
.
length
}
, the loaded channels
#{
tempChannels
.
length
}
, and the loaded messages
#{
messagesCount
}
"
@
updateProgress
Importer
.
ProgressStep
.
ERROR
return
@
getProgress
()
...
...
@@ -234,13 +238,17 @@ Importer.Slack = class Importer.Slack extends Importer.Base
else
if
message
.
subtype
is
'channel_topic'
RocketChat
.
models
.
Messages
.
createRoomSettingsChangedWithTypeRoomIdMessageAndUser
'room_changed_topic'
,
room
.
_id
,
message
.
topic
,
@
getRocketUser
(
message
.
user
),
{
ts
:
new
Date
(
parseInt
(
message
.
ts
.
split
(
'.'
)[
0
])
*
1000
)
}
else
if
message
.
subtype
is
'pinned_item'
RocketChat
.
models
.
Messages
.
createWithTypeRoomIdMessageAndUser
'message_pinned'
,
room
.
_id
,
''
,
@
getRocketUser
(
message
.
user
),
ts
:
new
Date
(
parseInt
(
message
.
ts
.
split
(
'.'
)[
0
])
*
1000
)
attachments
:
[
"text"
:
@
convertSlackMessageToRocketChat
message
.
attachments
[
0
].
text
"author_name"
:
message
.
attachments
[
0
].
author_subname
"author_icon"
:
getAvatarUrlFromUsername
(
message
.
attachments
[
0
].
author_subname
)
]
if
message
.
attachments
RocketChat
.
models
.
Messages
.
createWithTypeRoomIdMessageAndUser
'message_pinned'
,
room
.
_id
,
''
,
@
getRocketUser
(
message
.
user
),
ts
:
new
Date
(
parseInt
(
message
.
ts
.
split
(
'.'
)[
0
])
*
1000
)
attachments
:
[
"text"
:
@
convertSlackMessageToRocketChat
message
.
attachments
[
0
].
text
"author_name"
:
message
.
attachments
[
0
].
author_subname
"author_icon"
:
getAvatarUrlFromUsername
(
message
.
attachments
[
0
].
author_subname
)
]
else
RocketChat
.
models
.
Messages
.
createWithTypeRoomIdMessageAndUser
'message_pinned'
,
room
.
_id
,
''
,
@
getRocketUser
(
message
.
user
),
ts
:
new
Date
(
parseInt
(
message
.
ts
.
split
(
'.'
)[
0
])
*
1000
)
else
if
message
.
subtype
is
'file_share'
if
message
.
file
?
.
url_private_download
isnt
undefined
details
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment