Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
ots
hypha
Commits
c5dd8cec
Commit
c5dd8cec
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Make sure we can configure the room and URL in production
parent
a7dd884f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
opentech/apply/activity/messaging.py
+4
-3
4 additions, 3 deletions
opentech/apply/activity/messaging.py
opentech/settings/base.py
+5
-2
5 additions, 2 deletions
opentech/settings/base.py
opentech/settings/production.py
+0
-5
0 additions, 5 deletions
opentech/settings/production.py
with
9 additions
and
10 deletions
opentech/apply/activity/messaging.py
+
4
−
3
View file @
c5dd8cec
...
...
@@ -106,7 +106,8 @@ class SlackAdapter(AdapterBase):
def
__init__
(
self
):
super
().
__init__
()
self
.
destination
=
settings
.
SLACK_DESTINATION
self
.
destination
=
settings
.
SLACK_DESTINATION_URL
self
.
target_room
=
settings
.
SLACK_DESTINATION_ROOM
def
message
(
self
,
message_type
,
**
kwargs
):
user
=
kwargs
[
'
user
'
]
...
...
@@ -128,11 +129,11 @@ class SlackAdapter(AdapterBase):
return
f
'
<
{
user
.
slack
}
>
'
def
send_message
(
self
,
message
,
**
kwargs
):
if
not
self
.
destination
:
if
not
self
.
destination
and
not
self
.
target_room
:
return
data
=
{
"
room
"
:
"
CBQUCH458
"
,
"
room
"
:
self
.
target_room
,
"
message
"
:
message
,
}
requests
.
post
(
self
.
destination
,
data
=
data
)
...
...
This diff is collapsed.
Click to expand it.
opentech/settings/base.py
+
5
−
2
View file @
c5dd8cec
...
...
@@ -5,6 +5,8 @@ Django settings for opentech project.
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import
os
env
=
os
.
environ
.
copy
()
PROJECT_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
BASE_DIR
=
os
.
path
.
dirname
(
PROJECT_DIR
)
...
...
@@ -351,5 +353,6 @@ HIJACK_DECORATOR = 'opentech.apply.users.decorators.superuser_decorator'
# Messaging Settings
SEND_MESSAGES
=
False
SLACK_DESTINATION
=
None
SEND_MESSAGES
=
env
.
get
(
'
SEND_MESSAGES
'
,
'
false
'
).
lower
()
==
'
true
'
SLACK_DESTINATION_URL
=
env
.
get
(
'
SLACK_DESTINATION_URL
'
,
None
)
SLACK_DESTINATION_ROOM
=
env
.
get
(
'
SLACK_DESTINATION_ROOM
'
,
None
)
This diff is collapsed.
Click to expand it.
opentech/settings/production.py
+
0
−
5
View file @
c5dd8cec
...
...
@@ -144,11 +144,6 @@ if 'LOG_DIR' in env:
LOGGING
[
'
loggers
'
][
'
django.security
'
][
'
handlers
'
].
append
(
'
errors_file
'
)
# Messaging Settings
SEND_MESSAGES
=
env
.
get
(
'
SEND_MESSAGES
'
,
'
false
'
).
lower
()
==
'
true
'
SLACK_DESTINATION
=
env
.
get
(
'
SLACK_DESTINATION
'
,
None
)
try
:
from
.local
import
*
# noqa
except
ImportError
:
...
...
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