-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add offline messaging #8440
Add offline messaging #8440
Conversation
6704eb7
to
6922bf7
Compare
Since we retain PMs for moderation purposes anyway, is there a reason we can't let them replay them indefinitely? I'm fairly sure SQLite WAL mode allows for concurrent reading and writing of the database. If this is some private thing feel free to move this to the Dev discord. |
@@ -726,6 +773,13 @@ export const commands: Chat.ChatCommands = { | |||
user.settings.blockPMs = true; | |||
this.sendReply(this.tr`You are now blocking private messages, except from staff.`); | |||
} | |||
let saveValue: string | boolean | null = user.settings.blockPMs; | |||
if (!saveValue) saveValue = 'none'; | |||
// todo: can we do this? atm. no. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'unlocked' and 'autoconfirmed' settings aren't supported since that's.... awful to handle.
} | ||
if (!Users.globalAuth.atLeast(user, Config.usesqlitepms)) { | ||
if (forceBool) return false; | ||
throw new Chat.ErrorMessage("You do not have the needed rank to send offline PMs."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should handle the Config.usesqlitepms === "friends"
case (which will always lead to the error message being thrown here) and also probably say what rank is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we ever set this to friends? It should be an auth group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not planning to allow offline PMs only from friends? I'm pretty sure that was the idea, but I haven't thought about this in a year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I think we'd need to discuss that. It does seem like maybe that should be up to users, but maybe we could default to friends.
server/private-messages/index.ts
Outdated
if (Config.usesqlitepms === 'friends') { | ||
if (!user.friends?.has(pmTarget)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the nesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly thought it looked nicer. Not super invested.
Co-authored-by: Annika <annika0uwu@gmail.com>
f4c8cc0
to
a521e0b
Compare
a521e0b
to
838c656
Compare
838c656
to
90a6563
Compare
Bump? |
c3a7082
to
1ae48c4
Compare
Few things of note here.
FIrstly, as I was concerned about database load, all PMs are temporary. When user A sends a PM to user B while offline, the PM is retained for 60 days (assuming the user has not seen it). After that, it is deleted. When a user logs in, their pending PMs are sent to them, and they are all marked as seen (set to the current UNIX timestamp). The user may replay these PMs via a chat page for up to one week, after which they are deleted.
I have also presently unified the /blockpms command with the setting (stored in the database) that marks if a user wants to receive offline pms (and from what rank, if so). This can be forcibly set via Config.usesqlitepms, which indicates the rank that users must be to send offline PMs. If either the config setting or the user setting is set to friends, only friended users may send that user offline PMs.
Note that with the offline blockpms we currently do not support 'autoconfirmed' and 'unlocked' settings. Locked users should be blocked by default, though.
Closes #2151.