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
Curator inbox add document #348
Conversation
dad7134
to
a3b8e34
Compare
I noticed article documents, now that we are store the enhancements on them, can get pretty large. Are we okay with this? |
986162a
to
67f60f8
Compare
There are some bugs:
I don't think the size will be a problem as long as we make sure to do projections on any server-side queries that return lots of articles. |
@@ -63,8 +77,14 @@ Template.curatorInbox.onRendered -> | |||
|
|||
@autorun => | |||
if @ready.get() | |||
if @selectedFeedId.get() in getCustomFeedArray() |
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.
When the ready variable is false, the autorun won't see the reactive-variables inside this if statement and so won't react to them.
total = instance.incidentCollection.find().count() | ||
count = instance.incidentCollection.find(accepted: true).count(); | ||
total = Incidents.find().count() | ||
count = Incidents.find(accepted: true).count(); |
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.
semicolon
server/publications.coffee
Outdated
Meteor.publish 'ArticleIncidentReports', (articleUrl) -> | ||
Incidents.find {url: $regex: new RegExp("#{regexEscape(cleanUrl(articleUrl))}$")}, | ||
Meteor.publish 'ArticleIncidentReports', (articleId) -> | ||
Incidents.find articleId: articleId, |
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 should type check the articleId
@nathanathan I've fixed some of the issues. Will pick this back up in the morning and fix the rest. |
@nathanathan I've cleared up most of the issues/errors. I moved back to the local collection for storing the incidents on the extract-incidents route.
I couldn't replicate this. Do you mean incidents are added but the document is not? Within the inbox? |
The "Text must be a string" error was caused by a change to the grits api. The issue has been fixed, but it might occur intermittently until we deploy the fix to Kirby as well. On the latest version, I couldn't replicate the error when adding incidents. However, I noticed a couple problems I didn't see before. When I added incidents from an article based on text content to an event, the article was duplicated in the inbox. Additionally, the incidents on the event page had 'http://' in their document property, and could not be edited due to the empty document URL field. |
c276fc4
to
bff7234
Compare
looks good 👍 |
@nathanathan I've fixed the two bugs you mentioned.
|
Saving edits to incidents on the curator inbox page for text-input articles is not working for me. I'm seeing this console error:
The document URL field is still being shown when editing incidents from text-input articles on the event page. Also, when a document is added on the event page, the title field is deleted when the user types something in the "Via Pasted Test" field. |
imports/ui/annotation.coffee
Outdated
{ startingIndex, endingIndex, selectedAnnotationId } = options | ||
export annotateContent = (content, annotations, options={}) -> | ||
{ startingIndex, endingIndex, selectedAnnotationId, pointerEvents} = options | ||
pointerEvents ?= 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.
Adding the selected class and pointer events class could be done in a more versatile way by adding a "classes" property to the annotations (similar to the attributes property) before they passed into the annotateContent function. It will also allow us to keep call-site specific logic out of the function.
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.
Good call. I created an array called classNames
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.
@jgoley The classNames arrays should come from the annotations like the attributes property. The selectedAnnotationId and pointerEvents parameters can be replaced by adding the required classNames before the annotations are passed in. The goal is to make it so the sites where the annotation functions are called from have more control over how the content is annotated.
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.
@nathanathan Oh, I see. Sorry about the confusion. How does it look now?
https://github.com/ecohealthalliance/eidr-connect/blob/45fff10fa4ad6fa293915e8a71fd323f03268f21/imports/ui/annotation.coffee
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.
👍 Looks good
server/startup.coffee
Outdated
@@ -96,7 +97,7 @@ Meteor.startup -> | |||
id: "userSpecifiedDisease:#{incident.disease}" | |||
text: "Other Disease: #{incident.disease}" | |||
|
|||
promedFeed = Feeds.findOne(url: 'promedmail.org/post/') | |||
promedFeed = Feeds.findOne(url: $regex: /promedmail.org/) |
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.
Why is this being reverted to a regex?
|
||
incidentContent: -> | ||
articleContent = Articles.findOne(@articleId).enhancements.source.cleanContent.content | ||
Spacebars.SafeString(getIncidentSnippet(articleContent, @, 100)) |
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.
Since this is currently the only call site, it would make sense to set the default padding characters value to 100.
7be8ce9
to
d656a45
Compare
d656a45
to
8b45cb2
Compare
Show annotated snippet in incident details
@nathanathan I ran out of time to test all the changes on Tue. so I'll take care of that Wed morning and let you know when its ready for hopefully a final review. |
How are you adding the document? There was a recent fix for a similar issue here: |
@nathanathan I'm not seeing the issue in master so I'll look into why its happening in this branch. |
Also about the title being lost. I figured if a user selects a suggested article then enters custom text they would want to enter a new title? |
The title field being cleared is an issue when the user enters a title before pasting in the article or when the user wants to make some edits to the pasted content after they've entered the title field. |
4096a52
to
6dcec95
Compare
Update other areas affected by lack of url on articles obj
597e574
to
040f4a5
Compare
040f4a5
to
7d2d2bc
Compare
👍 Looks good |
PT Story
Changes: