-
Notifications
You must be signed in to change notification settings - Fork 52
reduce list of projects for admin resolves #1187 #1238
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: dev
Are you sure you want to change the base?
Changes from all commits
b0bc997
b5e7fc6
bc5dac7
29bcd5d
7880426
816df7d
232d7b7
5941bee
809af83
69f24cb
f35dd41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,20 +77,28 @@ def self.prepare_pretty_category_names(groups = [], as_user = nil) | |
| wgs | ||
| end | ||
|
|
||
| def pretty_category_name(as_user) #:nodoc: | ||
| def pretty_category_name(as_user = nil) #:nodoc: | ||
| return @_pretty_category_name if @_pretty_category_name | ||
| if self.invisible? | ||
| @_pretty_category_name = 'Invisible Project' | ||
| elsif self.public? | ||
| @_pretty_category_name = 'Public Project' | ||
| elsif self.users.count == 0 | ||
| @_pretty_category_name = 'Empty Work Project' | ||
| elsif self.users.count > 1 | ||
| @_pretty_category_name = 'Shared Work Project' | ||
| elsif as_user.present? && (self.creator_id == as_user.id || self.users.first.id == as_user.id) | ||
| @_pretty_category_name = 'My Work Project' | ||
| if @_pretty_category_name.blank? | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the if surrounding the code at line 82. It wasn't there in the original and it's useless. |
||
| if self.invisible? | ||
| @_pretty_category_name = 'Invisible Project' | ||
| elsif self.public? | ||
| @_pretty_category_name = 'Public Project' | ||
| elsif self.users.count == 0 | ||
| @_pretty_category_name = 'Empty Work Project' | ||
| elsif self.users.count > 1 | ||
| @_pretty_category_name = 'Shared Work Project' | ||
| elsif as_user.present? && (self.creator_id == as_user.id || self.users.first.id == as_user.id) | ||
| @_pretty_category_name = 'My Work Project' | ||
| else | ||
| @_pretty_category_name = "Personal Work Project of #{self.users.first.full_name}" | ||
| end | ||
| end | ||
| # Public is more of quantifier, there could be public shared or public personal projects | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please adjust the code between line 97 and 102
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, based on the logic, you will never re-sinsert
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I just suggest you set up, early, a string variable that has either
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi so would you like a) adjust code to enable Share Public Work Project or at this moment I will be fine with c) to avoid any perceived blame for the existing production bug shown on snapshot ( I factored it out into a separate issue #1323 we can fix it once agree on the best way to do it)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ignore then the above question I will try add variable .. one min
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I think honestly that the original code required very little changes. It wasn't buggy. If you see the filter list not behaving the way you expect, the problem is not in this method. Like I said, look for other places where the instance variable is modified. |
||
| if @_pretty_category_name.present? && self.public && ! @_pretty_category_name.include?('Public') | ||
| @_pretty_category_name = @_pretty_category_name.sub(" ", " Public ") | ||
| else | ||
| @_pretty_category_name = "Personal Work Project of #{self.users.first.full_name}" | ||
| @_pretty_category_name | ||
| end | ||
| @_pretty_category_name | ||
| end | ||
|
|
||
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.
selected.include(g.id.to_s)will wrongly select some group if for instance we selected is the string "12345" and the current group is ID "34". UseArray(selected).include...instead.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.
Aren't there a better way to generate this list? Isn't this equivalent to
(or close to that?)