Skip to content

Commit

Permalink
Merge pull request #548 from factly/fix/minor
Browse files Browse the repository at this point in the history
Fix/minor
  • Loading branch information
shreeharsha-factly authored May 18, 2022
2 parents 671455f + e43733c commit a388bbc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
3 changes: 2 additions & 1 deletion api/graph/models/medium.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package models
import (
"encoding/json"
"net/url"
"strings"
"time"

"github.com/jinzhu/gorm/dialects/postgres"
Expand Down Expand Up @@ -37,7 +38,7 @@ func (media *Medium) AfterFind(tx *gorm.DB) (err error) {
_ = json.Unmarshal(media.URL.RawMessage, &resurl)
if rawURL, found := resurl["raw"]; found {
urlObj, _ := url.Parse(rawURL.(string))
resurl["proxy"] = viper.GetString("imageproxy_url") + urlObj.Path
resurl["proxy"] = strings.Replace(viper.GetString("imageproxy_url")+urlObj.Path, "/dega.factly.in", "", 1)

rawBArr, _ := json.Marshal(resurl)
media.URL = postgres.Jsonb{
Expand Down
11 changes: 6 additions & 5 deletions server/cmd/reindex-search.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package cmd

import (
"log"
"errors"

"github.com/factly/dega-server/config"
"github.com/factly/dega-server/util"
"github.com/factly/x/loggerx"
"github.com/factly/x/meilisearchx"
"github.com/spf13/cobra"
)
Expand All @@ -18,23 +19,23 @@ var reindexCommand = &cobra.Command{
Short: "Reindex meilisearch index if ENABLE_SEARCH_INDEXING is set true",
Run: func(cmd *cobra.Command, args []string) {
if !config.SearchEnabled() {
log.Fatal("Search indexing not enabled...")
loggerx.Error(errors.New("search indexing not enabled"))
}

config.SetupDB()

err := meilisearchx.SetupMeiliSearch("dega", []string{"name", "slug", "description", "title", "subtitle", "excerpt", "claim", "fact", "site_title", "site_address", "tag_line", "review", "review_tag_line"})
if err != nil {
log.Fatal(err)
loggerx.Error(err)
}

_, err = meilisearchx.Client.Documents("dega").DeleteAllDocuments()
if err != nil {
log.Fatal(err)
loggerx.Error(err)
}

if err = util.ReindexAllEntities(0); err != nil {
log.Fatal(err)
loggerx.Error(err)
}

},
Expand Down
9 changes: 4 additions & 5 deletions studio/src/components/GlobalNav/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ function Sidebar({ superOrg, permission, orgs, loading, applications }) {
padding: collapsed ? '0 0.5rem' : '0 24px',
}}
>
<Link to="/">
<div className="menu-header" style={{}}>
<SpaceSelector collapsed={collapsed} />
</div>
</Link>
<div className="menu-header" style={{}}>
<SpaceSelector collapsed={collapsed} />
</div>

<Search collapsed={collapsed} />
</div>
<Menu
Expand Down
3 changes: 0 additions & 3 deletions studio/src/components/GlobalNav/SpaceSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ import { useSelector, useDispatch } from 'react-redux';
import { Select, Avatar } from 'antd';
import { setSelectedSpace } from '../../actions/spaces';
import degaImg from '../../assets/dega.png';
import { useHistory } from 'react-router-dom';

const { Option, OptGroup } = Select;

function SpaceSelector({ collapsed }) {
const { orgs, details, selected } = useSelector((state) => state.spaces);
const dispatch = useDispatch();
const history = useHistory();

const handleSpaceChange = (space) => {
dispatch(setSelectedSpace(space));
history.push('/');
};

return (
Expand Down

0 comments on commit a388bbc

Please sign in to comment.