File tree 4 files changed +39
-5
lines changed 4 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ type SearchRepoOptions struct {
142
142
OrderBy SearchOrderBy
143
143
Private bool // Include private repositories in results
144
144
StarredByID int64
145
+ WatchedByID int64
145
146
AllPublic bool // Include also all public repositories of users and public organisations
146
147
AllLimited bool // Include also all public repositories of limited organisations
147
148
// None -> include public and private
@@ -240,6 +241,11 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond {
240
241
cond = cond .And (builder .In ("id" , builder .Select ("repo_id" ).From ("star" ).Where (builder.Eq {"uid" : opts .StarredByID })))
241
242
}
242
243
244
+ // Restrict to watched repositories
245
+ if opts .WatchedByID > 0 {
246
+ cond = cond .And (builder .In ("id" , builder .Select ("repo_id" ).From ("watch" ).Where (builder.Eq {"user_id" : opts .WatchedByID })))
247
+ }
248
+
243
249
// Restrict repositories to those the OwnerID owns or contributes to as per opts.Collaborate
244
250
if opts .OwnerID > 0 {
245
251
var accessCond = builder .NewCond ()
Original file line number Diff line number Diff line change @@ -412,6 +412,7 @@ repositories = Repositories
412
412
activity = Public Activity
413
413
followers = Followers
414
414
starred = Starred Repositories
415
+ watched = Watched Repositories
415
416
projects = Projects
416
417
following = Following
417
418
follow = Follow
Original file line number Diff line number Diff line change @@ -238,6 +238,27 @@ func Profile(ctx *context.Context) {
238
238
ctx .ServerError ("GetProjects" , err )
239
239
return
240
240
}
241
+ case "watching" :
242
+ repos , count , err = models .SearchRepository (& models.SearchRepoOptions {
243
+ ListOptions : models.ListOptions {
244
+ PageSize : setting .UI .User .RepoPagingNum ,
245
+ Page : page ,
246
+ },
247
+ Actor : ctx .User ,
248
+ Keyword : keyword ,
249
+ OrderBy : orderBy ,
250
+ Private : ctx .IsSigned ,
251
+ WatchedByID : ctxUser .ID ,
252
+ Collaborate : util .OptionalBoolFalse ,
253
+ TopicOnly : topicOnly ,
254
+ IncludeDescription : setting .UI .SearchRepoDescription ,
255
+ })
256
+ if err != nil {
257
+ ctx .ServerError ("SearchRepository" , err )
258
+ return
259
+ }
260
+
261
+ total = int (count )
241
262
default :
242
263
repos , count , err = models .SearchRepository (& models.SearchRepoOptions {
243
264
ListOptions : models.ListOptions {
Original file line number Diff line number Diff line change 84
84
</div>
85
85
<div class="ui eleven wide column">
86
86
<div class="ui secondary stackable pointing tight menu">
87
- <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
87
+ <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName " projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
88
88
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
89
89
</a>
90
90
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
91
91
{{svg "octicon-rss"}} {{.i18n.Tr "user.activity"}}
92
92
</a>
93
- <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
94
- {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
95
- <div class="ui label">{{.Owner.NumStars}}</div>
96
- </a>
93
+ {{if not .DisableStars}}
94
+ <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
95
+ {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
96
+ <div class="ui label">{{.Owner.NumStars}}</div>
97
+ </a>
98
+ {{else}}
99
+ <a class='{{if eq .TabName "watching"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=watching">
100
+ {{svg "octicon-eye"}} {{.i18n.Tr "user.watched"}}
101
+ </a>
102
+ {{end}}
97
103
<a class='{{if eq .TabName "following"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=following">
98
104
{{svg "octicon-person"}} {{.i18n.Tr "user.following"}}
99
105
<div class="ui label">{{.Owner.NumFollowing}}</div>
You can’t perform that action at this time.
0 commit comments