-
Notifications
You must be signed in to change notification settings - Fork 3
wikiリダイレクトのリセット機能 #11 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
最初テストがうまく動かないことで戸惑っていたが、テストの実行コマンドでRAILS_ENV=testを入れるのを忘れていたのが原因だった。 現在はdestroyアクションは作ったので、それをViewからaタグでリクエストできるようにするところから次はじめる 画面案 Wiki表示画面の三点リーダ やること
テスト(テスト駆動で)
project_redirect_path DELETE /projects/:project_id/wiki/redirects/:id(.:format) ID=1でユーザーを指定してもなぜかアノニマスユーザーになる => RAILS_ENV=testをつけていなかったのが原因 |
|
あと、権限チェックの部分の実装も |
5d4821e to
b20f5c3
Compare
4bfe403 to
06bcdc0
Compare
06bcdc0 to
b2cbf4b
Compare
b20f5c3 to
684ba63
Compare
fe9ce7e to
b2cbf4b
Compare
|
@ishikawa999 rebaseはもうしていたので、手元のブランチを作り直してくださいね。 |
13004b5 to
1a444c0
Compare
|
第5回パッチ会 やったこと
課題 パスが /projects/:project_id/wiki/redirects/:id(.:format) だと、「redirects」という名前の Wiki ページを表示しようとしてしまう。 次にやること
|
1a444c0 to
8ac53f5
Compare
684ba63 to
3ef3f21
Compare
d5ebf1c to
4d686b3
Compare
3ef3f21 to
8d71268
Compare
4d686b3 to
3fd33af
Compare
8d71268 to
1a86b44
Compare
3fd33af to
8be4ec5
Compare
8be4ec5 to
d30dd08
Compare
009b5f2 to
0c81fbd
Compare
d30dd08 to
838a308
Compare
f97b308 to
fac2633
Compare
838a308 to
4debae2
Compare
|
@kfischer-okarin 細かいところで、UI(フロントエンド)周りについては、下記の2点が少し気になりました。
上記いずれもUI/UX的に問題なさそうであれば、大丈夫だと思います。 なお、私のRedmine公式サイトのアカウントは、GitHubと同じ@sanakとなりますので、よろしくお願いします 🙇♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2点ほど細かい気になった点をコメントしました。挙動自体には問題ないと思います。
| <% @redirects_to_self.map { |redirect| %> | ||
| <%= link_to(l(:button_delete_redirect, :page_title => WikiPage.pretty_title(redirect.title)), {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %> | ||
| <% } %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <% @redirects_to_self.map { |redirect| %> | |
| <%= link_to(l(:button_delete_redirect, :page_title => WikiPage.pretty_title(redirect.title)), {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %> | |
| <% } %> | |
| <% @redirects_to_self.map do |redirect| %> | |
| <%= link_to(l(:button_delete_redirect, :page_title => WikiPage.pretty_title(redirect.title)), {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %> | |
| <% end %> |
細かいのですが、ここのブロックはdo...endの方が他の書き方にあっていて良いと思います。
| end | ||
|
|
||
| def test_destroy_without_permission | ||
| @request.session[:user_id] = User.generate!.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- test_destroyとtest_destroy_without_permissionの間で結局何の権限の違いによって結果が違うのかが分かりづらい(rename_wiki_pages権限の有無によって違うはず)
- test_destroyとtest_destroy_without_permissionで別のユーザーを使っているため、rename_wiki_pages権限以外の前提にも違い出てしまっている
という2点が気になりました。
前提(@request.session[:user_id] = 2)は合わせた上で、権限無しのテストでだけ Role.find(1).remove_permission! :rename_wiki_pages という書き方のほうが個人的には好きです。
diff --git a/test/functional/wiki_redirects_controller_test.rb b/test/functional/wiki_redirects_controller_test.rb
index 7949ec3b5..e9ae9f2f7 100644
--- a/test/functional/wiki_redirects_controller_test.rb
+++ b/test/functional/wiki_redirects_controller_test.rb
@@ -31,6 +31,8 @@ class WikiRedirectsControllerTest < Redmine::ControllerTest
end
def test_destroy
+ @request.session[:user_id] = 2
+
wiki_page = WikiPage.find(2)
old_title = wiki_page.title
wiki_page.title = 'Test'
@@ -45,8 +47,9 @@ class WikiRedirectsControllerTest < Redmine::ControllerTest
assert_not WikiRedirect.exists?(id: wiki_redirect.id)
end
- def test_destroy_without_permission
- @request.session[:user_id] = User.generate!.id
+ def test_destroy_without_rename_wiki_pages_permission
+ @request.session[:user_id] = 2
+ Role.find(1).remove_permission! :rename_wiki_pages # User 2 role
wiki_page = WikiPage.find(2)
old_title = wiki_page.title(気になった点としてコメントしただけなので、この書き方でも問題なくコミットされると思います。)
fac2633 to
7c42c2d
Compare
4debae2 to
2e82818
Compare
|
すいません、私の方で要らないコメントをしてましたが、良く読み返すと、 |
973f3cd to
f313677
Compare
8d061a1 to
e0f5ce3
Compare
f313677 to
5f3f52b
Compare
f72861f to
b288f1c
Compare
5f3f52b to
c8e0edc
Compare
b288f1c to
1fc0bf3
Compare
c8e0edc to
8c743ca
Compare
1fc0bf3 to
3ce81c7
Compare
8c743ca to
847dd9c
Compare
3ce81c7 to
e41a937
Compare
e41a937 to
5ffe6c0
Compare
21cbdf0 to
1422a57
Compare
65f66cd to
3f70dd6
Compare
1422a57 to
e7f6b15
Compare
3f70dd6 to
f3dba0a
Compare
e7f6b15 to
4b930c6
Compare
f3dba0a to
f653a8f
Compare
4b930c6 to
b754d4d
Compare
f653a8f to
50770a9
Compare
|
Patch can be downloaded here |


インデックスを貼る