How to Get Activity Ids of Activity Reaction in Swift - getstream-io

So I'm using Swift and I am trying to get all the comments activityId so that I can open them in another DetailViewController. Though I'm not sure how to go about this. below is what I think is the right way to go about it but i'm not sure how to get the activities. How should I go about this? I want to put them in an array of activityIds.
Client.shared.reactions(forActivityId: activityPresenter!.activity.id, kindOf: .comment) {
result in
if let values = try? result.get() {
}
}
I've added an image for clarification. Right now I'm using the DetailViewController which is the image shown. In this view, there is a section that says "2 more replies". Currently when I click on it, it doesn't segue anywhere. What I want to do is when I click on the comment that has replies, it will segue to a similar screen that shows those replies so users can comment and react to them.

When using reactions, it is possible to request enriched activities that include both attached reactions by type and reaction counters.
Here is an example in Swift showing how to retrieve those enriched activities from a given feed :
// read bob's timeline and include most recent reactions to all activities and their total count
client.flatFeed(feedSlug: "timeline", userId: "bob")
.get(includeReactions: [.latest, .counts]) { result in /* ... */ }
Please find out more about it here in our documentation : https://getstream.io/docs/reactions_read_feeds/?language=swift#read_feeds_with_reactions

I figured out that what I'm looking for is not possible. Reactions are different from Activities and have their own Ids ex. reactionId vs activityId so I can't use the DetailViewController to open a reaction. I've posted another question related to this here: Does Stream.io for Swift have a "ReactionViewController" that works similarly to DetailViewController?

Related

Getstream-io: removing activity by foreign id - not removed from any "to "feeds

I feel like this question was almost answered here but the implementation isn't working for me.
I add a comment activity to Thing A's feed and use the to field to notify specific users about the comment.
If I view the data explorer for Thing A I see the comment. I also see the comment in my user's notification feed.
I then delete Thing A by doing the following:
$feed = $client->feed("thing", "a");
$feed->removeActivity($foreignId, true);
// delete from our app DB
Going back to the data explorer I see that the activity is removed from Thing A's feed but still exists in my user's feed. They both share the same foreign id and from what I understand removing an activity from the origin feed using the foreign id will propagate that removal to all affected feeds. I've verified that the foreign id is correct.
I suppose my question is why is this not removing my activity everywhere? Is there something else I need to be doing to remove the activity from the notification feeds?
When I run this piece of code against my personal dev app, it works. It works when thing is a flat feed and user is either a flat or a notification feed group.
$feed = $client->feed('thing', 1);
$feed->addActivity([
'actor' => 'user:1',
'verb' => 'like',
'object' => 'post:5',
'foreign_id' => 'like:1',
'to' => ['user:1'],
]);
$feed->removeActivity('like:1', true);
If you keep having issues, please contact getstream at https://getstream.io/contact/ with more specific details (feed group names, ids, activity IDs, ...) for a closer look.
Cheers!

How to make the bot initiate 1:1 conversation in a group with the user in Slack using Microsoft bot-framework?

I am using Microsoft bot-framework for Nodejs. I want my bot to start a private conversation within a group with a user. Currently, my bot carries on the conversation with any member responding.
For example,
Me: Hi #bot
Bot: Hi
Me: I need to order a pizza
Bot: What would you like on your pizza?
SomeTeamMember: Mushrooms and Onions
Bot: Ordering Pizza with Mushrooms and Onions.
As you can see, the conversation was hijacked by some other member, this is the issue I am facing, I want to avoid this from happening. I want the bot to only communicate with one member at a time and when the conversation ends with that user, it is open to communicate with anyone in the same manner as previous user. Any suggestion would be great!
You are using slack? Anyway, when you reach "Bot: What would you like on your pizza?", you should be in a completely new dialog where you can use each conversation member Id and store it to data bag (context.ConversationData) in order to have context.
When "SomeTeamMember" joins the conversation, you can check his or hers conversation member id to get the state for each member, and act accordingly.
Hope this helps :)
Alex
I think you could use the session object and access the message sender id i.e session.message.user.id. And maybe filter out messages coming from other users other than the one that said I need to order a pizza.
Also from the documentation I think you could use something like dialog triggered by an action, activated right after I need to order a pizza.
You could then check the user's id, and reroute to dialogs where the other users will be filtered out, except for the sender of I need to order a pizza...
If you try something like, or complexify:
bot.dialog('pizzarouting', function (session, args, next) {
})
// Once triggered, will start a new dialog as specified by
// the 'onSelectAction' option.
.triggerAction({
matches: /^Pizza$/i,
onSelectAction: (session, args, next) => {
// Add the help dialog to the top of the dialog stack
// (override the default behavior of replacing the stack)
session.send('What would you like on your pizza?')
console.log(session.message);
// Reroute to dialog that filter out the other people id
// session.beginDialog(args.action, args);
}
});
This gets activated only if a user sends 'Pizza' in chat.
You'll see that the session object holds the message object, which you could use for example to identify the user who sent I need to order a pizza and get his id for subsequent filtering.
I hope you or anyone who gets around this gets interesting ideas.

viewJsonService returning too many entries to dataGrid

I've set up an ExtLib REST service as "xe:viewJsonService" and connected it to a domino view. Currently the view contains 63 entries. The documents behind those entries have read access restrictions.
The Json returned by the service is consumed by a Dojo Data Grid (taken from the ExtLib libraries).
The page is accessed by a test user having read access to only one of the 64 entries. This user however sees a data grid containing a single data element, followed by 63 empty entries, like this:
Looking at the raw Json data I see that the service indeed is only returning a single entry, but it knows that there are 63 siblings:
[
{
"#entryid":"1-6C5763E4A122F1D3C1257EC700355386",
"#unid":"6C5763E4A122F1D3C1257EC700355386",
"#noteid":"3FD2E",
"#position":"1",
"#read":true,
"#siblings":63,
"#form":"fInvoice",
"colIconStatus":"imgInvExported.gif",
"colIconLock":"blank.gif",
"invInvoiceDate":"2015-09-21T09:44:27Z",
"invJobInvNumbers":"111\/5152\/52567\/ 001",
"invSupplierNameShort":"My Test Company GmbH",
"invAmount":121.5
}
]
Technically speaking this is correct as the service has access to all 64 entries. Problem is that the data grid is making space for 64 entries instead of only one.
Question is: how can I tell the data grid the correct amount of data to be displayed? Or do I need to manipulate the REST service instead?
EDIT: continuing my search for a possible solution in meanwhile found a few other related questions this one by Eric McCormick (including a very good approach by Stephan Wissel), or this one by Steve Zavocki. So my question would be a duplicate, really... (sorry for that)
Caveat: please read down to the bottom of this answer as you might run into unexpected ussues!
Finally after some playing around I just stumbled upon an obscure property that seems to help, for whatever reason (I'll be making this a new question):
the property globalValues appears to be available for service types xe:documentJsonService, xe:viewItemFileService, xe:viewJsonLegacyService, xe:viewJsonService and xe:viewXmlLegacyService. this property has three fixed options called Entries (= 0x0001), Top Level (= 0x0002) and Timestamp (= 0x0004). Just by playing the goold old "trial-and-error" game I found that setting this property to 1 (= Entries) modifies / filters the resulting data:
by default the raw JSON returned by xe:viewItemFileService looks like this:
{
"#timestamp":"2015-10-14T12:57:59Z",
"#toplevelentries":63,
"items":
[
{
...
}
]
}
Setting globalValues to "1" removes the #timestamp and #toplevelentries fields from the output:
{
"items":
[
{
...
}
]
}
And, more importantly, this also removes the empty rows from my data grid!
There's only one thing that's making me nervous and that is that I can't find any explanation at all in regards to that property. So I really don't have a clue whether there are any unwanted side effects...
Update: thanks to Knut Herrmann I did some more testing on this (see comments below this answer). In my test case there are over 13,000 documents in my view; as long as my test user can only read a small amount of those everything seems to be fine. Then I added 200 more documents to the read-enabled list. Result is a data-grid that constantly has to recalculate its scroll bar: the further down I'm scrolling the smaller the scroll handle gets. As soon as I reach the bottom line however the grid goes berzerk and decides to only display the first 13 (?!?) rows, and also the scroll bar is removed alltogether. Performance isn't as bad as I expected, though.
So I have to agree with Knut that this isn't such a good solution for the combination of large views with a large subset of accessible entries!
Lothar,
I have experienced this before as you pointed out. I believe the answer is to use the 'keys' property to filter out the invalid entries.
I am not sure about how your application is structured, but if the user can only see certain entries in the view, I would consider categorizing by user, and then use the keys to show them only the rows in which they have access.
You asked if you can change the dojo grid to exclude the entries. I think the answer there is no. Your options are to filter via the REST service or via the Notes view.
Here is a related blog post that I wrote on the issues I was having. http://notesspeak.blogspot.com/2013/07/creating-updatable-rest-service-for-use.html
EDIT 2 Additional Things to Try
1) Did you see the comment on my blog post? I haven't tried it myself. Credit goes to blog comment-er "Goo Goo".
"I use this code in onstyleRow event of the grid to solve the blank rows issue "
which using viewJsonService:
var row = arguments[0];
var rowItem = djxDataGrid1.getItem(row.index);
var rowCount = Object.keys(restService1._index).length - 1; //-1 for omit the onUpdate event
if(row.index >= rowCount){
row.customStyles += 'display:none;';
}
2) What I personally did to fix the issue is in this SO answer: How to configure an xe:viewFileItemService on an XPage to filter the data in a categorized view?
Given what you said about your view structure, I am not sure that this will apply to you.

use of venue's todo id

When using this service, we receive an array called listItems, in which there are TODO's related to the venue.
These todo's have an id, but this ID cant be used for marking a todo as done. (for marking as done we use tips/TIP_ID/markdone).
I understand that the right ID for doing this is the tip ID. Is there anyway for relating the todo and tip ID's without having to call another service (as their relationship is one for one)?
You should be able to take the tip id (that is marked as "todo" for the user) and mark the tip as done with that same ID.
Have you tried using /lists/additem, which is the now the preferred way to mark an item as done?

Userimage in Sharepoint Blog comment

I´m searching for a way to display the userimage next to the name of a Blog-comment in sharepoint 07. First idea was to add a Image column to the comment list and use a add event to fill it, but this would not catch a change of the userimage and I still have no control over the rendering.
Thanks for any suggestion
ren
To make a long Story short , there seems to be no simple Solution to achieve this.
The Listview for the comments can not be bend to show userimages.
Finally I had to create a own webpart to show the Post and the corresponding comments, but be warned. You have to search all comments associated with the Post and get the Userprofile for each user that left a comment.
Even I get Linq to work with MOSS07 the performance for large Blogs might suffer

Resources