Commit graph

72 commits

Author SHA1 Message Date
Andy Allan
00bd64c7fb Rename message_controller to messages_controller 2018-05-09 16:38:37 +08:00
Andy Allan
ec13ef77bc Lazy lookups for translations in message_controller.rb 2018-05-09 16:25:42 +08:00
Andy Allan
7b2af50f4a Refactor @this_user to @user
Historically we used @user for the currently logged in user, but
this was changed to `current_user` in 2017.
2018-04-11 11:42:33 +08:00
Tom Hughes
bb116b85df Allow third party images in user content 2017-11-23 22:39:05 +00:00
Andy Allan
d581f17665 Avoid using or comparing explicit model ids
The code is easier to read using higher-level concepts.
2017-10-22 21:58:09 +01:00
Andy Allan
6f89da05d1 Use current_user to represent the currently logged in user.
This is already used by the oauth plugin, and is a general rails convention.
2017-07-12 16:10:50 +01:00
Tom Hughes
afa82bd2b1 Render message properly on error 2017-02-09 20:20:55 +00:00
Tom Hughes
4709d90594 Only send messages for POST requests 2017-02-09 19:37:48 +00:00
Tom Hughes
c8671c137a Update rubocop 2017-02-05 11:12:37 +00:00
Andy Allan
41e05f0929 Remove unnecessary controller references from the redirect hashes.
Rails redirect_to uses the current controller by default, so there
is no need to re-iterate this in the code when the redirect targets
the current controller.

The short-form is already used elsewhere, this just tidies up those
which were still using the long-form.
2016-10-12 14:32:49 +01:00
Tom Hughes
dbe165bbb3 Fix some rubocop rails style issues 2015-02-26 00:12:54 +00:00
Tom Hughes
dc2a2c8ebd Standardise on double quoted strings 2015-02-20 19:47:26 +00:00
Tom Hughes
ef7f3d800c Fix most auto-correctable rubocop issues 2015-02-20 08:56:16 +00:00
Tom Hughes
360d68ea5c Replace deprecated deliver method with deliver_now 2015-01-11 12:53:06 +00:00
Tom Hughes
36592f72bc Fix exception when message limit is hit 2014-12-02 21:29:12 +00:00
Tom Hughes
25b93471c1 Preserve message details over validation errors
If a validation error occurs while saving a message then make
sure the values are preserved in the new form.
2014-02-04 22:31:44 +00:00
Tom Hughes
f0feca800d Replace attr_accessible with strong parameters 2013-09-21 11:35:46 +01:00
Tom Hughes
cff41d2171 Ajaxify message deletion 2013-02-03 12:52:51 +00:00
Tom Hughes
021a17b79a Mark a message as read when a user replies via the web 2012-09-03 08:40:17 +01:00
Tom Hughes
eaad3611b8 Add functional tests for messages
Also fixes various issues in the code discovered while writing
the tests, and adds some named routes for messages.
2012-03-22 23:14:29 +00:00
Tom Hughes
5270a07bc5 Handle change from @to_user to @this_user for new message action 2012-03-22 19:47:24 +00:00
Tom Hughes
311f7ddd6e Factor out common code for looking up users 2012-03-21 22:22:33 +00:00
Tom Hughes
a9824dbc2e Use one "no_such_user" view everywhere 2012-03-21 21:47:09 +00:00
Tom Hughes
13289d4041 Switch from Prototype to jQuery 2011-11-26 00:22:31 +00:00
Tom Hughes
226c41be69 Update ActiveRecord queries to use arel 2011-11-14 09:42:44 +00:00
Tom Hughes
7d45c2fd3c Replace request.request_uri with request.fullpath 2011-11-14 09:42:42 +00:00
Tom Hughes
2e2c95133b Use new ActionMail API to send emails 2011-11-14 09:42:41 +00:00
Tom Hughes
f07819d81a Rework application configuration
Use a preinitializer to load the settings from application.yml so
that they are available as early as possible. All settings can also
be overridden using environment variables.

The ad-hoc settins in environment.rb are then moved to this new
system so we have one consistent location for settings.
2010-08-04 22:06:05 +01:00
Tom Hughes
7f1691e878 Update the inbox link in the greeting bar when messages are marked
as read or unread.
2010-03-14 16:02:30 +00:00
Tom Hughes
74852271c9 Fix the selection of the message to be deleted. 2010-03-06 00:26:32 +00:00
Tom Hughes
b90567e197 Tidy up error handling in the message controller, and make it redirect to
the login page if you are logged in as the wrong user. Closes #1569.
2010-02-28 15:13:06 +00:00
Tom Hughes
3851a672e2 Ajaxify the mark read/unread function for messages so it doesn't
reload the whole page each time.
2010-02-26 16:35:36 +00:00
Tom Hughes
e23744bd8d Add :warning and :error flash messages which can be styled separately to
the existing :notice messages.

Also reviewd all existing flash messages and changed them to be errors or
warnings when appropriate and checked that those which are not followed by
a redirect are done as flash.now[] instead of flash[].
2009-11-01 13:07:46 +00:00
Tom Hughes
81d47fe50d Limit the rate at which messages can be sent. 2009-10-31 00:24:36 +00:00
Tom Hughes
581c243e0e Allow messages to be deleted from the outbox as well as the inbox. 2009-07-23 17:41:50 +00:00
Tom Hughes
f3bf0c8b14 Add the ability for a recipient to (logically) delete a message from
their INBOX so they no longer see it.
2009-07-23 15:22:44 +00:00
Ævar Arnfjörð Bjarmason
2153fb6efd Fixed a bug in how fields in /message/new were being pre-filled out.
When someone went to /message/new/:user the "Subject" are would be
pre-filled out with t('message.new.title'). The problem was that the
@title template variable was being used for two purposes, to set the
HTML <title> AND to pre-fill out the subject.

We don't always want these two to be the same, but sometimes we
do. E.g. when someone replies to a diary entry and visits
/message/new/:user?title=Foo we want Foo in the <title> and in the
pre-filled out Subject, and the same goes for replying to a message.

So I've split up the @title variable into @title and @subject.
2009-07-12 16:01:49 +00:00
Ævar Arnfjörð Bjarmason
7253c38234 The <title> wasn't being properly set on /message/new/$user, only on /message/new/$user?title=$title 2009-06-22 19:13:54 +00:00
Thomas Wood
98a86836d2 Commit avar's patch (+ fix for user not found) to change message sending URL to be by user name rather than id.
(Closes #1920)
2009-06-19 22:33:16 +00:00
Ævar Arnfjörð Bjarmason
db51d7f3dd Added & cleaned up messages relating to a given user not existing
The following pages now have a <title> that can be set in localizations:

 * /user/USER_DOES_NOT_EXIST
 * /user/USER_DOES_NOT_EXIST/diary
 * /user/USER_DOES_NOT_EXIST/traces
 * /message/*/ID_DOES_NOT_EXIST

In addition I've cleaned up the i18n message keys of all the
''no_such_user.rhtml'' pages involved. They now all use
title/heading/body for the <title>, <h2> and <p> respectively. And the
message key {{user}} instead of {{name}}.
2009-06-06 13:15:53 +00:00
Tom Hughes
f0f111aced Make a few more things translatable. 2009-06-03 08:06:03 +00:00
Tom Hughes
0e96027a20 Sort out storage and use of user preferred languages. 2009-05-31 14:55:45 +00:00
Shaun McDonald
035254c5fb Might be useful to set the locale everywhere we need the web, rather than just the diary entries. 2009-05-29 14:11:12 +00:00
Tom Hughes
1c81de0572 Send replies to the right user. Closes #1720. 2009-04-19 10:36:04 +00:00
Tom Hughes
5449cf4adc Merge 14394:14533 from trunk. 2009-04-16 21:11:12 +00:00
Tom Hughes
09fdee5493 Add a "database readonly" state that allows all writes to the database
to be suppressed.
2009-04-14 14:27:30 +00:00
Matt Amos
afcb345014 Moved a bunch of time functions into UTC. Fixes bugs which we only see for 4 hours a year. 2009-03-29 01:31:04 +00:00
Thomas Wood
60834f33f9 Pass the to_user to the view. Tests may follow. Closes #1394 2008-12-23 15:08:18 +00:00
Shaun McDonald
1a7ab3570c Deal with active record not found exceptions when creating message. Some tidying of html. For some reason in rails 2.1.2 having a comment at the end of a line, in the view, means that the closing tag needs to be on the next line. 2008-12-03 12:56:02 +00:00
Andy Allan
c253ce3399 some boolean correctness work 2008-11-07 13:51:09 +00:00