Description:
Prevented empty messages from being sent and fixed a typo
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r377:08f39063736a - - 1 file changed: 7 inserted, 6 deleted
@@ -31,20 +31,21 | |||
|
31 | 31 | user = User.find(session[:user_id]) |
|
32 | 32 | @message = Message.new(params[:message]) |
|
33 | 33 | @message.sender = user |
|
34 | - if !@message.save | |
|
35 | - render :action => 'list' and return | |
|
34 | + if @message.body == '' or !@message.save | |
|
35 | + flash[:notice] = 'An error occurred' | |
|
36 | 36 | else |
|
37 | 37 | flash[:notice] = 'New message posted' |
|
38 | - redirect_to :action => 'list' | |
|
39 | 38 | end |
|
39 | + redirect_to :action => 'list' | |
|
40 | 40 | end |
|
41 | 41 | |
|
42 | 42 | def reply |
|
43 | 43 | user = User.find(session[:user_id]) |
|
44 | 44 | @message = Message.new(params[:r_message]) |
|
45 | 45 | @message.sender = user |
|
46 | - if !@message.save | |
|
47 | - render :action => 'show' and return | |
|
46 | + if @message.body == '' or !@message.save | |
|
47 | + flash[:notice] = 'An error occurred' | |
|
48 | + redirect_to :action => 'show', :id => @message.replying_message_id | |
|
48 | 49 | else |
|
49 | 50 | flash[:notice] = 'Message replied' |
|
50 | 51 | rep_msg = @message.replying_message |
@@ -58,7 +59,7 | |||
|
58 | 59 | message = Message.find(params[:id]) |
|
59 | 60 | message.replied = true |
|
60 | 61 | message.save |
|
61 |
- flash[:notice] = 'Message hid |
|
|
62 | + flash[:notice] = 'Message hidden (just marked replied)' | |
|
62 | 63 | redirect_to :action => 'console' |
|
63 | 64 | end |
|
64 | 65 |
You need to be logged in to leave comments.
Login now