Browse Source

Remove welcome message sent on registration

This message is getting pretty outdated now, and should probably be done
in a different way regardless so that it doesn't need to be in the code,
especially since forks won't want the same message (or any message).

A better approach would probably be a consumer or cronjob watching for
new registrations in the event stream.
merge-requests/114/head
Deimos 4 years ago
parent
commit
a9d312d152
  1. 1
      tildes/production.ini.example
  2. 50
      tildes/tildes/lib/message.py
  3. 20
      tildes/tildes/views/register.py

1
tildes/production.ini.example

@ -26,7 +26,6 @@ sqlalchemy.url = postgresql+psycopg2://tildes:@:6432/tildes
stripe.recurring_donation_product_id = prod_ProductID
tildes.default_user_comment_label_weight = 1.0
tildes.welcome_message_sender = Deimos
webassets.auto_build = false
webassets.base_dir = %(here)s/static

50
tildes/tildes/lib/message.py

@ -1,50 +0,0 @@
# Copyright (c) 2018 Tildes contributors <code@tildes.net>
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Functions/constants related to messages."""
# flake8: noqa
WELCOME_MESSAGE_SUBJECT = "Welcome to the Tildes alpha"
WELCOME_MESSAGE_TEXT = """
Hi, welcome to the Tildes alpha!
If you haven't already, please read [the announcement post](https://blog.tildes.net/announcing-tildes) on the blog, since that explains a lot of the general goals and plans for the site.
Some quick information that should help with getting started:
# Read about the basic mechanics
There's a page on the Docs site that explains the basic mechanics on Tildes: https://docs.tildes.net/mechanics
# Check your user page sidebar
There are multiple useful links in the sidebar on your user page&mdash;get there by clicking your username in the top right, or in the sidebar if you're on mobile. You can access the settings page from there, which includes multiple things you'll probably want to do:
* Check the available options for display themes (including dark themes)
* [Set up account recovery in case you lose access to your account](https://tildes.net/settings/account_recovery)
# Please post topics and comments
One of the hardest parts of getting a community started is reaching a critical mass of activity. You can help us reach that point&mdash;if you come across interesting news or articles, please take a minute to also submit it to Tildes, and participate in comment threads on the site.
Note that Tildes is trying to be a place for higher-quality content, not just quick entertainment (or "fluff"). Please try to submit things that are informative, interesting, or have discussion value, and post comments that contribute to discussions.
Groups have been created for a lot of the major subjects, but if there's something you want to post that doesn't really fit in any of them, ~misc is intended to be a catch-all (and we can add more groups if needed). There's also ~test, which you can use if you just want to try out formatting or see how something works.
# Inviting others
Tildes is going to stay invite-only for the foreseeable future while we plan and build the essential features. If you have other people that you'd like to invite, please let me know and I can give you some invite codes (I'll most likely be giving them out periodically anyway).
# Please be patient and expect some roughness
Keep in mind that, for the most part, this has been a one-person endeavor so far. I've been the developer, sysadmin, designer, writer, lawyer, manager, president of the non-profit, etc. I'm not very good at a lot of those roles.
The site is still very minimal and will definitely be rough for a while, but I'm excited to finally have other people involved so we can work together to improve it.
If you have any questions, feedback, or suggestions, please feel free to post them in ~tildes or reply to this message to send them to me directly.
Thanks for joining us,
\\- Deimos
"""

20
tildes/tildes/views/register.py

@ -12,11 +12,9 @@ from sqlalchemy.exc import IntegrityError
from webargs.pyramidparser import use_kwargs
from tildes.enums import LogEventType
from tildes.lib.message import WELCOME_MESSAGE_SUBJECT, WELCOME_MESSAGE_TEXT
from tildes.metrics import incr_counter
from tildes.models.group import Group, GroupSubscription
from tildes.models.log import Log
from tildes.models.message import MessageConversation
from tildes.models.user import User, UserInviteCode
from tildes.schemas.user import UserSchema
from tildes.views.decorators import not_logged_in, rate_limit_view
@ -110,8 +108,6 @@ def post_register(
continue
request.db_session.add(GroupSubscription(user, group))
_send_welcome_message(user, request)
incr_counter("registrations")
# log the user in to the new account
@ -123,19 +119,3 @@ def post_register(
# redirect to the front page
raise HTTPFound(location="/")
def _send_welcome_message(recipient: User, request: Request) -> None:
"""Send the welcome message if a sender is configured in the INI."""
sender_username = request.registry.settings.get("tildes.welcome_message_sender")
if not sender_username:
return
sender = request.query(User).filter(User.username == sender_username).one_or_none()
if not sender:
return
welcome_message = MessageConversation(
sender, recipient, WELCOME_MESSAGE_SUBJECT, WELCOME_MESSAGE_TEXT
)
request.db_session.add(welcome_message)
Loading…
Cancel
Save