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 | user = User.find(session[:user_id]) |
|
31 | user = User.find(session[:user_id]) |
|
32 | @message = Message.new(params[:message]) |
|
32 | @message = Message.new(params[:message]) |
|
33 | @message.sender = user |
|
33 | @message.sender = user |
|
34 | - if !@message.save |
|
34 | + if @message.body == '' or !@message.save |
|
35 | - render :action => 'list' and return |
|
35 | + flash[:notice] = 'An error occurred' |
|
36 | else |
|
36 | else |
|
37 | flash[:notice] = 'New message posted' |
|
37 | flash[:notice] = 'New message posted' |
|
38 | - redirect_to :action => 'list' |
|
||
|
39 | end |
|
38 | end |
|
|
39 | + redirect_to :action => 'list' | ||
|
40 | end |
|
40 | end |
|
41 |
|
41 | ||
|
42 | def reply |
|
42 | def reply |
|
43 | user = User.find(session[:user_id]) |
|
43 | user = User.find(session[:user_id]) |
|
44 | @message = Message.new(params[:r_message]) |
|
44 | @message = Message.new(params[:r_message]) |
|
45 | @message.sender = user |
|
45 | @message.sender = user |
|
46 | - if !@message.save |
|
46 | + if @message.body == '' or !@message.save |
|
47 | - render :action => 'show' and return |
|
47 | + flash[:notice] = 'An error occurred' |
|
|
48 | + redirect_to :action => 'show', :id => @message.replying_message_id | ||
|
48 | else |
|
49 | else |
|
49 | flash[:notice] = 'Message replied' |
|
50 | flash[:notice] = 'Message replied' |
|
50 | rep_msg = @message.replying_message |
|
51 | rep_msg = @message.replying_message |
@@ -58,7 +59,7 | |||||
|
58 | message = Message.find(params[:id]) |
|
59 | message = Message.find(params[:id]) |
|
59 | message.replied = true |
|
60 | message.replied = true |
|
60 | message.save |
|
61 | message.save |
|
61 |
- flash[:notice] = 'Message hid |
|
62 | + flash[:notice] = 'Message hidden (just marked replied)' |
|
62 | redirect_to :action => 'console' |
|
63 | redirect_to :action => 'console' |
|
63 | end |
|
64 | end |
|
64 |
|
65 |
You need to be logged in to leave comments.
Login now