Commit Graph

60 Commits

Author SHA1 Message Date
Ignas Kiela 03f8983945 Remove TicketSeen
Has a fair amount of complexity for not much gain.
2021-12-20 10:15:17 +01:00
Drew DeVault f89ad961ad Fix ticket mentions filter per SQLAlchemy changes 2021-10-18 10:32:05 +02:00
Ivan Habunek 87ff71d4af Store ticket comment counts in the database
This saves a query when rendering the tracker page, and allows sorting
by comment count which can be given as a sorting option.
2021-09-14 12:40:41 +02:00
Sol Fisher Romanoff 790f8e301b Make tracker names match [A-Za-z0-9._-]+
Fixes an issue where "_" could be used as a wildcard in tracker names.
Also prohibits use of '.git' and '.hg' as tracker names.
2021-08-11 09:41:12 +02:00
Drew DeVault e087f50a96 Fix extraneous "None" in ticket_comment email 2021-05-18 12:24:11 -04:00
Drew DeVault a78ae0fdd6 Replace pystache with string.Template 2021-05-16 16:14:59 -04:00
Drew DeVault e4794677e2 Fix notifications for newly subscribed user 2021-01-21 19:58:01 -05:00
Drew DeVault 5efd6ba260 Fix misc. exception sources 2021-01-21 19:49:09 -05:00
Drew DeVault 62767c27dd find_mentioned_users: use set 2021-01-07 13:42:07 -05:00
Drew DeVault 49f8555d0b Similar fix for find_mentioned_tickets 2021-01-07 12:53:25 -05:00
Drew DeVault 228455d27e find_mentioned_users: fix "none" description
This was causing exceptions when tickets were filled out without a body,
presumably following the core.sr.ht validation change.
2021-01-07 12:40:07 -05:00
наб bb5a0a8ccf Add option to notify users of their own web activity
Ref: ~sircmpwn/todo.sr.ht#94
2020-10-10 14:00:58 -04:00
Drew DeVault c144bfc9b1 Further fixes to Sender header syntax 2020-09-05 11:51:28 -04:00
Drew DeVault af41dfe29f Fix Sender email header syntax 2020-09-03 11:52:16 -04:00
Drew DeVault a197154771 Fix notification emails 2020-08-28 10:31:01 -04:00
наб f368e772f3 Don't create useless transitions between identical states and clean previous ones with migration
A FIXED -> FIXED transition happens, e.g., here:
  https://todo.sr.ht/~sircmpwn/meta.sr.ht/46#event-47525
because I fucked up a link and listed this one twice,
and Drew opened each link first, then closed them,
hence marking the ticket as FIXED twice

With this patch, we just do nothing if there's nothing to do
2020-08-26 09:34:30 -04:00
наб 2c881a696e Don't generate events for a ticket mentioning itself 2020-08-24 10:08:03 -04:00
наб a7bc3191ff Add List-Unsubscribe: mailto:{sub.ref}/unsubscribe to notifications 2020-07-22 13:19:57 -04:00
наб eec8eb5fa0 Fix e-mail ticket submission not notifying the submitter
To reproduce, the setup:
  * run todo.sr.ht-lmtp,
    listen on sock=127.0.0.1:2525,
    with posting-domain=todo.nabijaczleweli.xyz
  * register users:
    + ~nabijaczleweli  <nabijaczleweli/srht/test@nabijaczleweli.xyz>
    + ~nabijaczleweli2 <nabijaczleweli/srht/test2@nabijaczleweli.xyz>
  * create tracker "~nabijaczleweli/test", potentially unsubscribe
  * do not subscribe ~nabijaczleweli2 to that tracker

Now, run
-- >8 --
$ telnet 127.0.0.1 2525
ehlo owo
mail from:<nabijaczleweli/srht/test2@nabijaczleweli.xyz>
rcpt to:<~nabijaczleweli/test@todo.nabijaczleweli.xyz>
data
From: nabijaczleweli/srht/test2@nabijaczleweli.xyz
To: ~nabijaczleweli/test@todo.nabijaczleweli.xyz
Subject: Repro

This will not be delivered to nabijaczleweli2

.
quit
-- >8 --

If you didn't unsubscribe, ~nabijaczleweli will get the e-mail;
either way, ~nabijaczleweli2 won't receive it.
This goes against the intent of 6599be5371

This happens because in submit_ticket() tracker.subscriptions is either
empty or contains just ~nabijaczleweli; concatenating it with
ticket.subscriptions allows picking up the potential new sub created by
get_or_create_subscription().

With this patch, delivering that same mail will also notify
~nabijaczleweli2.

This fixes the problem described in
https://lists.sr.ht/~sircmpwn/sr.ht-dev/%3C20200714151756.gxmowmpohmtps76h@tarta.local.nabijaczleweli.xyz%3E
2020-07-20 08:43:04 -04:00
наб 8a3c9b63b9 Include an In-Reply-To: <Message-ID of triggering e-mail>, if any, in the new_ticket notification 2020-07-17 09:59:49 -04:00
Gabriel Augendre 6599be5371 Notify sender for tickets created by email.
Fix ticket ~sircmpwn/todo.sr.ht/180
2020-06-08 13:42:37 -04:00
Drew DeVault fe08cd4447 Implement ticket import 2020-01-09 12:19:44 -05:00
Denis Laxalde 23067adce5 Add In-Reply-To header to notification emails
We add a Message-ID header to the notification email about new ticket,
the value of ticket's mailing list is used. For other notifications, we
insert an In-Reply-To header with the same value. This implements "flat
replies" as described in https://todo.sr.ht/~sircmpwn/todo.sr.ht/97.

Closes https://todo.sr.ht/~sircmpwn/todo.sr.ht/97
2019-09-12 16:05:49 -04:00
Drew DeVault aff9a9417e Allow admins to create tickets from external users 2019-08-22 13:56:50 +09:00
Drew DeVault 204597dfb4 Accept email tickets/comments for anon users 2019-08-22 13:20:39 +09:00
Drew DeVault 846417baeb Fix use of by_user_id in assignment flow 2019-08-22 12:53:27 +09:00
Drew DeVault b4c92a39db Generalize users into participants 2019-08-22 11:05:25 +09:00
Michael Forney 86b8c8cc76 Allow ticket/user mentions after open paren
This will allow mentions like

	Depends on feature X (#123)
2019-05-23 15:13:36 -04:00
Ivan Habunek 8841a12b6e Detect ticket mentions by URL
fixes:
https://todo.sr.ht/~sircmpwn/todo.sr.ht/173
2019-05-21 10:25:07 -04:00
Drew DeVault d6986aed72 Add simple ticket API 2019-04-30 16:17:43 -04:00
Drew DeVault 060eea1c1a Add support for replying to tickets via email 2019-04-29 18:26:36 -04:00
Ivan Habunek 4fe0011f92 Implement mentions in ticket body 2019-04-04 14:10:34 -04:00
Ivan Habunek ff0504980f Alter Event fields and migrate data
Makes the following changes to the Event type:

* make `user` and `ticket` nullable since some events require it
* add `by_user` and `from_ticket` to enable mentions
* remove `assinged_user` which is no longer used

Ticket: https://todo.sr.ht/~sircmpwn/todo.sr.ht/156
2019-04-04 14:10:23 -04:00
Ivan Habunek a10b980692 Fix ticket mention pattern allowed characters
In addition to \w chars, tracker names can contain . and -, so add them
to the regex pattern.
2019-03-07 09:53:05 -07:00
Ivan Habunek 3af5a42b52 Fix incorrect user mention detection
Qualified ticket mentions which include a username, such as
~user/repo#123 should not be matched by the user mention regex pattern.
This caused the usernames in the ticket mentions to be linked.

Fixed by changing the user mention pattern to not match if the username
is followed by a slash.
2019-03-07 09:53:03 -07:00
Ivan Habunek 2db8c25c02 Support mentioning tickets on different trackers
fixes: ~sircmpwn/todo.sr.ht/157
2019-03-07 09:53:00 -07:00
Ivan Habunek cfb6701ce1 Slight simplification of code
The comment is never None in this case, it's checked before calling the
function.
2019-03-06 14:37:23 -07:00
Ivan Habunek 059faa8d73 Simplify ticket submission code 2019-03-06 14:37:17 -07:00
Ivan Habunek ee2e052e2a Extract ticket submission logic, add tests
No functional changes to ticket submission code.
2019-03-06 14:37:05 -07:00
Ivan Habunek 29f1b0aa13 Document the user mention pattern in code 2019-02-27 09:01:45 -05:00
Ivan Habunek d8a0e7ac0a Fix user mention regex not to match URLs
This was a problem since URLs oftern contain usernames.

fixes: https://todo.sr.ht/~sircmpwn/todo.sr.ht/162
2019-02-27 09:01:43 -05:00
Drew DeVault befde3f8f6 Fix exception on ticket resolution with no comment 2019-02-26 15:26:01 -05:00
Drew DeVault e65cbf8006 Improve notification emails 2019-02-25 20:41:48 -05:00
Ivan Habunek 179519ef5e Add events for user and ticket mentions 2019-02-25 20:00:52 -05:00
Ivan Habunek bc24ccbefe Link users and tickets mentioned in comments
NB: caching added in later commit
2019-02-25 20:00:43 -05:00
Ivan Habunek a6a9b0dfca Send notifications to users mentioned in comments 2019-02-25 20:00:40 -05:00
Ivan Habunek 9e051e71b7 Implement ticket.ref()
Returning the ticket reference string ~user/tracker#scoped_id.
2019-02-25 20:00:38 -05:00
Ivan Habunek be993d8a07 Add function for finding user mentions 2019-02-25 20:00:35 -05:00
Ivan Habunek e1824a287f Remove tilde hacks
No longer required, fixed in SrhtFlask.
2019-01-29 10:18:03 -05:00
Ivan Habunek 1bf2bb9090 Notify & subscribe user when assigned to ticket
ticket: https://todo.sr.ht/~sircmpwn/todo.sr.ht/141
2019-01-01 13:24:24 -05:00