profile
viewpoint
Federico Martín Alconada Verzini fedealconada @qiibee Zürich, Switzerland Software Engineer

fedealconada/Leaflet.AffineImage 7

Overlay that lets you display an image on top of the map, transform it using three anchors, and customise the opacity of the image using the toolbox provided.

diegoarcega/wallet 3

Wallet of Fiat currencies. Exchange and store your currencies in one platform

fedealconada/react-native-tags 1

Tag input component for React Native

fedealconada/action-cable-react 0

Use Rails 5 ActionCable channels with React for realtime magic.

fedealconada/angular-lightbox 0

A minimal lightbox directive for AngularJS.

fedealconada/angularjs-google-maps 0

The Simplest AngularJS Google Maps V3 Directive

fedealconada/async-polling 0

An easy way to run reliable polling without messing with setTimeout.

fedealconada/bmp-images-processing-in-c 0

BMP image processing in C

fedealconada/botpress-api.ai 0

Official API.AI Botpress module

fedealconada/contracts 0

Bancor Protocol Contracts

issue commentNodeRedis/node-redis-parser

hiredis is not compiling in nodejs 12

I'm having this issue when trying to install redis-connect.... any clue @Salakar ?

rj-david

comment created time in a day

issue commentGetStream/stream-node-orm

Custom config file directory is not working

Why can't you specify an absolute path? Additionally, that would be a breaking change (DIR to PATH).

For the latest node compatibility, we need "type": "module" in package.json which is again a breaking change.

/cc @mahboubii

Because to do that, I should know exactly the server's absolute path, it's just not comfortable to write something like: STREAM_NODE_CONFIG_DIR=/Users/myusername/Development/myproject/ as a path and for production, when I deploy this to production, I don't know exactly the absolute path on the server.... It's much convenient using a relative path. And regarding not using getstream.jsit's just to have more flexibility on how we want to name the file, or even use other js extension. Actually, at stream-js you are not limiting the file name (see here).

fedealconada

comment created time in 3 days

startedGetStream/mongodb-activity-feed

started time in 12 days

create barnchfedealconada/stream-node-orm

branch : GH-47

created branch time in 13 days

issue openedGetStream/stream-node-orm

Custom config file directory is not working

The code below is the one that allows someone to specifiy a different directory for the getstream.js config file"

if (typeof process != 'undefined' && process.env.STREAM_NODE_CONFIG_DIR) {
		config_file = process.env.STREAM_NODE_CONFIG_DIR + '/getstream.js';
	} else {
		config_file = process.cwd() + '/getstream.js';
	}

The main problem is that, in case we specify a value for STREAM_NODE_CONFIG_DIR this will always be some path relative to the project. Therefore, we must append the process.cwd() to the url.

Moreover, I'm working now with Node v14 and, because of compatibility things, I need to specifiy getstream.js with the .cjs extension. But this is not possible with the current setup because stream-node-orm is forcing us to use a file named getstream.js.

My proposal is just to use a STREAM_NODE_CONFIG_PATH variable that would be path to a file and not a directory path.

created time in 13 days

push eventfedealconada/stream-node-orm

Federico Martín Alconada Verzini

commit sha 729840642650359a865299011a60ce1a59d07a07

add more flexbility to config file

view details

push time in 13 days

pull request commentGetStream/stream-node-orm

[GH-37] fix getstream import

Sure @ferhatelmas

fedealconada

comment created time in 22 days

PR opened GetStream/stream-node-orm

[GH-37] fix getstream import

Fixes #37

+1 -1

0 comment

1 changed file

pr created time in 23 days

create barnchfedealconada/stream-node-orm

branch : GH-37

created branch time in 23 days

fork fedealconada/stream-node-orm

NodeJS Client - Build Activity Feeds & Streams with GetStream.io

https://getstream.io/

fork in 23 days

push eventfedealconada/stonks

Federico Martín Alconada Verzini

commit sha 6236d0ef8ba3676c393ff25cc2a60d3e9e11f62f

add project files

view details

push time in a month

PublicEvent

pull request commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

Following your suggestion,

From my point of view, we should take a different approach and try to fix just once thing at a time. In this case, we're trying to solve the email problem so we need to find a way to be able to pass the entire term to the database and perform an accurate search

I've added some changes... let me know what do you think. I'm not 100% convinced, but I think it works. The idea is that, whenever the terms contain one or more email addresses, we should wrap them with quotes.

fedealconada

comment created time in 2 months

issue commentmattermost/mattermost-server

Fix search for emails in Posts in databases

Hey @ethervoid, sorry its taking me so long, I've been busy the last weeks. I've pushed something, would like you to give it a look

mattermod

comment created time in 2 months

push eventfedealconada/mattermost-server

Federico Martín Alconada Verzini

commit sha 034e9ed611a661eba852df1f7610985ff98f715b

fix search for emails in Posts in databases

view details

push time in 2 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-294] link user's theme to tooltip

 export const LinkTooltip = ({href, connected}) => {     if (data) {         let date = new Date(data.created_at);         date = date.toDateString();-         return (             <div className='github-tooltip'>-                <div className='github-tooltip box github-tooltip--large github-tooltip--bottom-left p-4'>+                <div+                    className='github-tooltip box github-tooltip--large github-tooltip--bottom-left p-4'+                    style={{backgroundColor: theme.centerChannelBg, border: `1px solid ${hexToRGB(theme.centerChannelColor, '0.16')}`}}

@larkox as far as I have seen/checked, only centerChannelColor is on the object. I've chosen 16 as per @asaadmahmood 's request.

fedealconada

comment created time in 2 months

pull request commentmattermost/mattermost-plugin-github

[GH-294] link user's theme to tooltip

@asaadmahmood yeah, that one, AFAIK, comes from the webapp as well

fedealconada

comment created time in 2 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 445dd56dd7e7e24632e4477b8b3dd2587303d037

fix style and remove zIndex

view details

push time in 2 months

PR opened mattermost/mattermost-plugin-github

Reviewers
[GH-294] link user's theme to tooltip

Summary

This PR links the user's theme to the tooltip so it get's the proper style.

Ticket Link

Fixes #294

+38 -13

0 comment

3 changed files

pr created time in 2 months

create barnchfedealconada/mattermost-plugin-github

branch : GH-294

created branch time in 2 months

issue commentmattermost/mattermost-plugin-github

Apply user's theme to the link tooltip

hey @asaadmahmood, I've just added that. It would look like this: image Thoughts?

mickmister

comment created time in 2 months

issue commentmattermost/mattermost-plugin-github

Apply user's theme to the link tooltip

Hey @mickmister, I've linked the user's theme to the tooltip but there are some styles that are not passed in the theme's... I think that the things most affected are:

  1. Box shadow of the tooltip
  2. The little boxes specifying the repo branches (above See more link).

So, a couple of alternatives: Option 1. We leave it like that (its not bad though). Option 2. We add the Menu__content class to it, which will add some borders. Option 3. We could add some additional classes to the theme but they could be a bit specific to the github tooltip

Option 1 image On the following image, note the Repo <- Repo in which there's not enough contrast between the light blues image On the next two images, note the lack of box shadow (maybe not a big deal) image image

Option 2 On these images, I've added the Menu__content class. Note the rounded corners and the border color. image image image image

mickmister

comment created time in 2 months

issue commentmattermost/mattermost-plugin-github

Apply user's theme to the link tooltip

Sure @hanzei !

mickmister

comment created time in 2 months

pull request commentsourcegraph/sourcegraph

fix large value of ElapsedMilliseconds when empty search returns instantly

Shall we close this PR @rvantonder?

fedealconada

comment created time in 2 months

pull request commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

@teresa-novoa, I still have to do some changes to this, sorry for the delay!

fedealconada

comment created time in 3 months

Pull request review commentsourcegraph/sourcegraph

[GH-10701-b] fix large value of ElapsedMilliseconds when empty search returns instantly

 func (a searchAlert) Results(context.Context) (*SearchResultsResolver, error) { 		description:     a.description, 		proposedQueries: a.proposedQueries, 	}-	return &SearchResultsResolver{alert: alert}, nil+	// Passing time.now() is a workaround that prevents (sr *SearchResultsResolver) ElapsedMilliseconds() from returning a wrong calculation

Much better, thanks!

fedealconada

comment created time in 3 months

Pull request review commentsourcegraph/sourcegraph

[GH-10701-b] fix large value of ElapsedMilliseconds when empty search returns instantly

 func (a searchAlert) Results(context.Context) (*SearchResultsResolver, error) { 		description:     a.description, 		proposedQueries: a.proposedQueries, 	}-	return &SearchResultsResolver{alert: alert}, nil+	return &SearchResultsResolver{alert: alert, start: time.Now()}, nil

what about now?

fedealconada

comment created time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha 1b0ebc72314c65ce96ed783bd5df1a919ae9a55e

add workaround comment

view details

push time in 3 months

pull request commentsourcegraph/sourcegraph

[GH-10701-b] fix large value of ElapsedMilliseconds when empty search returns instantly

@rvantonder do you think a test like the one I have just pushed would work?

fedealconada

comment created time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha 1e654e5f44f1c6278aea417c27d4443391cf98ca

add test to check start time is passed

view details

push time in 3 months

pull request commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

So, after talking with @asaadmahmood we’ve agreed that we will keep the text cut off so we can get this feature released and maybe on a later iteration we can adjust some minor termination style details

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha c148406660dcd32704e6181eed3b1eb04ce8daba

remove scrollbar and keep overflow hidden

view details

push time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 0ef70f47ec1be1523fd37c48721cb69e2707cd42

fix overflow text on markdown

view details

push time in 3 months

pull request commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

Hey @asaadmahmood, I agree, I don't like the text being cut off. I've been digging a bit into that. What I've managed to do is, instead of adding ellipsis, just hide the elements (check image below).

image

Thoughts?

fedealconada

comment created time in 3 months

pull request commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

@hanzei my bad, I forgot to run the linter. Changes are pushed now :) @asaadmahmood see below the screenshot, the only thing that has changed has been the addition of the "See more" button. Clicking on it opens up a new tab.

image

Hovering over the link looks like this:

image

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha c155d647adfbde0a50693b82f294cdd4f06db9f9

run linter

view details

push time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 9650f7ffd856265a21fc44095caaee7ebca5eef2

add connected checker

view details

Federico Martín Alconada Verzini

commit sha cfb41637e60c49c7060c16437ce90e98ba482428

Merge branch 'GH-255' of github.com:fedealconada/mattermost-plugin-github into GH-255

view details

push time in 3 months

pull request commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

@hanzei I've just fixed the warning issue, check the changes.

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';+import {getLabelFontColor} from '../../utils/styles';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {+            if (href.includes('github.com/')) {+                const [owner, repo, type, number] = href.split('github.com/')[1].split('/');+                let res;+                switch (type) {+                case 'issues':+                    res = await Client.getIssue(owner, repo, number);+                    break;+                case 'pull':+                    res = await Client.getPullRequest(owner, repo, number);+                    break;+                }+                if (res) {+                    res.owner = owner;+                    res.repo = repo;+                    res.type = type;+                }+                setData(res);+            }+        };+        if (data) {+            return;+        }+        init();+    }, []);++    const getIconElement = () => {+        let icon;+        let color;+        let iconType;+        switch (data.type) {+        case 'pull':+            color = '#28a745';+            iconType = GitPullRequest;+            if (data.state === 'closed') {+                if (data.merged) {+                    color = '#6f42c1';+                    iconType = GitMerge;+                } else {+                    color = '#cb2431';+                }+            }+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        case 'issues':+            color = data.state === 'open' ? '#28a745' : '#cb2431';+            iconType = data.state === 'open' ? IssueOpened : IssueClosed;+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        }+        return icon;+    };++    if (data) {+        let date = new Date(data.created_at);+        date = date.toDateString();++        return (+            <div className='github-tooltip'>+                <div className='github-tooltip box github-tooltip--large github-tooltip--bottom-left p-4'>+                    <div className='header mb-1'>+                        <a+                            title={data.repo}+                            href={href}+                        >{data.repo}</a>&nbsp;on&nbsp;<span>{date}</span>+                    </div>++                    <div className='body d-flex mt-2'>+                        <span className='pt-1 pb-1 pr-2'>+                            { getIconElement() }+                        </span>++                        {/* info */}+                        <div className='tooltip-info mt-1'>+                            <a href={href}>+                                <h5 className='mr-1'>{data.title}</h5>+                                <span>#{data.number}</span>+                            </a>+                            <div className='markdown-text mt-1 mb-1'>+                                <ReactMarkdown+                                    source={data.body}+                                    disallowedTypes={['heading']}+                                    linkTarget='_blank'+                                />+                            </div>++                            {/* base <- head */}+                            {data.type === 'pull' && (+                                <div className='base-head mt-1 mr-3'>+                                    <span+                                        title={data.base.ref}+                                        className='commit-ref'+                                        style={{maxWidth: '140px'}}+                                    >{data.base.ref}+                                    </span>+                                    <span className='mx-1'>←</span>+                                    <span+                                        title={data.head.ref}+                                        className='commit-ref'+                                    >{data.head.ref}+                                    </span>+                                </div>+                            )}++                            <div className='see-more mt-1'>+                                <a+                                    href={href}+                                    target='_blank'+                                    rel='noopener noreferrer'+                                >See more</a>+                            </div>

hey @hanzei, I put the link there because @asaadmahmood told me to do it like that. Check his comment https://github.com/mattermost/mattermost-plugin-github/pull/258#discussion_r423559012. But if you prefer me to put it below the labes, I can do it! Let me know your thoughts!

fedealconada

comment created time in 3 months

Pull request review commentsourcegraph/sourcegraph

fix large value of ElapsedMilliseconds when empty search returns instantly

 func (a searchAlert) Results(context.Context) (*SearchResultsResolver, error) { 		description:     a.description, 		proposedQueries: a.proposedQueries, 	}-	return &SearchResultsResolver{alert: alert}, nil+	return &SearchResultsResolver{alert: alert, start: a.startTime}, nil

Haha, this issue actually helped me to understand quite a lot the search flow. I definitely agree that option 2) is not the best and is not so clean... The option 1) solution is just a workaround, it's kind of just an "aesthetically" change, instead of showing a large number that does not represent the time elapsed we are now changing that for a calculation that always return 0 and that we also know that it also does not represent the time elapsed, but still is better than the large number. I gues that a "clean" way would require too many changes on how the code is designed and might not be worth it. If I would have to go into one of the 2 options, I'd go with 1), maybe I'd comment the code just so you know that is just a workaround and maybe, in the future, if there's the case in which knowing the "real" elapsed time for queries that return instatly becomes importante because of any X reason, that could be the moment to spend more time on that. Anyways, if you happen to think about a good solution, I'm open to hear it.

fedealconada

comment created time in 3 months

pull request commentsourcegraph/sourcegraph

[GH-10701-b] fix large value of ElapsedMilliseconds when empty search returns instantly

@rvantonder this would be option 1) solution.

fedealconada

comment created time in 3 months

PR opened sourcegraph/sourcegraph

[GH-10701-b] fix large value of ElapsedMilliseconds when empty search returns instantly

TODO: write description Draft PR that fixes the large value of ElapsedMilliseconds when empty search returns instantly

Fixes #10701

+1 -1

0 comment

1 changed file

pr created time in 3 months

create barnchfedealconada/sourcegraph

branch : GH-10701-b

created branch time in 3 months

Pull request review commentsourcegraph/sourcegraph

fix large value of ElapsedMilliseconds when empty search returns instantly

 func (a searchAlert) Results(context.Context) (*SearchResultsResolver, error) { 		description:     a.description, 		proposedQueries: a.proposedQueries, 	}-	return &SearchResultsResolver{alert: alert}, nil+	return &SearchResultsResolver{alert: alert, start: a.startTime}, nil

Yes! That's the 1) solution I mentioned here on the issue. It will work, it's just that it won't be reflecting really the elapsed time... but as the time elapsed on those cases is so small that tends to 0, we could do that.

fedealconada

comment created time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha a78af8c23197092777cb49d2ae0d3f6184176eff

fix large value of ElapsedMilliseconds when empty search returns instantly

view details

push time in 3 months

PR opened sourcegraph/sourcegraph

fix large value of ElapsedMilliseconds when empty search returns instantly

TODO: write description Draft PR that fixes the large value of ElapsedMilliseconds when empty search returns instantly

Fixes #10701

+23 -13

0 comment

5 changed files

pr created time in 3 months

create barnchfedealconada/sourcegraph

branch : GH-10701

created branch time in 3 months

issue commentsourcegraph/sourcegraph

Large value of ElapsedMilliseconds when empty search returns instantly

So, I've checked a bit the code and found out that, basically, the problem is just that sr.start is not defined, so it takes its default value 0001-01-01 00:00:00 +0000 UTC and that's why the calculation throws a large number. This happens when handling the errors from the queries that end up on a return alertForQuery() so then the Results method instantiates a SearchResultResoler without a start time, which causes the bug.

There are multiple ways in which we can solve this: 1). One workaround could be just to pass return &SearchResultsResolver{alert: alert, start: time.Now()}, nil but that time, theoretically, will not really reflect a real time. But, as we know this problem happens when there's like an error and the queries return instantly I guess that in practical terms the elapsedTime is 0 milliseconds... So, IDK, up to you... 2). Add a start := time.Now() line inside NewSearchImplementer, modify alertSearchQuery signature to also receive the time and also modify the searchAlert struct so it has a start member and, finally, modify the Results method so it instantiates the resolver with the time. 3). I have not given it a thought but, maybe I there could be some other way that does not need to change the signature of alertForQuery method...

Thoughts on this @rvantonder ?

rvantonder

comment created time in 3 months

issue commentsourcegraph/sourcegraph

Large value of ElapsedMilliseconds when empty search returns instantly

Yeah, using the GraphQL API console works fine

rvantonder

comment created time in 3 months

issue commentsourcegraph/sourcegraph

Large value of ElapsedMilliseconds when empty search returns instantly

I'm running Sourcegraph locally and when trying to generate an access token I get this... image

rvantonder

comment created time in 3 months

issue commentsourcegraph/sourcegraph

Large value of ElapsedMilliseconds when empty search returns instantly

Great, I'll take a look at it :) Btw, I can't access the link on #10058. Not sure if its relevant though.

rvantonder

comment created time in 3 months

pull request commentsourcegraph/sourcegraph

search: perform -repo exclusion for Sourcegraph.com

Awesome! Glad to hear that @rvantonder :)

fedealconada

comment created time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha 269e1be4fa8eb2af14bf2300356216e893f379c2

compile regex pattern before loop

view details

push time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha 10b2e346462327598b0164f3817928a9adf4c2f4

add fixes from review

view details

push time in 3 months

Pull request review commentsourcegraph/sourcegraph

[GH-10481] - Fix repo exclusion on Sourcegraph.com

 func resolveRepositories(ctx context.Context, op resolveRepoOp) (repoRevisions, type indexedReposFunc func(ctx context.Context, revs []*search.RepositoryRevisions) (indexed, unindexed []*search.RepositoryRevisions, err error) type defaultReposFunc func(ctx context.Context) ([]*types.Repo, error) -func defaultRepositories(ctx context.Context, getRawDefaultRepos defaultReposFunc, getIndexedRepos indexedReposFunc) ([]*types.Repo, error) {+func defaultRepositories(ctx context.Context, getRawDefaultRepos defaultReposFunc, getIndexedRepos indexedReposFunc, excludePatterns []string) ([]*types.Repo, error) { 	// Get the list of default repos from the db. 	defaultRepos, err := getRawDefaultRepos(ctx) 	if err != nil { 		return nil, errors.Wrap(err, "querying db for default repos") 	}++	// Remove excluded repos+	if excludePatterns != nil {+		patterns := `(?i)` + unionRegExps(excludePatterns)+		filteredRepos := defaultRepos[:0]

Shall I proceed with this change or wait for @unknwon 's opinion?

fedealconada

comment created time in 3 months

Pull request review commentsourcegraph/sourcegraph

[GH-10481] - Fix repo exclusion on Sourcegraph.com

 func resolveRepositories(ctx context.Context, op resolveRepoOp) (repoRevisions, type indexedReposFunc func(ctx context.Context, revs []*search.RepositoryRevisions) (indexed, unindexed []*search.RepositoryRevisions, err error) type defaultReposFunc func(ctx context.Context) ([]*types.Repo, error) -func defaultRepositories(ctx context.Context, getRawDefaultRepos defaultReposFunc, getIndexedRepos indexedReposFunc) ([]*types.Repo, error) {+func defaultRepositories(ctx context.Context, getRawDefaultRepos defaultReposFunc, getIndexedRepos indexedReposFunc, excludePatterns []string) ([]*types.Repo, error) { 	// Get the list of default repos from the db. 	defaultRepos, err := getRawDefaultRepos(ctx) 	if err != nil { 		return nil, errors.Wrap(err, "querying db for default repos") 	}++	// Remove excluded repos+	if excludePatterns != nil {+		patterns := `(?i)` + unionRegExps(excludePatterns)+		filteredRepos := defaultRepos[:0]+		for _, repo := range defaultRepos {+			if matched, _ := regexp.Match(patterns, []byte(strings.ToLower(string(repo.Name)))); false == matched {

Haha, I think you're right. I kind of got "inspired" bye this line, because that's were you apply the exclusion when NOT on Sourcegraph.com mode, but makes sense what you say.

fedealconada

comment created time in 3 months

push eventfedealconada/sourcegraph

Federico Martín Alconada Verzini

commit sha cf18518cb6c5d28ffd3d82ebb02c1558a4741d69

run linter

view details

push time in 3 months

PR opened sourcegraph/sourcegraph

[GH-10481] - Fix repo exclusion on Sourcegraph.com

Hey @rvantonder, here's the PR to fixes #10481

Basically, the problem was what you pointed out: you are not applying excludePatterns. I though a bit where the exclusion should take place and I've came to the conclusion that either we could do it after this line or, we could change the signature of defaultRepositories to receive also the excludePatterns and do the filtering inside there. I also thought instead of passing excludePatterns to pass a function that then defaultRepositories could call, but might be a bit of overthinking.

For the tests, I've just added more cases on search_test.go

What do you think about this approach? I have anyways made the PR a draft one.

Fixes #10481

+39 -3

0 comment

2 changed files

pr created time in 3 months

create barnchfedealconada/sourcegraph

branch : GH-10481

created branch time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';+import {getLabelFontColor} from '../../utils/styles';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {

I see! Great catch. I've just added the line that fixes that :) @larkox

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha ffd8e731634eed5c8c0faedc87f4938853f1ef84

avoid calling API if data already set

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';+import {getLabelFontColor} from '../../utils/styles';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {

Hey @larkox, thanks for the feedback. I'm not sure if I follow you... Are you referring to this check?

fedealconada

comment created time in 3 months

pull request commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

@ethervoid Oh! I didn't know there were tests :) I just took at look at post_store_test.go and thought there were no tests. They way I previously "tested" was just via the frontend and searching an email. I've just pushed a change and run the tests you mentioned and they pass...

fedealconada

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with underscore using PostgreSQL engine should work

Oh! I didn't know there were tests :) I just took at look at post_store_test.go and thought there were no tests. They way I previously "tested" was just via the frontend and searching an email. I've just pushed a change and run the tests you mentioned and they pass...

mattermod

comment created time in 3 months

push eventfedealconada/mattermost-server

Federico Martín Alconada Verzini

commit sha eff56a1eddccfd01763a97e1ad72ce39b75f8490

add logic to cover cases in which text is already wrapper by quotes

view details

push time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha a06019399faa72daed93dae58ef3bcede76e0a52

add See more link to github tooltip

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+:root {+    --light-gray: #6a737d;+    --gray: #586069;+    --dark-gray: #24292e;+    --blue: #274466;+    --light-blue: #eff7ff;+}++@media (min-width: 544px) {+    .github-tooltip--large {+        min-width: 320px;+    }+}++/* Github Tooltip */+.github-tooltip .box {+    background-color: white;+    box-shadow: 0 1px 15px rgba(27,31,35,.15);+    position: relative;+    width: 360px;+}++.github-tooltip--bottom-left, .github-tooltip--top-left {+    left: -9px;+    margin-left: 0;+}++/* Header */+.github-tooltip .header {+    color: var(--light-gray);+    font-size: 12px;+}++.github-tooltip .header a {+    text-decoration: none;+    color: var(--gray);+    display: inline-block;+}++/* Body */+.github-tooltip .body > span {+    line-height: 1.25;+}++/* Info */+.github-tooltip .tooltip-info {+    line-height: 1.25;+    display: flex;+    flex-direction: column;+}+.github-tooltip .tooltip-info > a, .github-tooltip .tooltip-info > a:hover {+    display: block;+    text-decoration: none;+    color: var(--dark-gray);+}+.github-tooltip .tooltip-info > a span {+    color: var(--light-gray);+}++.github-tooltip .tooltip-info h5 {+    font-weight: 600;+    font-size: 14px;+    display: inline;+}++.github-tooltip .tooltip-info .markdown-text {+    -ms-overflow-style: none;+    -webkit-hyphens: auto;+    -ms-hyphens: auto;+    hyphens: auto;+    max-height: 150px;

it currently has a max-height, which cuts the text off and that's why I've added the ability to scroll (just that I've hidden the scrollbar, but you are allowed to scroll) @asaadmahmood I'm not so sure which is the solution you propose. Regarding the "See more" link, no problem!

fedealconada

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with underscore using PostgreSQL engine should work

@ethervoid what do you think about doing something like this: searchClause := fmt.Sprintf("AND to_tsvector('english', replace(%s, '_', '/')) @@ to_tsquery('english', replace(:Terms, '_', '/'))", searchType)

I've tested it out and it works, but not sure if I'm missing something...

mattermod

comment created time in 3 months

Pull request review commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

 func (s *SqlPostStore) search(teamId string, userId string, params *model.Search 		} 	} -	// these chars have special meaning and can be treated as spaces-	for _, c := range specialSearchChar {

I believe that removing this will also fix #14437

fedealconada

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with hypen using DB engine should work

@amyblais I'm trying to understand what's the expected outcome. Say we have two posts: 1). t shirt 2). t-shirt

Right now, if I search for t-shirt it will return both posts. The expected behaviour would be that if I search for t-shirt it should ONLY return post 1)?

mattermod

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with underscore using PostgreSQL engine should work

Would you please elaborate on "has underscore is returning more results than it should" @amyblais ?

mattermod

comment created time in 3 months

Pull request review commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

 func (s *SqlPostStore) search(teamId string, userId string, params *model.Search 		} 	} -	// these chars have special meaning and can be treated as spaces-	for _, c := range specialSearchChar {

I'm not really sure why do you need to replace special characters with spaces. So, I'm basically removing this and just, when there's a special character in the terms, I wrap the term with quotes. Thoughts?

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-server

Federico Martín Alconada Verzini

commit sha 9aee39758c9eabcfe9817e28de4b2e93033bbf57

remove comment

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';+import {getLabelFontColor} from '../../utils/styles';++export const LinkTooltip = ({href}) => {

Fixed, I had a typo.

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 8e842f652483fa906d67ee645ae35f9f0d7e23eb

fix typo

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';+import {getLabelFontColor} from '../../utils/styles';++export const LinkTooltip = ({href}) => {

I'll take a loot at it!

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

 func (p *Plugin) updateSettings(w http.ResponseWriter, r *http.Request, userID s 	resp, _ := json.Marshal(info.Settings) 	w.Write(resp) }++func (p *Plugin) getIssueByNumber(w http.ResponseWriter, r *http.Request, userID string) {++	ctx := context.Background()++	var githubClient *github.Client+	owner := r.FormValue("owner")+	repo := r.FormValue("repo")+	number := r.FormValue("number")+	numberInt, _ := strconv.Atoi(number)++	if info, err := p.getGitHubUserInfo(userID); err != nil {+		writeAPIError(w, err)+		return+	} else {+		githubClient = p.githubConnect(*info.Token)+	}++	result, _, err := githubClient.Issues.Get(ctx, owner, repo, numberInt)+	if err != nil {+		mlog.Error(err.Error())

So, what do you suggest? Because, currently, if an error occurs result would just be nil, and then this line is executed, which ignores any possible error as well. If I handle that error, there should be an error handler if the marshal occurs... Thoughts?

fedealconada

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with underscore using PostgreSQL engine should work

I can take this one!

mattermod

comment created time in 3 months

issue commentmattermost/mattermost-server

Search terms with hypen using DB engine should work

I can take this one!

mattermod

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 9fe3e01b253a0bc5bb504275e22450122eb8c3fa

remove unnecessary classes and fix format

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {+            if (href.includes('github.com/')) {+                const [owner, repo, type, number] = href.split('github.com/')[1].split('/');+                let res;+                switch (type) {+                case 'issues':+                    res = await Client.getIssue(owner, repo, number);+                    break;+                case 'pull':+                    res = await Client.getPullRequest(owner, repo, number);+                    break;+                }+                if (res) {+                    res.owner = owner;+                    res.repo = repo;+                    res.type = type;+                }+                setData(res);+            }+        };+        init();+    }, []);++    const getIconElement = () => {+        let icon;+        let color;+        let iconType;+        switch (data.type) {+        case 'pull':+            color = '#28a745';+            iconType = GitPullRequest;+            if (data.state === 'closed' && data.merged) {+                color = '#6f42c1';+                iconType = GitMerge;+            } else {+                color = '#cb2431';+            }+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        case 'issues':+            color = data.state === 'open' ? '#28a745' : '#cb2431';+            iconType = data.state === 'open' ? IssueOpened : IssueClosed;+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        }+        return icon;+    };++    const getLabelFontColor = (hexcolor) => {

Pushed change to fix that @hanzei :)

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha a65f718cd1c2158ff43d316e0e5c8b9e6c7f576b

move to utils and use it to fix sidebar labels

view details

push time in 3 months

push eventfedealconada/mattermost-server

Federico Martín Alconada Verzini

commit sha e0d970e978b0487f1cd9686b61e754ccb6929ef1

fix search for emails in Posts in databases

view details

push time in 3 months

pull request commentmattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

I've tested this both on postgres and mysql and seems to fix it

fedealconada

comment created time in 3 months

PR opened mattermost/mattermost-server

[GH-14434] fix search for emails in Posts in databases

Summary

This PR fixes search for emails in Posts in databases

Ticket Link

Fixes https://github.com/mattermost/mattermost-server/issues/14434

+2 -3

0 comment

1 changed file

pr created time in 3 months

create barnchfedealconada/mattermost-server

branch : GH-14434

created branch time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+:root {+    --light-gray: #6a737d;+    --gray: #586069;+    --dark-gray: #24292e;+    --blue: #274466;+    --light-blue: #eff7ff;+}++@media (min-width: 544px) {+    .github-tooltip--large {+        min-width: 320px;+    }+}++/* Github Tooltip */+.github-tooltip .box {+    background-color: white;+    box-shadow: 0 1px 15px rgba(27,31,35,.15);+    position: relative;+    width: 360px;+}++.github-tooltip--bottom-left, .github-tooltip--top-left {+    left: -9px;+    margin-left: 0;+}++/* Header */+.github-tooltip .header {+    color: var(--light-gray);+    font-size: 12px;+}++.github-tooltip .header a {+    text-decoration: none;+    color: var(--gray);+    display: inline-block;+}++/* Body */+.github-tooltip .body > span {+    line-height: 1.25;+}++/* Info */+.github-tooltip .tooltip-info {+    line-height: 1.25;+    display: flex;+    flex-direction: column;+}+.github-tooltip .tooltip-info > a, .github-tooltip .tooltip-info > a:hover {+    display: block;+    text-decoration: none;+    color: var(--dark-gray);+}+.github-tooltip .tooltip-info > a span {+    color: var(--light-gray);+}++.github-tooltip .tooltip-info h5 {+    font-weight: 600;+    font-size: 14px;+    display: inline;+}++.github-tooltip .tooltip-info .markdown-text {+    -ms-overflow-style: none;+    -webkit-hyphens: auto;+    -ms-hyphens: auto;+    hyphens: auto;+    max-height: 150px;

I feel it could be useful... Even though it's a quick glance, sometimes we get a bit lazy about having to open the link, wait the page to load, etc etc. Imagine that maybe you know there's a useful link inside the description that you know is placed at the bottom of it... just scrolling will help you out... But yeah, up to others opinions :)

fedealconada

comment created time in 3 months

issue commentmattermost/mattermost-server

Fix search for emails in Posts in databases

I'd like to give this a shot

mattermod

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 33cf2b34929cc3fd125467b95fbb1204d16a0cdf

add changes from PR review

view details

push time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

 func (p *Plugin) updateSettings(w http.ResponseWriter, r *http.Request, userID s 	resp, _ := json.Marshal(info.Settings) 	w.Write(resp) }++func (p *Plugin) getIssueByNumber(w http.ResponseWriter, r *http.Request, userID string) {++	ctx := context.Background()++	var githubClient *github.Client+	owner := r.FormValue("owner")+	repo := r.FormValue("repo")+	number := r.FormValue("number")+	numberInt, _ := strconv.Atoi(number)++	if info, err := p.getGitHubUserInfo(userID); err != nil {+		writeAPIError(w, err)+		return+	} else {+		githubClient = p.githubConnect(*info.Token)+	}++	result, _, err := githubClient.Issues.Get(ctx, owner, repo, numberInt)+	if err != nil {+		mlog.Error(err.Error())

That's the way it's done on other parts of the code... For instance, here

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

 func (p *Plugin) updateSettings(w http.ResponseWriter, r *http.Request, userID s 	resp, _ := json.Marshal(info.Settings) 	w.Write(resp) }++func (p *Plugin) getIssueByNumber(w http.ResponseWriter, r *http.Request, userID string) {++	ctx := context.Background()++	var githubClient *github.Client+	owner := r.FormValue("owner")+	repo := r.FormValue("repo")+	number := r.FormValue("number")+	numberInt, _ := strconv.Atoi(number)

Makes sense!

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

 func (p *Plugin) updateSettings(w http.ResponseWriter, r *http.Request, userID s 	resp, _ := json.Marshal(info.Settings) 	w.Write(resp) }++func (p *Plugin) getIssueByNumber(w http.ResponseWriter, r *http.Request, userID string) {++	ctx := context.Background()++	var githubClient *github.Client+	owner := r.FormValue("owner")+	repo := r.FormValue("repo")+	number := r.FormValue("number")

Well... I would disagree on this... /createissuecomment is a POST endpoint which calls the Github POST endpoint, so it makes sense that it receives a body. But in the case of /issue and /pr are GET endpoints so it makes sense to receive the values as query params. What do you think?

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {+            if (href.includes('github.com/')) {+                const [owner, repo, type, number] = href.split('github.com/')[1].split('/');+                let res;+                switch (type) {+                case 'issues':+                    res = await Client.getIssue(owner, repo, number);+                    break;+                case 'pull':+                    res = await Client.getPullRequest(owner, repo, number);+                    break;+                }+                if (res) {+                    res.owner = owner;+                    res.repo = repo;+                    res.type = type;+                }+                setData(res);+            }+        };+        init();+    }, []);++    const getIconElement = () => {+        let icon;+        let color;+        let iconType;+        switch (data.type) {+        case 'pull':+            color = '#28a745';+            iconType = GitPullRequest;+            if (data.state === 'closed' && data.merged) {+                color = '#6f42c1';+                iconType = GitMerge;+            } else {+                color = '#cb2431';

Good catch, I'll take a look at it :)

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+import React, {useEffect, useState} from 'react';+import PropTypes from 'prop-types';+import './tooltip.css';+import Octicon, {GitMerge, GitPullRequest, IssueClosed, IssueOpened} from '@primer/octicons-react';+import ReactMarkdown from 'react-markdown';++import Client from 'client';++export const LinkTooltip = ({href}) => {+    const [data, setData] = useState(null);++    useEffect(() => {+        const init = async () => {+            if (href.includes('github.com/')) {+                const [owner, repo, type, number] = href.split('github.com/')[1].split('/');+                let res;+                switch (type) {+                case 'issues':+                    res = await Client.getIssue(owner, repo, number);+                    break;+                case 'pull':+                    res = await Client.getPullRequest(owner, repo, number);+                    break;+                }+                if (res) {+                    res.owner = owner;+                    res.repo = repo;+                    res.type = type;+                }+                setData(res);+            }+        };+        init();+    }, []);++    const getIconElement = () => {+        let icon;+        let color;+        let iconType;+        switch (data.type) {+        case 'pull':+            color = '#28a745';+            iconType = GitPullRequest;+            if (data.state === 'closed' && data.merged) {+                color = '#6f42c1';+                iconType = GitMerge;+            } else {+                color = '#cb2431';+            }+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        case 'issues':+            color = data.state === 'open' ? '#28a745' : '#cb2431';+            iconType = data.state === 'open' ? IssueOpened : IssueClosed;+            icon = (+                <span style={{color}}>+                    <Octicon+                        icon={iconType}+                        size='small'+                        verticalAlign='middle'+                    />+                </span>+            );+            break;+        }+        return icon;+    };++    const getLabelFontColor = (hexcolor) => {

Yep, assign it to me

fedealconada

comment created time in 3 months

Pull request review commentmattermost/mattermost-plugin-github

[GH-255] Add tooltip for pull request and issue links

+:root {+    --light-gray: #6a737d;+    --gray: #586069;+    --dark-gray: #24292e;+    --blue: #274466;+    --light-blue: #eff7ff;+}++@media (min-width: 544px) {+    .github-tooltip--large {+        min-width: 320px;+    }+}++/* Github Tooltip */+.github-tooltip .box {+    background-color: white;+    box-shadow: 0 1px 15px rgba(27,31,35,.15);+    position: relative;+    width: 360px;+}++.github-tooltip--bottom-left, .github-tooltip--top-left {+    left: -9px;+    margin-left: 0;+}++/* Header */+.github-tooltip .header {+    color: var(--light-gray);+    font-size: 12px;+}++.github-tooltip .header a {+    text-decoration: none;+    color: var(--gray);+    display: inline-block;+}++/* Body */+.github-tooltip .body > span {+    line-height: 1.25;+}++/* Info */+.github-tooltip .tooltip-info {+    line-height: 1.25;+    display: flex;+    flex-direction: column;+}+.github-tooltip .tooltip-info > a, .github-tooltip .tooltip-info > a:hover {+    display: block;+    text-decoration: none;+    color: var(--dark-gray);+}+.github-tooltip .tooltip-info > a span {+    color: var(--light-gray);+}++.github-tooltip .tooltip-info h5 {+    font-weight: 600;+    font-size: 14px;+    display: inline;+}++.github-tooltip .tooltip-info .markdown-text {+    -ms-overflow-style: none;+    -webkit-hyphens: auto;+    -ms-hyphens: auto;+    hyphens: auto;+    max-height: 150px;

Well... actually, I gave this a though and decided to do it like that. The thing is, the scrolling is enabled, so you should be able to scroll down there but I have hidden the scrollbar because I thought it was more "elegant" not to show it, but it might seem a bit weird. Either I could show the scrollbar or I could play around with the 'react-markdown' so it only renders an amount of HTML tags... There are several options in which this could be done... I could also just convert the whole text to one only <p> with no format and add ellipsis on overflow, i don't know.... I would say that, because of the scope of this issue (which was not actually including the pr/issue description on the tooltip), I would rather decide between keeping it like this or un-hiding the scrollbar. Thoughts?

fedealconada

comment created time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha a9fc584c315325868877a4969ba89b624ada6097

add github tooltip on webapp

view details

push time in 3 months

PR opened mattermost/mattermost-plugin-github

Reviewers
[GH-255] Add tooltip for pull request and issue links

Summary

This PR adds a tooltip for pull request and issue links

Ticket Link

Fixes https://github.com/mattermost/mattermost-server/issues/255

+702 -10

0 comment

8 changed files

pr created time in 3 months

create barnchfedealconada/mattermost-plugin-github

branch : GH-255

created branch time in 3 months

push eventfedealconada/mattermost-plugin-github

Federico Martín Alconada Verzini

commit sha 90d31a22ee32ad6c862f3d193cc0d44847767c20

add GET /issue and GET /pr endpoints

view details

Federico Martín Alconada Verzini

commit sha 6984517101cd84b219c5304e091ab3af0afeacc8

add github tooltip on webapp

view details

push time in 3 months

more