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
3f2463d5
Commit
3f2463d5
authored
9 years ago
by
graywolf336
Browse files
Options
Downloads
Patches
Plain Diff
Combine the first two checks into one to make it more readable
parent
255fab1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-message-pin/client/actionButton.coffee
+6
-9
6 additions, 9 deletions
packages/rocketchat-message-pin/client/actionButton.coffee
with
6 additions
and
9 deletions
packages/rocketchat-message-pin/client/actionButton.coffee
+
6
−
9
View file @
3f2463d5
...
...
@@ -5,14 +5,12 @@ Meteor.startup ->
i18nLabel
:
'Pin_Message'
action
:
(
event
,
instance
)
->
message
=
@
_arguments
[
1
]
message
.
pinned
=
true
Meteor
.
call
'pinMessage'
,
message
,
(
error
,
result
)
->
if
error
return
Errors
.
throw
error
.
reason
validation
:
(
message
)
->
if
message
.
pinned
return
false
if
!
RocketChat
.
settings
.
get
(
'Message_AllowPinning'
)
if
message
.
pinned
or
not
RocketChat
.
settings
.
get
(
'Message_AllowPinning'
)
return
false
if
RocketChat
.
settings
.
get
(
'Message_AllowPinningByAnyone'
)
or
RocketChat
.
authz
.
hasRole
Meteor
.
userId
(),
'admin'
...
...
@@ -27,18 +25,17 @@ Meteor.startup ->
i18nLabel
:
'Unpin_Message'
action
:
(
event
,
instance
)
->
message
=
@
_arguments
[
1
]
message
.
pinned
=
false
Meteor
.
call
'unpinMessage'
,
message
,
(
error
,
result
)
->
if
error
return
Errors
.
throw
error
.
reason
validation
:
(
message
)
->
if
not
message
.
pinned
return
false
if
!
RocketChat
.
settings
.
get
(
'Message_AllowPinning'
)
if
not
message
.
pinned
or
not
RocketChat
.
settings
.
get
(
'Message_AllowPinning'
)
return
false
if
RocketChat
.
settings
.
get
(
'Message_AllowPinningByAnyone'
)
or
RocketChat
.
authz
.
hasRole
Meteor
.
userId
(),
'admin'
return
true
console
.
log
'UNpin-message'
,
'---- is user the room owner'
,
room
.
u
?
.
_id
is
Meteor
.
userId
()
return
room
.
u
?
.
_id
is
Meteor
.
userId
()
order
:
2
0
order
:
2
1
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