Project

General

Profile

Patch #2635 ยป 2635-show-notice-on-forum-updates.diff

Go MAEDA, 2018-12-15 15:27

View differences:

app/controllers/messages_controller.rb (working copy)
63 63
      if @message.save
64 64
        call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
65 65
        render_attachment_warning_if_needed(@message)
66
        flash[:notice] = l(:notice_successful_create)
66 67
        redirect_to board_message_path(@board, @message)
67 68
      end
68 69
    end
......
80 81
      attachments = Attachment.attach_files(@reply, params[:attachments])
81 82
      render_attachment_warning_if_needed(@reply)
82 83
    end
84
    flash[:notice] = l(:notice_successful_update)
83 85
    redirect_to board_message_path(@board, @topic, :r => @reply)
84 86
  end
85 87

  
......
101 103
    (render_403; return false) unless @message.destroyable_by?(User.current)
102 104
    r = @message.to_param
103 105
    @message.destroy
106
    flash[:notice] = l(:notice_successful_delete)
104 107
    if @message.parent
105 108
      redirect_to board_message_path(@board, @message.parent, :r => r)
106 109
    else
test/functional/messages_controller_test.rb (working copy)
129 129
          }
130 130
        }
131 131
    end
132
    assert_equal I18n.t(:notice_successful_create), flash[:notice]
132 133
    message = Message.find_by_subject('Test created message')
133 134
    assert_not_nil message
134 135
    assert_redirected_to "/boards/1/topics/#{message.to_param}"
......
171 172
        }
172 173
      }
173 174
    assert_redirected_to '/boards/1/topics/1'
175
    assert_equal I18n.t(:notice_successful_update), flash[:notice]
174 176
    message = Message.find(1)
175 177
    assert_equal 'New subject', message.subject
176 178
    assert_equal 'New body', message.content
......
189 191
        }
190 192
      }
191 193
    assert_redirected_to '/boards/1/topics/1'
194
    assert_equal I18n.t(:notice_successful_update), flash[:notice]
192 195
    message = Message.find(1)
193 196
    assert_equal true, message.sticky?
194 197
    assert_equal true, message.locked?
......
222 225
      }
223 226
    reply = Message.order('id DESC').first
224 227
    assert_redirected_to "/boards/1/topics/1?r=#{reply.id}"
228
    assert_equal I18n.t(:notice_successful_update), flash[:notice]
225 229
    assert Message.find_by_subject('Test reply')
226 230
  end
227 231

  
......
234 238
        }
235 239
    end
236 240
    assert_redirected_to '/projects/ecookbook/boards/1'
241
    assert_equal I18n.t(:notice_successful_delete), flash[:notice]
237 242
    assert_nil Message.find_by_id(1)
238 243
  end
239 244

  
......
246 251
        }
247 252
    end
248 253
    assert_redirected_to '/boards/1/topics/1?r=2'
254
    assert_equal I18n.t(:notice_successful_delete), flash[:notice]
249 255
    assert_nil Message.find_by_id(2)
250 256
  end
251 257

  
    (1-1/1)