Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/datewindow-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgliss authored Nov 28, 2023
2 parents 86c6547 + 1a99d5d commit c1e97d4
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 100 deletions.
6 changes: 3 additions & 3 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aiocache==0.12.2
# via -r requirements-base.in
aiofiles==23.2.1
# via -r requirements-base.in
aiohttp==3.9.0
aiohttp==3.9.1
# via -r requirements-base.in
aiosignal==1.3.1
# via aiohttp
Expand Down Expand Up @@ -381,7 +381,7 @@ scipy==1.11.2
# via statsmodels
sentry-asgi==0.2.0
# via -r requirements-base.in
sentry-sdk==1.37.0
sentry-sdk==1.37.1
# via
# -r requirements-base.in
# sentry-asgi
Expand All @@ -401,7 +401,7 @@ six==1.16.0
# python-dateutil
# sqlalchemy-filters
# validators
slack-bolt==1.18.0
slack-bolt==1.18.1
# via -r requirements-base.in
slack-sdk==3.26.0
# via
Expand Down
6 changes: 6 additions & 0 deletions src/dispatch/evergreen/scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def create_evergreen_reminder(
db_session: SessionLocal, project: Project, owner_email: str, resource_groups: Any
):
"""Contains the logic for evergreen reminders."""
if not owner_email:
log.warning(
"Evergreen reminder not sent. No owner email. Project: {project.name}. Organization: {project.organization.name}"
)
return

plugin = plugin_service.get_active_instance(
db_session=db_session, plugin_type="email", project_id=project.id
)
Expand Down
1 change: 1 addition & 0 deletions src/dispatch/plugins/dispatch_slack/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ class SlackAPIErrorCode(DispatchEnum):
USERS_NOT_FOUND = "users_not_found"
VIEW_NOT_FOUND = "not_found" # Could not find corresponding view for the provided view_id
VIEW_EXPIRED = "expired_trigger_id" # The provided trigger_id is no longer valid
IS_ARCHIVED = "is_archived" # Channel is archived
49 changes: 30 additions & 19 deletions src/dispatch/plugins/dispatch_slack/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
unarchive_conversation,
update_message,
)
from slack_sdk.errors import SlackApiError
from .enums import SlackAPIErrorCode

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -162,26 +164,35 @@ def send(
**kwargs,
):
"""Sends a new message based on data and type."""
client = create_slack_client(self.configuration)
messages = []
if not blocks:
blocks = create_message_blocks(message_template, notification_type, items, **kwargs)

for c in chunks(blocks, 50):
messages.append(
send_message(
client,
conversation_id,
text,
ts,
Message(blocks=c).build()["blocks"],
persist,
try:
client = create_slack_client(self.configuration)
messages = []
if not blocks:
blocks = create_message_blocks(message_template, notification_type, items, **kwargs)

for c in chunks(blocks, 50):
messages.append(
send_message(
client,
conversation_id,
text,
ts,
Message(blocks=c).build()["blocks"],
persist,
)
)
)
else:
for c in chunks(blocks, 50):
messages.append(send_message(client, conversation_id, text, ts, c, persist))
return messages
else:
for c in chunks(blocks, 50):
messages.append(send_message(client, conversation_id, text, ts, c, persist))
return messages
except SlackApiError as exception:
error = exception.response["error"]
if error == SlackAPIErrorCode.IS_ARCHIVED:
# swallow send errors if the channel is archived
message = f"SlackAPIError trying to send: {exception.response}. Message: {text}. Type: {notification_type}"
logger.error(message)
else:
raise exception

def send_direct(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/dispatch/signal/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def signal_instance_create_flow(
db_session=db_session,
signal_instance=signal_instance,
):
# If the signal was deduplicated, we can assume a case exists,
# and we need to update the corresponding signal message
if _should_update_signal_message(signal_instance):
# If a case exists and the signal was deduplicated,
# we need to update the corresponding signal message
if signal_instance.case_id and _should_update_signal_message(signal_instance):
update_signal_message(
db_session=db_session,
signal_instance=signal_instance,
Expand Down
138 changes: 69 additions & 69 deletions src/dispatch/static/dispatch/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/dispatch/static/dispatch/src/components/AppToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@
<v-spacer />
<v-toolbar-items>
<v-btn icon variant="text" @click="toggleDarkTheme">
<v-icon
:icon="
$vuetify.theme.current.dark ? 'mdi-white-balance-sunny' : 'mdi-moon-waxing-crescent'
"
/>
<v-icon :icon="dark_theme ? 'mdi-white-balance-sunny' : 'mdi-moon-waxing-crescent'" />
<v-tooltip activator="parent" location="bottom">
Dark Mode {{ $vuetify.theme.current.dark ? "Off" : "On" }}
Dark Mode {{ dark_theme ? "Off" : "On" }}
</v-tooltip>
</v-btn>
<v-btn icon variant="text">
Expand Down Expand Up @@ -158,6 +154,7 @@ export default {
data: () => ({
organizations: [],
query: "",
dark_theme: false,
}),
setup() {
return { formatHash }
Expand Down Expand Up @@ -205,6 +202,7 @@ export default {
toggleDarkTheme() {
this.$vuetify.theme.global.name = this.$vuetify.theme.global.current.dark ? "light" : "dark"
localStorage.setItem("dark_theme", this.$vuetify.theme.global.current.dark.toString())
this.dark_theme = !this.dark_theme
},
switchOrganizations(slug) {
this.$router.push({ params: { organization: slug } }).then(() => {
Expand Down Expand Up @@ -233,8 +231,12 @@ export default {
let theme = localStorage.getItem("dark_theme")
if (theme) {
if (theme === "true") {
this.dark_theme = true
if (this.$vuetify.theme.global) this.$vuetify.theme.global.name = "dark"
this.$vuetify.theme.dark = true
} else {
this.dark_theme = false
if (this.$vuetify.theme.global) this.$vuetify.theme.global.name = "light"
this.$vuetify.theme.dark = false
}
}
Expand Down

0 comments on commit c1e97d4

Please sign in to comment.