-
Notifications
You must be signed in to change notification settings - Fork 15
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
Threads to be sent to municipality #741
base: staging
Are you sure you want to change the base?
Threads to be sent to municipality #741
Conversation
Wow, that is an exciting possibility. I think it is really for @mvl22 to deal with as this is not a coding issue so I can't comment. |
Thanks for this, Petr! There seem to be hard-coded references to the specific service (zmente.to) in the code - I think this stuff should be generalised, perhaps in the form of a driver file which implements particular services and then the settings contain a drop down of the available drivers (albeit only one at present). On a policy question, if any member can submit an issue externally, what is required to ensure that the submission represents the considered view of the members of the discussion thread as a whole? For instance, couldn't a new user come along, and submit something wildly different to the consensus view? |
@mvl22 For now, this only sets I would like to add a possibility to configure possible services in the site config. My idea is, that user only fills service name and service identifier (and maybe other identifiers in the future) to the table. If the table is empty, no Změňte.to is a service opened to the wide public, so opening this possibility to the group member is more restrictive than the original service. So for my use-case, this is OK and I would like to keep this simple. If anyone wants to add some service that requires more restrictive approach, he can add it by some settings of the services. |
9f6d9b0
to
63af588
Compare
I updated this PR and I consider it to be feature complete now. I changed the thread parameter to So now there is no reference to any particular service and everything is done by configuration in admin. If no service is added in admin, no "Send to municipality" button is displayed, so nothing changes. Please review. |
5d6e8ed
to
2b1891d
Compare
I rebased this to |
Thanks @PetrDlouhy I don't have time to review this one properly yet and I'd like to do it after the next release, do you mind it waiting here for a bit? Thanks |
I would like, if it got there, but I cannot force you :-) |
2b1891d
to
e69f05c
Compare
5ca9473
to
b291487
Compare
@nikolai-b When will you have time to review this? If you write me in advance, I could rebase this before your review. |
Yes, if you could update to the latest code, that will speed up review - I see there is a conflict noted for instance. |
b291487
to
3d82b80
Compare
@mvl22 OK, rebased. |
3d82b80
to
d63f000
Compare
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.
I'm unsure about the UI change.
Which creates a normal new thread and marks it as external which presumably your script then is able to pull in from the API. Why not just add it as a drop down (but allow it to be blank) whenever a new thread is created?
Other than that the code is fine, I've made a few minor comments. Thank you @PetrDlouhy !
|
||
def create | ||
@external_service = ExternalService.new(permitted_params) | ||
puts @external_service |
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.
I'll remove this after merging.
<div class="permissions">shared</div> | ||
<div class="thread-parameters"> | ||
<div class="permissions">shared</div> | ||
</div> |
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.
I think this whole code is left over from the initial design (i.e. it isn't used live). @mvl22 was there a reason the original designs were kept as part of this repository? Can we delete it? They will exists in git if we do ever need to refer to them.
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.
was there a reason the original designs were kept as part of this repository
Because the design has never actually been fully implemented yet! That said, I am trying to get round to commissioning a fresh new design that mops up piles of usability issues.
@@ -49,6 +49,10 @@ | |||
%aside#sidebar.wide | |||
- if permitted_to? :create, :issue_message_threads | |||
= link_to t(".new_thread", count: @issue.threads.count), new_issue_thread_path(@issue), class: "btn-green", rel: "#overlay" | |||
- if current_user and current_user.groups.present? |
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.
and
is a trick in ruby and doesn't do things sensibly, I'll change to &&
when I merge
"#{id}-#{short_name}" | ||
end | ||
|
||
protected |
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.
Any reason this is here?
@@ -0,0 +1,9 @@ | |||
class AddSubmitExternalToMessageThread < ActiveRecord::Migration | |||
def change | |||
add_column :message_threads, :external_service_id, :integer |
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.
If we use
add_reference :message_threads, :external_service, foreign_key: true
it adds and index and preserves referential integrity (i.e. we can't have a thread referencing a non-existent external service.
create_table :external_services do |t| | ||
t.string :name, null: false | ||
t.string :short_name, null: false | ||
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.
We want a uniqueness constraint on :short_name
add_index :external_services, :short_name, unique: true
t.string :short_name, null: false | ||
end | ||
end | ||
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.
In pulls it helps if you also run rake db:migrate
and commit the schema changes.
has_many :threads, class_name: 'MessageThread', inverse_of: :external_service | ||
|
||
validates :name, presence: true, uniqueness: true | ||
validates :short_name, presence: true, uniqueness: true, subdomain: true |
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.
What is this? As in what is the difference between the name and short name? Why not just use the name?
end | ||
@message = @thread.messages.build | ||
@message.body = issue.description | ||
@thread.title = issue.title |
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.
I'm not sure about setting the thread title equal to the issue title.
I think it should be:
Issue: New housing will be built
Thread: Increased congestion on the road
Thread: Cycle Parking on the New housing application is poor
etc.
See #43 for context.
To be clear - is this purely copying the initial problem report to the municipality? |
@mvl22 is #741 (comment) addressed to me or @PetrDlouhy ? I think the Send To Municipality button will make a new thread and mark it as such so the thread is sent to the external service. |
To Petr.
Ah, this is not what I was expecting. Peter - why does a report also create a new thread? Can these not be separated into "Create a new thread" (which already exists) and "Send to municipality" (as to be added)? I think it would be clearest to keep these two things completely separate. |
0a772ab
to
75e28de
Compare
This is unfinished functionality prototype meant to be discussed and finished before pulling.
This PR adds new button "Send to the municipality" which adds new message thread with parameter that it should be send to the municipality. We are working in cooperation with Prague city council on this function which will send automatically Issue data to the official portal http://zmente.to.
The new thread form is prefilled with the issue title and description, the user can modify this or leave it.
This function is available only for members of the groups to prevent inexperienced users from sending low quality issues.
There some things, that has to be solved before pulling:
Please comment, what do you think about this function.