48 "Invitation to become a %(role_verbose)s for %(group)s.") |
48 "Invitation to become a %(role_verbose)s for %(group)s.") |
49 |
49 |
50 DEF_NEW_GROUP_MSG_FMT = ugettext( |
50 DEF_NEW_GROUP_MSG_FMT = ugettext( |
51 "Your %(application_type)s for %(group_name)s has been accepted.") |
51 "Your %(application_type)s for %(group_name)s has been accepted.") |
52 |
52 |
53 DEF_WELCOME_MSG_FMT = ugettext("Welcome to Melange %(name)s,") |
53 DEF_WELCOME_MSG_FMT = ugettext("Welcome to %(site_name)s, %(name)s,") |
54 |
54 |
55 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
55 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
56 |
56 |
57 DEF_NEW_GROUP_TEMPLATE = 'soc/group/messages/accepted.html' |
57 DEF_NEW_GROUP_TEMPLATE = 'soc/group/messages/accepted.html' |
58 |
58 |
200 user_entity: User entity which the message should be send to |
200 user_entity: User entity which the message should be send to |
201 """ |
201 """ |
202 |
202 |
203 # get user logic |
203 # get user logic |
204 user_logic = model_logic.user |
204 user_logic = model_logic.user |
|
205 site_logic = model_logic.site |
205 |
206 |
206 # get the current user |
207 # get the current user |
207 current_user_entity = user_logic.logic.getForCurrentAccount() |
208 current_user_entity = user_logic.logic.getForCurrentAccount() |
|
209 site_entity = site_logic.logic.getSingleton() |
|
210 site_name = site_entity.site_name |
|
211 |
|
212 email = site_entity.noreply_email |
|
213 if not email: |
|
214 email = current_user_entity.account.email() |
208 |
215 |
209 # TODO(Lennard): change the message sender to some sort of no-reply adress |
216 # TODO(Lennard): change the message sender to some sort of no-reply adress |
210 # that is probably a setting in sitesettings. (adress must be a developer). |
217 # that is probably a setting in sitesettings. (adress must be a developer). |
211 # This is due to a GAE limitation that allows only devs or the current user |
218 # This is due to a GAE limitation that allows only devs or the current user |
212 # to send an email. Currently this results in a user receiving the same |
219 # to send an email. Currently this results in a user receiving the same |
213 # email twice. |
220 # email twice. |
214 |
221 |
215 # create the message contents |
222 # create the message contents |
216 messageProperties = { |
223 messageProperties = { |
217 'to_name': user_entity.name, |
224 'to_name': user_entity.name, |
218 'sender_name': current_user_entity.name, |
225 'sender_name': site_name, |
|
226 'site_name': site_name, |
219 'to': user_entity.account.email(), |
227 'to': user_entity.account.email(), |
220 'sender': current_user_entity.account.email(), |
228 'sender': email, |
221 'subject': DEF_WELCOME_MSG_FMT % { |
229 'subject': DEF_WELCOME_MSG_FMT % { |
|
230 'site_name': site_name, |
222 'name': user_entity.name |
231 'name': user_entity.name |
223 } |
232 } |
224 } |
233 } |
225 |
234 |
226 # send out the message using the default welcome template |
235 # send out the message using the default welcome template |