* Rename tags to team tags
* Add a TagType enum with TEAM and QUESTION options
* Ticket#questionTag exists now
* Revert "Add a TagType enum with TEAM and QUESTION options"
This reverts commit c9a17f4003aa2ce470f82810ac031fe83325f3d6.
* Add a new QuestionTag model
* Add another dropdown to the backend msg
* create tag => create team tag
* Add creating tags (from the backend channel)
* Create a single function for sending the backend message
Previously this code was duplicated across 2 places, making it inconsistent
* Rename a bunch of files; implement upating question tags on tickets
* Add a log!
* Fix ticket tag dropdowns in old msgs
* Auto-select the current question tag when a backend msg is posted
* Update backend message with the current tag
* Allow clearing the question tag
* Dynamically get question tag list
* Document question tags
* typo
* Change some log msgs to debug
* Only make the DB call if current_question_tag_id is present
* Remove unused variable
* Add createdAt to QuestionTag
* Ensure "reopened by [user]" is preserved when backend message is edited
* Add a ?dailystats macro for dev
* Get rid of all the overall stats in the daily summary
* Make the daily summary pie dark themed
* Write a module for unified stats calculation
* Use the stats module for the App Home leaderboards
* Ensure datetime types are tz-aware
* Use the stats module for the daily stats message
* Use the stats module for the stats API
* Implement get_unanswered_tickets()
* Add some functions for getting message links
* Format?
* Add old tickets to the daily stats message
* Remove unused import
* Fix calculation for new_tickets_in_progress
* fix typo
* Use correct stat for daily summary
* Show an error message if the views_publish call fails
This means that if our Block Kit has a syntax error and Slack API returns en error for it, a fallback screen is shown instead of indefinite loading
* Include nav buttons in the header
* Fix header formatting error
I think this was a GH Copilot hallucination that I accepted bc it looked very similar to the OG code :(
* Show header on the loading screen
* Make clicking on a button during the loading phase work
* Delete views/home/apps.py
I don't think this view is used anywhere
* Use the new header style everywhere
* Remove buttons.py (no longer used)
* Show "dashboard" tab as selected during first load
This means that the "default" virtual view name no longer exists, but we have a DEFAULT_VIEW constant now
* Add at least some sort of return type to get_header()
* Make the helper and assigned views non-helper-friendly
* Allow non-helpers to access the app home
* Remove useless `or` statement
* Extract error_screen to a component
* Gate the tags view to only helpers
* Make the tags view non-helper-friendly
* Make the stats view non-helper-friendly
* Make the error text a bit nicer
* Fix type error
* Make the infinite loading situation less likely
This could happen if you spam-clicked one of the buttons (I tested with assigned tickets). I think the problem existed before but was made worse by the new `user_last_requested_view` logic - now it's back to normal and the issue is very hard to recreate.
* Remove "unknown user" view and transcripts
* Remove commented code block
* Remove comment the second
* Fix timezone fetching and add more logs
* Allow specifying log level per-logger
* Add support for sending logs to an OpenTelemetry endpoint
* Consistently use parse_level_name() for LOG_LEVEL_* env vars
* Add lastMsgAt and lastMsgBy to DB
* Keep track of the last messages in threads
* Add UserType enum to schema
* Make both of the new fields optional
* Add data/ to .gitignore
* Only include users who have resolved tickets on the overall leaderboard
Fixes#96
* Fix docstring
* Attempts at getting macro aliases to work
* Store instances of macros as well as just the classes
* Add ?unresolve and ?open aliases for ?reopen
* Add an error message for invalid macros
* Add ?close as an alias for ?resolve
* Add error message for running a macro on a closed ticket
* Allow ?thread to be run on closed tickets
* Add type annotation to macro list
* Add support for exporting code block times as histograms
* Adjust perf metrics
* Aff perf metrics for message processing and title gen
* Add metric for opening app home views
* Performance metrics are now defined individually
* Remove performance metric from slack.py
* New metrics for ticket title gen and app home rendering
* Prevent .labels({}) from happening
* Make import consistent
* Use transcripts for most macro message texts
* Write a get_user_name() util
* Remove Fraudpheus reference
* Use get_user_name() in shipcertqueue.py
* Always impersonate in reopen.py
See 182771acdfd8eca0410f8c012f24e7cd51a71925
* Add user PFP method to slack_user.py
* Handle the case of a username not being present
* Use get_user_profile() to get user PFPs when tickets are (re)opened
* Remove comment
* Fix type error in reopen.py
* Guard against ts being not present in reopen.py
* Ensure consistent handling of profile_pic_512x() being None
* Rewrite ticket title gen to use the new HC AI
* Use implicit string concatenation
* Use async OpenAI
* Guard against single-letter or all-whitespace AI responses
* Add a singular space
* Add a perf_timer() utility for timing blocks of code
It has replaced raw perf_counter() calls in some files.
* Use perf_timer in ticket_status_pie.py
* Use perf_timer() for app home performance logging
* Remove plt.show() call
That was never meant to be there :pf:
* Print performance logs as debug logs
* Extract some of the message handler into functions
* Add a send_user_facing_message function
* Improve type hints
* Remove redundant if statement check
* Remove unnecessary indentation
* Declare constant outside of function
* Add docstrings to 2 functions
Credit to GH Copilot :P
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix docstrings
* Add send_ticket_message docstring
* Fix profile_pic being set to "" instead of None
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add resolve_ticket_button to transcript
I also set "Mark as resolved" as the default wording for all instances
* Change button text back to "i get it now" for SoM and Identity
Backwards compatibility!
I think Midnight would be fine with the new default
* Add a bunch of performance logs to on_message
* Remove duplicate DB user lookup
* Ensure Slack user info is only fetched once
* Make AI title generation happen after the FAQ message has been sent
* Make the performance logging debug-level
* Fix some perf calculations being incorrect
* Add type hint
* Write v1 of the Flavortown transcript
* Remove summer reference from bot manifest
* Mrkdwn doesn't support bullet points, are we fr?
* Actually link help channel in resolve message
* Actually fix deleting messages in the backend channel
* Always impersonate in backend channel
- Yeah turns out deleting impersonated messages still works with a bot token
- Partially reverts #74
* Add required library libatomic1 to Dockerfile
* Add a dockerignore file
It used to take like 3 seconds to copy all the files into the Docker image because `.venv` was included.
That isn't needed because we `uv sync` within the container, so builds are slightly faster during development now.
* Update DB when unthreaded messages are deleted
* Add required library libatomic1 to Dockerfile (#71)
* Handle quick message deletions
This is a quick and dirty way to handle the bug, but it works.
I also realised that handle_question_deletion() doesn't delete it in #tickets
* Create a system for tracking bot messages attached to tickets
* Ensure resolved message is added to userFacingMsgs
TODO I''ll need to make a function that all the macros can use to send a user-facing message
* Add a reply_to_ticket() helper for updating the DB
while replying to a ticket
* Fix type errors in reply_to_ticket()
* Use reply_to_ticket when resolving tickets
* Fix type errors in message.py
* Create delete_replies_to_ticket()
* Remove unused parameter in delete_replies_to_ticket
* Rename BotMessage.msgTs to BotMessage.ts
* Write a stub delete_and_clean_up_ticket function
* Partially implement delete_and_clean_up_ticket
* Delete "ticket" message in delete_and_clean_up_ticket()
* Use the new ticket methods where appropriate
* Make function name clearer ("delete_bot_replies")
* Log if a question is deleted but not present in DB
* Fix error when normal messages are deleted
* Actually include userFacingMsgs in the query when deleting bot replies
* Add success heartbeat to delete queue
* Document the deletion queue needing workspace admin
* Don't use delete queue in ticket_methods.py
This is because the delete queue requires an admin token, ew
* Fix deleting the backend message on ticket deletion
* Always preserve support threads with >3 bot messages
This is so that if someone runs ?faq, the ticket still counts as being resolved in the DB.
* Debug-log message event data instead of printing
* Use the reply_to_ticket util in macros
---------
Co-authored-by: RandomSearch <101704343+RandomSearch18@users.noreply.github.com>
* Differentiate between message creation and deletion
* Add a comment to explain thread_broadcast
* If top-level message gets deleted, then delete bot messages
* Ensure top-level messages being deleted don't cause errors
It would previously freak out when the tombstone message gets deleted :P
* Remove deleted tickets from DB
* Actually delete the correct ticket
* Ensure unexpected SlackApiErrors are re-raised
* refactor: Move deleted message handling into its own file
* Add some logging for time spent generating the Dashboard
* Start adding perf logging to get_ticket_status_pie_chart
* Add more detailed logs to ticket_status_pie
* Use db.ticket.count() instead of fetching all tickets for pie chart
Querying the database used to take 0.25s avg, now the query takes 0.028s avg (tested with 20k records)
Generating pie chart used to take 1.3s, now it's 0.74s. That's a 43% speedup I think! Although the pie chart isn't the only thing that takes time to load on the dashboard.
* Remove status_counts dict
I think the code reads nicer without the extra dict. Now we just have each variable listed inline in a list, which matches how the labels and colours are defined.
* Downgrade profiling logs to DEBUG level
* Add a script for creating dummy DB records
* Note that add_dummy_data takes a while to run
* Change the dummy data range to 2 weeks
* Ensure the dummy data script sets all the timestamps
Previously it wouldn't set assignedAt, closedAt, etc, despite the ticket being marked as closed